Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7013762rwr; Wed, 10 May 2023 02:35:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7qYmDc16kgrlkuaeqnKoU8UU80Mxq7OshvHOkl9I4E9TL0sXkJpe6uGzzLC7dVPySmJUAf X-Received: by 2002:a17:90a:4801:b0:23d:16d6:2f05 with SMTP id a1-20020a17090a480100b0023d16d62f05mr16789656pjh.22.1683711311583; Wed, 10 May 2023 02:35:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683711311; cv=none; d=google.com; s=arc-20160816; b=EqPgFyHNo3jBXOejIV2K0TCtLIvfoQbYulQuAaDTL4ZJnyLbn8C4GhvzSm4ZeXyjai V71LQpy9b2COwOZLeZz3AkF4HtWlnzP/FpR5ieN3SM03W/K9oZEQqvWJKj3grn4bDVHF Hs4Cs69YavpB1ZItoxaiOqugxtUctMMQcsdTZ0+p93xH5KpZEmum6hiluZ5kFbHXHRr3 EnmGBowxu64gJUGlq1oJS8dGTcUyndglAATucAj0BNaKtynU0LnUkZ5++6WIGUBW093M r1ktLHQnihSuWXLIr+vpynakdQA3qYLtdAqooVqSHK+JhT7xSlAzTNg+jVxbmdKk1s5G f4Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BhBQbjRKMcpCMdX8A1QJANySCjXl12HK+zd5Mpx2Tvo=; b=Dofjlqo0YeqXZsw5BXdUooIuf6odxEzB0gFP3E/pXPoMceCFe2jV2KHS11YKp8R/il IpTthJT1Iwln7WBAHF02kXHovNVoyVx4eRZYFhq147/NRDzfAZREjHPFt2WFHJe1YN8p GQ8mzonqi3kOVMK8y9tG6JwwHHpp37LxwN0UwDBt26pTJNPOiBAaSx0lPUV3UtGWuvUO u8eydi/4RXuZj3BDMPHnwQZ2RYMwuZZ9tCglVaGOonT5g0a15IAYZSBWxoREg1n293yh ijtr5IH2r4v+U9OZHq/LqCZb0A2+ud6wFPa6flVcdXTp3zxu2k8bcv5bQs59foiD7FwE x0iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=dJs4fKGr; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg2-20020a17090b1e0200b00246b7a596eesi18981120pjb.146.2023.05.10.02.34.57; Wed, 10 May 2023 02:35:11 -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=@infradead.org header.s=casper.20170209 header.b=dJs4fKGr; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236914AbjEJI7a (ORCPT + 99 others); Wed, 10 May 2023 04:59:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236916AbjEJI7U (ORCPT ); Wed, 10 May 2023 04:59:20 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98E6135A2; Wed, 10 May 2023 01:59:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=BhBQbjRKMcpCMdX8A1QJANySCjXl12HK+zd5Mpx2Tvo=; b=dJs4fKGrzLv01UXL5cO86flVF9 c84zgMulooq9vdrMaGWri7wll0LaMC+DYX4KhgUNFbe1fgc2ulDHhwwNziKGiTR846La/yUmNigTK wrY+Q49vwfovYHH+IhfClYrqAV4erbJO6GptxQMhz7Nbvidv5m64eivySEVkOXr/b3MBX/u6lHjJl PdQyDpisULA2PC3WUNMEH1nUiwMFCSyuzLluA8RnEUoLM3v8sM8QkjU/Jygmtagd0zFPpHHeMDXlt aYmncabcz8UNKcNkezJ9a1Si/ZLjXctfrGxR4pKXRWaG7cw891Sd/j9fUE4ZKj92OZLbHJrRbbt3H eorLXYWw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1pwff8-00G7gt-Iw; Wed, 10 May 2023 08:59:06 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 54929300338; Wed, 10 May 2023 10:59:05 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 3B39320B04BA9; Wed, 10 May 2023 10:59:05 +0200 (CEST) Date: Wed, 10 May 2023 10:59:05 +0200 From: Peter Zijlstra To: Kent Overstreet Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-bcachefs@vger.kernel.org, Ingo Molnar , Will Deacon , Waiman Long , Boqun Feng Subject: Re: [PATCH 03/32] locking/lockdep: lockdep_set_no_check_recursion() Message-ID: <20230510085905.GJ4253@hirez.programming.kicks-ass.net> References: <20230509165657.1735798-1-kent.overstreet@linux.dev> <20230509165657.1735798-4-kent.overstreet@linux.dev> <20230509193147.GC2148518@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Tue, May 09, 2023 at 04:18:59PM -0400, Kent Overstreet wrote: > On Tue, May 09, 2023 at 09:31:47PM +0200, Peter Zijlstra wrote: > > On Tue, May 09, 2023 at 12:56:28PM -0400, Kent Overstreet wrote: > > > This adds a method to tell lockdep not to check lock ordering within a > > > lock class - but to still check lock ordering w.r.t. other lock types. > > > > > > This is for bcachefs, where for btree node locks we have our own > > > deadlock avoidance strategy w.r.t. other btree node locks (cycle > > > detection), but we still want lockdep to check lock ordering w.r.t. > > > other lock types. > > > > > > > ISTR you had a much nicer version of this where you gave a custom order > > function -- what happend to that? > > Actually, I spoke too soon; this patch and the other series with the > comparison function solve different problems. > > For bcachefs btree node locks, we don't have a defined lock ordering at > all - we do full runtime cycle detection, so we don't want lockdep > checking for self deadlock because we're handling that but we _do_ want > lockdep checking lock ordering of btree node locks w.r.t. other locks in > the system. Have you read the ww_mutex code? If not, please do so, it does similar things. The way it gets around the self-nesting check is by using the nest_lock annotation, the acquire context itself also has a dep_map for this purpose.