Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3315306ybt; Mon, 29 Jun 2020 22:48:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxkuSLPEPKaC34fT2Qu3xXIix6DkHYap21eO8sk0LeNYReFnEU+xOjsh41AScZUom66z6WT X-Received: by 2002:a50:9a82:: with SMTP id p2mr20799048edb.130.1593496120674; Mon, 29 Jun 2020 22:48:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593496120; cv=none; d=google.com; s=arc-20160816; b=hdo7dEWHyU/BrlLbJD3TXPCP85Z/kz/Ohpkh32yLVrcXRLc9E6+n6/aGuAAOeQtouT BIjx/RpwBgvHlt+JFDpdpGMOGzHSXtUDo13QZ4LodmbKeBeZMxZ+/BjnTQ7QoBluCa+F JmNyQdvDeZnQuBM9kZKNE5z4d0NJDu3mC9A1XaMZM8ESjZpY6H/wlXF/Pm1JolJWawTC CtrvDhD6rGMU1nw7mdDNiPbROHDCFeTUsujtSbdVX8wpxmF1JiNe5C/q4uIHi77JZ3IZ tQQ2mDkQz/rIaMzRZqKc/O/kswRn81c+JTHvfoOaGRNU4BMNEIhOZle9VmcHL58tUZPD Xf5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-signature:from; bh=xAbB9oKLEGHYN+w+z0ndpRUVlVFavwl3/3bbk6nkTI4=; b=adaRLZmh/jNaXPXaqSogGwDirPkdkbooWfCtCtPaurztGd/4LuZnzVSob11XBf7n1D qy9qTD4f1bQCgQl8PfSVFrusyH5KVRGMglMyYmOxR+W2zXMKiGDNNWCM9YIyWvwugBMc jEtrLLKyIYSNUKtvnkVvYbW9+SJ2Ksf5TwJOVrZsJwpmbjZWpRL5n3rpAKRX3/Ax2FCc uq/o3jLfaIud6KnuU4jY1Zg9slxSUFnZaEHaE4GrT92f99Pl+fPdesyOdVUnd0ORiaOU Pe/kuVxhz9ThLScLggaVAxsEjSgtmK5oT+9cuvGPZOn6uZFkignsK/kyUTUb30BpJ9KW 3+vA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=rvJu64eY; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=3GnXUT0N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cq21si1045547edb.353.2020.06.29.22.48.18; Mon, 29 Jun 2020 22:48:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=rvJu64eY; dkim=neutral (no key) header.i=@vger.kernel.org header.s=2020e header.b=3GnXUT0N; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729995AbgF3FqP (ORCPT + 99 others); Tue, 30 Jun 2020 01:46:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729811AbgF3FqL (ORCPT ); Tue, 30 Jun 2020 01:46:11 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 545A4C061755; Mon, 29 Jun 2020 22:46:11 -0700 (PDT) From: "Ahmed S. Darwish" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1593495970; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xAbB9oKLEGHYN+w+z0ndpRUVlVFavwl3/3bbk6nkTI4=; b=rvJu64eY7bS9Ir5/N1LjQAVQ+/Gc9LNl7dorDdUgfJ6rNE76pkrh8yBaGyMhMHUJxHxQS3 PuFvFbljhuqZ6545iZTwIpoYPqMS6cDFZonmj8Y5Ksndbnx9FYokvglbh8tCN5jb9Mf5Rh r0wHtUcZChUAcCLk+McJrQa8F1RhsIzyn4Tkulo1KFDtfIXd2ZlBgnjiAGf4bUbgIxuT3p 6IYvDV/ifvRjjVimphEALE6OpqHwqcIXo+j3aLJ+RwsDgi8VYCxNIuOP9WEttxOczzyOzI 9o8hhieha3cFaC+eJE7fcFddc9wvGhITO01/I0oG5QN51Ziwv5pNrCdzJqHKBw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1593495970; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xAbB9oKLEGHYN+w+z0ndpRUVlVFavwl3/3bbk6nkTI4=; b=3GnXUT0NYEOA76vJPT7kAU6dbj67yPQUf13YdD2IP3Zlpm1MaZJHQahoCp1iP6wKoJGsW8 /pAHwcMnUFN2EVBA== To: Peter Zijlstra , Ingo Molnar , Will Deacon Cc: Thomas Gleixner , "Paul E. McKenney" , "Sebastian A. Siewior" , Steven Rostedt , LKML , "Ahmed S. Darwish" , Song Liu , linux-raid@vger.kernel.org Subject: [PATCH v3 15/20] raid5: Use sequence counter with associated spinlock Date: Tue, 30 Jun 2020 07:44:47 +0200 Message-Id: <20200630054452.3675847-16-a.darwish@linutronix.de> In-Reply-To: <20200630054452.3675847-1-a.darwish@linutronix.de> References: <20200519214547.352050-1-a.darwish@linutronix.de> <20200630054452.3675847-1-a.darwish@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A sequence counter write side critical section must be protected by some form of locking to serialize writers. A plain seqcount_t does not contain the information of which lock must be held when entering a write side critical section. Use the new seqcount_spinlock_t data type, which allows to associate a spinlock with the sequence counter. This enables lockdep to verify that the spinlock used for writer serialization is held when the write side critical section is entered. If lockdep is disabled this lock association is compiled out and has neither storage size nor runtime overhead. Signed-off-by: Ahmed S. Darwish --- drivers/md/raid5.c | 2 +- drivers/md/raid5.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index ab8067f9ce8c..892aefe88fa7 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c @@ -6935,7 +6935,7 @@ static struct r5conf *setup_conf(struct mddev *mddev) } else goto abort; spin_lock_init(&conf->device_lock); - seqcount_init(&conf->gen_lock); + seqcount_spinlock_init(&conf->gen_lock, &conf->device_lock); mutex_init(&conf->cache_size_mutex); init_waitqueue_head(&conf->wait_for_quiescent); init_waitqueue_head(&conf->wait_for_stripe); diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index f90e0704bed9..a2c9e9e9f5ac 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h @@ -589,7 +589,7 @@ struct r5conf { int prev_chunk_sectors; int prev_algo; short generation; /* increments with every reshape */ - seqcount_t gen_lock; /* lock against generation changes */ + seqcount_spinlock_t gen_lock; /* lock against generation changes */ unsigned long reshape_checkpoint; /* Time we last updated * metadata */ long long min_offset_diff; /* minimum difference between -- 2.20.1