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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0F2D4C7619A for ; Wed, 12 Apr 2023 19:14:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229753AbjDLTOw (ORCPT ); Wed, 12 Apr 2023 15:14:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229733AbjDLTOu (ORCPT ); Wed, 12 Apr 2023 15:14:50 -0400 Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E2E55FCF; Wed, 12 Apr 2023 12:14:49 -0700 (PDT) Received: by mail-qt1-x831.google.com with SMTP id fv6so293518qtb.9; Wed, 12 Apr 2023 12:14:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681326888; x=1683918888; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=sWnu6RVyhi4uzC7Ry2QjeXJ1CWSfmQfPfbgbdIGcaFA=; b=kh5JKCDo9SPvWTnKK2hPJ25n8o1kiO7ZCmp7IglmcT9z29vxB/VwDDRKYAF7rsAbFz d1ttDHBhehAPT1cY8kSR4csY5PpIfm/42SgmXtzDSFAN0TfyxSgGAdHFRHuMczL2qucH K4QAEbRyX6DOLUQdINZFf9tOcYVnxAsR3nAfpinH599MSXcqvW2bLHW62Tv/K87WOCer 1n+2LDs/RP34oOlmw0zBLgPECiubajQqlZn6SlnYSZ2Ol0sSECCW0dPxRZttlsF+QNTG R6vHl7hfZOqzBHkeIsNjlfqnVcDLVQz04whuospxr3uTz5oUblOXtiv0GPYmouPhnvuq yu5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681326888; x=1683918888; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sWnu6RVyhi4uzC7Ry2QjeXJ1CWSfmQfPfbgbdIGcaFA=; b=exlerfFlGdwdAon3vXIgkjP7MtuBRN+YCL3r+eVGj/BKLoWkN1wZAyRti+MjQGkN/c 0davhkmpA2AosHM2zAbhsUlbcmOycwI+vRKFmHfczAhl+yoKn3kiBBUjO7cG6purvLPR aYK+BfKacT/GYkyTwl1l5rR7RgpirAoEzRtKDy3w9eQlDH9F/NhPKVfFijKYMO+oshCv Yd4y0gHsiIJ+EjutEkutRRVmHH6YIdKH0Zmn8vCGxo9qjaMDHggaUvWv5E8WtzuidInj bh6UagGOFGqe4t3gn8KRivFRQ0jJEFMnQnUZYt+S6CKjeeL80r028tBTDYgw0tIEWrec dJ7Q== X-Gm-Message-State: AAQBX9dtOwuHHVhSmIoD9/nvSHm5nYZkfaNTGvB4OMSUyov0yZgGeUUI d/9ksieU5xsMTLsVRnnudBTsWeSkZP0= X-Google-Smtp-Source: AKy350ZVLQ44IG1f4rg4LVxAu2yzZPrUV+qRRm01OWAVrErTfgleOHgyvR3VdeBTIueBQA508uxBWA== X-Received: by 2002:a05:622a:88:b0:3e8:8f:3140 with SMTP id o8-20020a05622a008800b003e8008f3140mr7799511qtw.24.1681326888132; Wed, 12 Apr 2023 12:14:48 -0700 (PDT) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id o5-20020ac872c5000000b003c033b23a9asm4398905qtp.12.2023.04.12.12.14.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 12:14:47 -0700 (PDT) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailauth.nyi.internal (Postfix) with ESMTP id C673F27C0054; Wed, 12 Apr 2023 15:14:46 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Wed, 12 Apr 2023 15:14:46 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvdekiedgudefjecutefuodetggdotefrod 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, 12 Apr 2023 15:14:46 -0400 (EDT) Date: Wed, 12 Apr 2023 12:14:44 -0700 From: Boqun Feng To: Wedson Almeida Filho Cc: Peter Zijlstra , Miguel Ojeda , Alex Gaynor , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , linux-kernel@vger.kernel.org, Wedson Almeida Filho , Ingo Molnar , Will Deacon , Waiman Long , Martin Rodriguez Reboredo , rust-for-linux@vger.kernel.org Subject: Re: [PATCH v4 04/13] locking/spinlock: introduce spin_lock_init_with_key Message-ID: References: <20230411054543.21278-1-wedsonaf@gmail.com> <20230411054543.21278-4-wedsonaf@gmail.com> 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 Tue, Apr 11, 2023 at 03:05:07PM -0300, Wedson Almeida Filho wrote: > On Tue, 11 Apr 2023 at 02:46, Wedson Almeida Filho wrote: > > > > From: Wedson Almeida Filho > > > > Rust cannot call C macros, so it has its own macro to create a new lock > > class when a spin lock is initialised. This new function allows Rust > > code to pass the lock class it generates to the C implementation. > > > > Cc: Peter Zijlstra > > Cc: Ingo Molnar > > Cc: Will Deacon > > Cc: Waiman Long > > Reviewed-by: Martin Rodriguez Reboredo > > Signed-off-by: Wedson Almeida Filho Reviewed-by: Boqun Feng > > --- > > v1 -> v2: No changes > > v2 -> v3: No changes > > v3 -> v4: No changes > > > > 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 be48f1cb1878..cdc92d095133 100644 > > --- a/include/linux/spinlock.h > > +++ b/include/linux/spinlock.h > > @@ -327,12 +327,17 @@ static __always_inline raw_spinlock_t *spinlock_check(spinlock_t *lock) > > > > #ifdef CONFIG_DEBUG_SPINLOCK > > > > +static inline void spin_lock_init_with_key(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_with_key(lock, #lock, &__key); \ > > } while (0) > > Peter, the code above is just factoring out spin lock init when > lockdep is enabled to take a lock class key. > > Would you be able to review it? > > If it's ok with you, we'd like to carry it through the rust tree > because we have code that depends on it. Same ask here ;-) Peter, do you think it's Ok to take it via rust tree? Thanks! Regards, Boqun > > Thanks, > -Wedson > > > > > #else > > -- > > 2.34.1 > >