Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1819463rwd; Sun, 21 May 2023 07:02:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5JHG7XHDakpuwPv2cAgD4P3s+IAOzoWRjPu9QV0jqxC+fNgGQsBc5Inz+9PrAfDBGTAAdl X-Received: by 2002:a17:90a:f68a:b0:253:70b7:18d1 with SMTP id cl10-20020a17090af68a00b0025370b718d1mr7723024pjb.34.1684677741706; Sun, 21 May 2023 07:02:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684677741; cv=none; d=google.com; s=arc-20160816; b=nGHLToO6xmarLketCES7SEGkdt068u0WJc/BwiC3ya1RpGkRUPlBDHS49BSu1rQPuy LqonoaHFLwLAsMWTVCicAhEWWJ6w9S20Tljeuq/njmzOzOfOnxkJf0VS2qEnXZWoWomE NHvfcKoeBgkv+6dLv0ANjnMxxSq49R+W4CkbHPxeNtulo0JgSnVcbRhNWoV8eVpUZcyj MvxJXJkKUbLCIAqeDom64ftUYBwF+f/j3CFbVBiGb0aSISK9hPL9ZHpuM3EN7AwzrSNe OH7YWIBsr/phOqltJV3lpxpOZC/E9YrVzmeSSlp+I92xDHWjrUMAtFhCISh8zPBPstEW yWjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature:dkim-signature; bh=EsM4Cv/srHTmWHPMTiUXiGFITZ54mA/K/irQdpcwplY=; b=DVPN4QJCvwp7vDkT1KzgjM4BAPzohqHE0UFvKzjQ3wB0Y+Gq51UeWj5sWVVAs6EUth F1TMep0YHqHWdZaGovMbJ0vSKuTlG/LxhNVCic/LM4QYm4OgcM54CBiHV4bamKV+tVPh G02wO8NKqL3jpf+WFo3hiNbndMwn0P8xB5xMdmB9Y5qty7xYJpckOrtGOq+RcUyrLzt6 om4u0b0mCELNYy6pbI7GhENLCZQsWjyq3yZcsQLn3Z0PVS2fnQzoUZKcB+pQIrHG3a0T 7aboGSKvlr9RD6s+iitSBru0qqduKBRSSQett/PA4y8U16AzrP9q7UE6LgkR3c2AekIZ M6aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=CmBxgcNU; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=RbUmPt+E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u29-20020a63b55d000000b0051343ab1eb5si3374412pgo.581.2023.05.21.07.02.09; Sun, 21 May 2023 07:02:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=CmBxgcNU; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=RbUmPt+E; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230181AbjEUNgw (ORCPT + 99 others); Sun, 21 May 2023 09:36:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229903AbjEUN2F (ORCPT ); Sun, 21 May 2023 09:28:05 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C7809C; Sun, 21 May 2023 06:21:52 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id DB2D91FD88; Sun, 21 May 2023 13:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684675310; h=from:from:reply-to: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=EsM4Cv/srHTmWHPMTiUXiGFITZ54mA/K/irQdpcwplY=; b=CmBxgcNU52MI6T8v9Pj3wmT4mKUZvr2RKI5E5CN12vFBs0C5rfn5Amgb023ZDwUWeFgL8C 6sZFlNRf1EzoCe59JRHVfUvJ3q42M+MzBiJ3vnlqQI6lExgI4JpTeHzFfaSA4KB1I59bMk gKrt2hIIOriWcMVnDvD0mG19C898cP8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684675310; h=from:from:reply-to: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=EsM4Cv/srHTmWHPMTiUXiGFITZ54mA/K/irQdpcwplY=; b=RbUmPt+EScEQk92Szr6ZCazI91vAaIkbSoaEXDytoBYRYm5IBi17btfMsbOKMdDugGYMOB 6tu8LcQv0QCSpBBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3845313425; Sun, 21 May 2023 13:21:48 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id CKo8O+waamSEJAAAMHmgww (envelope-from ); Sun, 21 May 2023 13:21:48 +0000 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.500.231\)) Subject: Re: [tip: locking/core] bcache: Convert to lock_cmp_fn From: Coly Li In-Reply-To: <168457974565.404.16611061652498882569.tip-bot2@tip-bot2> Date: Sun, 21 May 2023 21:21:36 +0800 Cc: Kent Overstreet , "Peter Zijlstra (Intel)" , LKML , "Coly Li " <"mailto:colyli"@suse.de>, x86@kernel.org Content-Transfer-Encoding: quoted-printable Message-Id: <1FBFDA28-6886-4315-A942-88F3542CE244@suse.de> References: <20230509195847.1745548-2-kent.overstreet@linux.dev> <168457974565.404.16611061652498882569.tip-bot2@tip-bot2> To: linux-tip-commits@vger.kernel.org X-Mailer: Apple Mail (2.3731.500.231) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 2023=E5=B9=B45=E6=9C=8820=E6=97=A5 18:49=EF=BC=8Ctip-bot2 for Kent = Overstreet =E5=86=99=E9=81=93=EF=BC=9A >=20 > The following commit has been merged into the locking/core branch of = tip: >=20 > Commit-ID: 0ad397b556936a14052aa65d8fa958a9f3175add > Gitweb: = https://git.kernel.org/tip/0ad397b556936a14052aa65d8fa958a9f3175add > Author: Kent Overstreet > AuthorDate: Tue, 09 May 2023 15:58:47 -04:00 > Committer: Peter Zijlstra > CommitterDate: Fri, 19 May 2023 12:35:10 +02:00 >=20 > bcache: Convert to lock_cmp_fn >=20 > Replace one of bcache's lockdep_set_novalidate_class() usage with the > newly introduced custom lock nesting annotation. >=20 > [peterz: changelog] > Signed-off-by: Kent Overstreet > Signed-off-by: Peter Zijlstra (Intel) > Acked-by: Coly Li > Can the above =E2=80=9C=E2=80=9D be removed from = my acked-by. This was automatically and invisibly added by MacOS email = client, which just introduced chaos in such use case. Thanks. Coly Li > Link: = https://lkml.kernel.org/r/20230509195847.1745548-2-kent.overstreet@linux.d= ev > --- > drivers/md/bcache/btree.c | 23 ++++++++++++++++++++++- > drivers/md/bcache/btree.h | 4 ++-- > 2 files changed, 24 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/md/bcache/btree.c b/drivers/md/bcache/btree.c > index 147c493..569f489 100644 > --- a/drivers/md/bcache/btree.c > +++ b/drivers/md/bcache/btree.c > @@ -559,6 +559,27 @@ static void mca_data_alloc(struct btree *b, = struct bkey *k, gfp_t gfp) > } > } >=20 > +#define cmp_int(l, r) ((l > r) - (l < r)) > + > +#ifdef CONFIG_PROVE_LOCKING > +static int btree_lock_cmp_fn(const struct lockdep_map *_a, > + const struct lockdep_map *_b) > +{ > + const struct btree *a =3D container_of(_a, struct btree, = lock.dep_map); > + const struct btree *b =3D container_of(_b, struct btree, = lock.dep_map); > + > + return -cmp_int(a->level, b->level) ?: bkey_cmp(&a->key, &b->key); > +} > + > +static void btree_lock_print_fn(const struct lockdep_map *map) > +{ > + const struct btree *b =3D container_of(map, struct btree, = lock.dep_map); > + > + printk(KERN_CONT " l=3D%u %llu:%llu", b->level, > + KEY_INODE(&b->key), KEY_OFFSET(&b->key)); > +} > +#endif > + > static struct btree *mca_bucket_alloc(struct cache_set *c, > struct bkey *k, gfp_t gfp) > { > @@ -572,7 +593,7 @@ static struct btree *mca_bucket_alloc(struct = cache_set *c, > return NULL; >=20 > init_rwsem(&b->lock); > - lockdep_set_novalidate_class(&b->lock); > + lock_set_cmp_fn(&b->lock, btree_lock_cmp_fn, btree_lock_print_fn); > mutex_init(&b->write_lock); > lockdep_set_novalidate_class(&b->write_lock); > INIT_LIST_HEAD(&b->list); > diff --git a/drivers/md/bcache/btree.h b/drivers/md/bcache/btree.h > index 1b5fdbc..17b1d20 100644 > --- a/drivers/md/bcache/btree.h > +++ b/drivers/md/bcache/btree.h > @@ -247,8 +247,8 @@ static inline void bch_btree_op_init(struct = btree_op *op, int write_lock_level) >=20 > static inline void rw_lock(bool w, struct btree *b, int level) > { > - w ? down_write_nested(&b->lock, level + 1) > - : down_read_nested(&b->lock, level + 1); > + w ? down_write(&b->lock) > + : down_read(&b->lock); > if (w) > b->seq++; > }