Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp533548imn; Wed, 3 Aug 2022 14:31:18 -0700 (PDT) X-Google-Smtp-Source: AA6agR60Yt8KGUR0k7EtBrWg9RbzhuQ1ckoHratvRjM9EZGWMCpC0rbDxqxmpPivVhw8exnJoKRl X-Received: by 2002:a63:64c6:0:b0:41c:45eb:aab9 with SMTP id y189-20020a6364c6000000b0041c45ebaab9mr8956828pgb.498.1659562278162; Wed, 03 Aug 2022 14:31:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659562278; cv=none; d=google.com; s=arc-20160816; b=N2nwuNk8RJHFWlR4tu9K9Syg7Pqd5b02pwdnzUiDmMtYO8KnBomIjqA9WJ2xua88zn 5CbTt/RFjQuH2m838N3kkd3GbArHvUXMlRUhCYlX1i/VaYNCOp8hzS0lKC0WIIw9DB+b xB6/LZ64NtsjFr+DWCMoYSTQRi0jI0GPDz76TjIY8X22op+ctNNVqcIskJGYLF/9oS14 xjD2yeBjv3Ox2r/36hI/UzXfnCVb2KmRP2KyHuo2DOklcBmYFrbVnfbQL2YrMrZgs4Dn EaMc5AFdkADEFwqt809LR3+r1q+rsMvhW6w1y9e3MGDgVi6EbdEcSgBLrnJCsKoUvFKf uONA== 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:feedback-id :dkim-signature; bh=AA/axCT0z1EqYosf4XmzpaZPolRTikd9DE7PS6rJ/Qk=; b=u0nlaZvBoybK/P8HVp3Kr6YzmJyhvWKob7LNjhDa4GS+6oa36Jzbdv9K/28KCca52s imqD3dk5McCGfRqaGsgkzDErho3hXAbG+9X2iO9MDQ8kAQNBhV0GoM6pC27ugiqlR9QK yPLFaC8mJzek95cJ/GEyW+2eRi5N3Kd/zA4JANoTFQmnEEFg49aXB/u0TpeagIAIZRud O0OAOqqdwsJxu/TQWhPWLiS8/b+orvUJA8lFPU+gVXoz0TDzjQPLS2reZ05DFSu24G9h 4DIYyyecVnHDeEfTyfFfEy1YGzJ/OAnhMw6uHDFEkqq45MRG9X1mvR2M1rZf5UNvxbAy iewQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=PLVfpmbw; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ot5-20020a17090b3b4500b001f4eed1e26csi3213520pjb.89.2022.08.03.14.31.03; Wed, 03 Aug 2022 14:31:18 -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=@gmail.com header.s=20210112 header.b=PLVfpmbw; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238661AbiHCVAJ (ORCPT + 99 others); Wed, 3 Aug 2022 17:00:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238367AbiHCVAH (ORCPT ); Wed, 3 Aug 2022 17:00:07 -0400 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4613E1FCF9; Wed, 3 Aug 2022 14:00:06 -0700 (PDT) Received: by mail-qv1-xf30.google.com with SMTP id d1so12291622qvs.0; Wed, 03 Aug 2022 14:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=feedback-id:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AA/axCT0z1EqYosf4XmzpaZPolRTikd9DE7PS6rJ/Qk=; b=PLVfpmbw7CZdYz1mtj5UaC4qGYu1PsISy37tdeIrmtQPJQgT4eonxtfjbnImvY+FSa 2HXTIGEIIvMdLZvZih1lluyJfq+a0aFcsIfA675glquZB6U/hWeQ3kHX38jAooxl1ktV wtacNTge2Hao18uAsho5f8S1O1yNaHuZvyMclnf3M6Ctc8mkEk7ftTkF4nVhTmc67Ag/ ZSv2ShLvoz/P4LGuo3O1Qu8+WdP7uko1g4L8FaiPs1feuU8srqZZStSFL5kFMwfHPqoP 32eDFsZA5Wqrep3oJQR42ZsmX/bu/ZymQ+bHb5q2JYbmeSkz5GfHiFFJdlZ+U+dFp5Xy NZBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:feedback-id:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=AA/axCT0z1EqYosf4XmzpaZPolRTikd9DE7PS6rJ/Qk=; b=g1VUP0a+mBB4ye0+v5qiK1Foakyf8uzGuMVOsPjgLRzl3AEqbhHOqvpxkHLGfT+KPo 5ZbUmI+O5TSvx42V0kzGMne46A8dVBxs/z7Xj4vvRS4LhkopES0rXg4/Hdxkk5Km610v khTcxDJA9IaQw3YZgWZTHIkOyfWfpszI7iR3q7oUlXVY87AM8nenixlOIJgVQzYNuvsZ uoFJFYFMc2tUUo31WaOm7zboGO+0vZ1EqhcRGiLK51JpkuNqBIGiaAXliMcHKTpoookJ /tkM3W4CWBxvOcYoBfTqNkkZrPP6NlUxcYKdi7uO9YZD7CvFGUp0/AIK2aj2Fq56a0UD qsDg== X-Gm-Message-State: ACgBeo2tbIDOT9HpQuBnqgkxs8mJRbsGYQXa766Ejhj6k3bz19JY6J4m 91zO4LqNZceDh858k+Y64hve2F17S+Q= X-Received: by 2002:a05:6214:c8b:b0:474:5279:4f7d with SMTP id r11-20020a0562140c8b00b0047452794f7dmr23104741qvr.33.1659560405383; Wed, 03 Aug 2022 14:00:05 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id i21-20020a05620a405500b006b5f371a19esm14558715qko.111.2022.08.03.14.00.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Aug 2022 14:00:04 -0700 (PDT) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailauth.nyi.internal (Postfix) with ESMTP id BCD5F27C005B; Wed, 3 Aug 2022 17:00:03 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 03 Aug 2022 17:00:03 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvddvjedgudehiecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeeuohhq uhhnucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrf grthhtvghrnhephedugfduffffteeutddvheeuveelvdfhleelieevtdeguefhgeeuveei udffiedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epsghoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedt ieegqddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfh higihmvgdrnhgrmhgv X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 3 Aug 2022 17:00:02 -0400 (EDT) Date: Wed, 3 Aug 2022 13:58:58 -0700 From: Boqun Feng To: Miguel Ojeda Cc: Linus Torvalds , Greg Kroah-Hartman , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, Jarkko Sakkinen , Wedson Almeida Filho , Alex Gaynor , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long Subject: Re: [PATCH v8 07/31] locking/spinlock: introduce `__spin_lock_init` Message-ID: References: <20220802015052.10452-1-ojeda@kernel.org> <20220802015052.10452-8-ojeda@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220802015052.10452-8-ojeda@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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, Aug 02, 2022 at 03:49:54AM +0200, Miguel Ojeda wrote: > From: Wedson Almeida Filho > > A Rust helper (introduced in a later patch) needs to call > `spin_lock_init` with a passed key, rather than define > one in place. > > In order to do that, this changes the `spin_lock_init` macro > to call a new `__spin_lock_init` function which takes the key > as an extra parameter. > > Co-developed-by: Alex Gaynor > Signed-off-by: Alex Gaynor > Signed-off-by: Wedson Almeida Filho > Co-developed-by: Miguel Ojeda > Signed-off-by: Miguel Ojeda Acked-by: Boqun Feng Peter, Will & Waiman, could you take a look at this patch and patch #8? These two are needed because currently there is no way to convert a C macro to a Rust macro, a C macro can be called as a function on Rust side, but that's not quite for generating a static key of lockdep. As a result, __spin_lock_init() needs to be exposed. I think these are tiny and harmless, but looking forwards to your insight ;-) Regards, Boqun > --- > include/linux/spinlock.h | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h > index 5c0c5174155d..ad1c91884ed8 100644 > --- a/include/linux/spinlock.h > +++ b/include/linux/spinlock.h > @@ -326,12 +326,17 @@ static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) > > #ifdef CONFIG_DEBUG_SPINLOCK > > +static inline void __spin_lock_init(spinlock_t *lock, const char *name, > + struct lock_class_key *key) > +{ > + __raw_spin_lock_init(spinlock_check(lock), name, key, LD_WAIT_CONFIG); > +} > + > # define spin_lock_init(lock) \ > do { \ > static struct lock_class_key __key; \ > \ > - __raw_spin_lock_init(spinlock_check(lock), \ > - #lock, &__key, LD_WAIT_CONFIG); \ > + __spin_lock_init(lock, #lock, &__key); \ > } while (0) > > #else > -- > 2.37.1 > >