Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F1605C636D4 for ; Mon, 13 Feb 2023 16:37:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231182AbjBMQhG (ORCPT ); Mon, 13 Feb 2023 11:37:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229750AbjBMQhE (ORCPT ); Mon, 13 Feb 2023 11:37:04 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 370D82108; Mon, 13 Feb 2023 08:37:03 -0800 (PST) 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=qaz/DPwIkRVLhrYLsc81DKWYTQXENIiXxkrqrvuHtg4=; b=NjQjZ37eclcCD+ro3kgbRGKjhV y8ciGCLv6NIFLpxz6eE010Omh9moxl2JhPzO2hnWajga7tWaXR6oL+fPK0S7TMYh75frnm+vBFWeJ +Y4B6wJgWjv9CVwTSeYHuJ7fXfriyllZwNg9lou63vWTsUZ2s8yydOx8e8c00eLkYHaMCTTDCIpSr DRgDI6dJH14rgimA0VcRnutYwXZeNEazJxQt+Tu8FrhEx+SOfQK8lRIo3lJSAXZYUfgkDsmpAqg3k iHvygWPGiHnHkVk/rXVR9pEVOxjU4A5ZhVxebrd5W6It49z2YqD4LnVwCsAwHWdpix+OwOHFRuuMA +/xoFtWw==; 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 1pRbos-005vWt-0l; Mon, 13 Feb 2023 16:36:46 +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)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 7595C300033; Mon, 13 Feb 2023 17:36:45 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 54F262012B92E; Mon, 13 Feb 2023 17:36:45 +0100 (CET) Date: Mon, 13 Feb 2023 17:36:45 +0100 From: Peter Zijlstra To: Alan Stern Cc: Kent Overstreet , Kent Overstreet , Linus Torvalds , Coly Li , Tetsuo Handa , syzkaller , Dmitry Vyukov , Greg Kroah-Hartman , "Rafael J. Wysocki" , Ingo Molnar , Boqun Feng , LKML , USB list , Hillf Danton Subject: Re: [PATCH RFC] drivers/core: Replace lockdep_set_novalidate_class() with unique class keys Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 13, 2023 at 10:28:08AM -0500, Alan Stern wrote: > On Mon, Feb 13, 2023 at 10:27:18AM +0100, Peter Zijlstra wrote: > > On Sun, Feb 12, 2023 at 03:19:16PM -0500, Alan Stern wrote: > > > > > (Device names are often set after the device is initialized. Does > > > lockdep mind if a lock_class_key's name is changed after it has been > > > registered?) > > > > It does, althought I don't at the moment recall how hard it would be to > > change that. > > If the names are only used for printing purposes, or other similarly > innocuous things, it ought to be enough to set the name with > smp_store_release() and read the name with smp_load_acquire(). The name is copied from the key to the 'class' upon registration of the first lock that uses a particular key. Then later, when looking up the class for subsequent usages of the same key, the string is checked, and WARNs if they somehow not match. Granted, this is a silly sanity check that's easily disabled. But from a cursory look that seems to be just about it. The only 'problem' is that it's (typically) class name that's printed, not the key name, so if you change the key name, without also changing the class name, reports get really confusing. Still, that all ought to be fixable.. just a matter of typing or so :-)