Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp1173848ybg; Wed, 29 Jul 2020 07:38:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIvECkJA9WrC+kf4UVdMT3NPg3rvBuCO2ov348Rn8JfaGPWV3ypjPy++2xuyIbSNnFH162 X-Received: by 2002:a50:fb94:: with SMTP id e20mr82330edq.103.1596033508483; Wed, 29 Jul 2020 07:38:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596033508; cv=none; d=google.com; s=arc-20160816; b=pVYv6eJChCpTKAewYahZTY76uwJnLMtRDrl3lfsvd1PEJAMlDSgvQrVztKmuGKbUmN Fc0fGM27D6cgFYrjt8960hm7J5gRLSQH3gYje5y/ZA9XGsV3S4XJbBOd61j/y3onOw2D ceNz3ggzNW8hnlyaYsJtuB/MqNZ19I5EG4YOk9OulctjL5hFe4G2iowBpexenkOF5zRX 1HoNMhL9h9AviP+9AEvJ8/YKc4TaTjs+1gOAdsmJGGqJO0QHI/gMoqEAxQkMsDKrFbF7 vbObp6L2m8k40+3YzT7LjBiBxsV8YOg5lU2xJEfbNvaIaTOZXXoGpfbVUHm3aBAU/HEq NctQ== 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 :robot-unsubscribe:robot-id:message-id:mime-version:references :in-reply-to:cc:subject:to:reply-to:from:dkim-signature :dkim-signature:date; bh=FEocO7+NlDCoiTLQAY3eF2+pM8PAn8sjRfK4fBmQYkw=; b=GR1IxCj1XX5gJskAl5InyBzSfUdKb7097fOFHE3qy1qmJio4GCjd89TvUeP2rKcSHq dVYnc2jLwAzVprwnaEHZohtmXDEzMXEm4yMWxRPhp50SepaHmfBzSCV2RIpTDNtlODzc lDJn/Y7/nyYuZrgkNu3p227reihrM+nJ5xmyIo4oZzT6+2ghKz/+ikWvFgCyq8+fyxtX fQFYQqTumciejLnQfTMChA7YQAvSai7wZW1MqpB1gzLFNKrDXL7uhTxmhjm5VeECm8jY 7uBM0TJ789xZWt+lkWY4zVqBRMuBygTb7V6QopyjN4DEgczvnnZTEM6EWz7WswAM9rB/ Ch/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linutronix.de header.s=2020 header.b=3N2DjixW; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=fail (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 h15si1247165ejq.463.2020.07.29.07.38.06; Wed, 29 Jul 2020 07:38:28 -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=fail header.i=@linutronix.de header.s=2020 header.b=3N2DjixW; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728045AbgG2OfC (ORCPT + 99 others); Wed, 29 Jul 2020 10:35:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726979AbgG2Odd (ORCPT ); Wed, 29 Jul 2020 10:33:33 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 837C3C061794; Wed, 29 Jul 2020 07:33:33 -0700 (PDT) Date: Wed, 29 Jul 2020 14:33:30 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1596033211; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FEocO7+NlDCoiTLQAY3eF2+pM8PAn8sjRfK4fBmQYkw=; b=3N2DjixWSg5SvK/AoTqE+Ja8PmQinMHqq5zRoOmeui9hvRGaDFQSRYe++Gx+Z7qipHX2Hd nUQOCqutenAxNPIIqKBgZGVYm9akcPQjt1XV/KLn9e+3qKkhpLrh28L7BfURS2dTzjaEkF KmZL6qGWDuaYkX5lPk9R46dlCTFWWAz6Mv0ZDL+haACVrivexOL9Z0gXYr8EVN3wuGVicO 8N3VdMIQrOxS5sx8ZiYO/jKBe+2Et3gi1g1VC2aAowk2zpy2aHsAVgsr3QbHPMnfUbZw/l qYwjSlLN4T9O+tuRzU2pPwU7lFoB2d1/JEuwQyt1mObdRB+o2Y0cNgUlTeTy7Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1596033211; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FEocO7+NlDCoiTLQAY3eF2+pM8PAn8sjRfK4fBmQYkw=; b=0ZHDmQQpSuY6RjNCHMxJPrN6V2qDaIx9tua23uHDVTGt1we622Fkl3YQRmq2uNBJ2vbPZp KRrpJbn/G3qQfhBA== From: "tip-bot2 for Ahmed S. Darwish" Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: locking/core] raid5: Use sequence counter with associated spinlock Cc: "Ahmed S. Darwish" , "Peter Zijlstra (Intel)" , Song Liu , x86 , LKML In-Reply-To: <20200720155530.1173732-20-a.darwish@linutronix.de> References: <20200720155530.1173732-20-a.darwish@linutronix.de> MIME-Version: 1.0 Message-ID: <159603321049.4006.8865021952492232717.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the locking/core branch of tip: Commit-ID: 0a87b25ff2eb6169403c88b0d5f3c97bdaa3c930 Gitweb: https://git.kernel.org/tip/0a87b25ff2eb6169403c88b0d5f3c97bdaa3c930 Author: Ahmed S. Darwish AuthorDate: Mon, 20 Jul 2020 17:55:25 +02:00 Committer: Peter Zijlstra CommitterDate: Wed, 29 Jul 2020 16:14:27 +02:00 raid5: Use sequence counter with associated spinlock 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 Signed-off-by: Peter Zijlstra (Intel) Acked-by: Song Liu Link: https://lkml.kernel.org/r/20200720155530.1173732-20-a.darwish@linutronix.de --- 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 ab8067f..892aefe 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 f90e070..a2c9e9e 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