From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, MENTIONS_GIT_HOSTING,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A40E0C433E1 for ; Wed, 29 Jul 2020 14:35:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 84CBB208A9 for ; Wed, 29 Jul 2020 14:35:08 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="3N2DjixW"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0ZHDmQQp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728050AbgG2OfD (ORCPT ); Wed, 29 Jul 2020 10:35:03 -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