Message ID | 20230330043954.562237-4-wedsonaf@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp879104vqo; Wed, 29 Mar 2023 22:04:59 -0700 (PDT) X-Google-Smtp-Source: AKy350aBEnHVwK8fh7JQzOMw54AwrDqEb7AnMBU4GMcRoAIMTvj15/CXZzUalXhDlasPfpwcsolk X-Received: by 2002:a17:906:1e13:b0:92f:e40d:1489 with SMTP id g19-20020a1709061e1300b0092fe40d1489mr25296788ejj.61.1680152699429; Wed, 29 Mar 2023 22:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680152699; cv=none; d=google.com; s=arc-20160816; b=GTBzJ/jrHWq6/Dn+CLayj8IgXpjQ+6Irqmx1KUmoYnCb1dADmmR6AIBRhc0tYpCj8a 0Q6+x5E/96VO9iiJLEiyXDyftKXvHCz3wsFxixut4sY3fPAi0onalY6AGEmT5o7BnyLF bxoTQ6xyKfmm8dv2oonuSfjiNWX2orQLlAnq9H3+3h1Xfo1CCt1EGxW9DbMqb0/BxYEA C+sUk7fKQPKmNahOiUZTH0brFDqxv807AOjP9+we64+ionk6m8K2lnG1Aqs5nT4JRocn lIWzNQru0k3f2385FARihlNY47xENfi57fRgBnEluqSkHQlm6UxosZk3ox/pS8WmTgB5 Y11Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LkdOS4IPS6lAQ/+/R/HSZz8UmvvCCFlzt5mrQlViXVE=; b=wLVV/CUVr2xAMWUOKtLXysRr5VSy2W+DsVidm24F9+JTRUoXGaHYpFkBbpexQWA4Cb A7VApNRUgq0km4X1M012nfqbP1f4xLUmF/8oXEOQ7YSMRIhUXbl1ixGI9XV1pCXabKXh CmGPwLxy8rOEi7x4gVPo5GjFpkRmY/IGGA6VsWn1CDNg+0rycJrrZILh/q1mgFGh+UfH G5q7WDY8GImnYe+2KHi2vPtZzzqSzgr0PYZnKATdNFRfJ9GqWZYV6Xhl8IxBZ+8YRTXG vYnj1oWG3JfULd2iiq5pzF6ErYWLTxVqL00CNWNdiglElnfu076J3wicQAcRULpkD4Bp Dm1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="Ad+K/21H"; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u17-20020a1709064ad100b0093c09a76ac9si17663986ejt.481.2023.03.29.22.04.35; Wed, 29 Mar 2023 22:04:59 -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="Ad+K/21H"; 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 S229932AbjC3ElY (ORCPT <rfc822;rua109.linux@gmail.com> + 99 others); Thu, 30 Mar 2023 00:41:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35756 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbjC3ElG (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 30 Mar 2023 00:41:06 -0400 Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CB9F55BF; Wed, 29 Mar 2023 21:41:00 -0700 (PDT) Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-17786581fe1so18528617fac.10; Wed, 29 Mar 2023 21:41:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680151259; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=LkdOS4IPS6lAQ/+/R/HSZz8UmvvCCFlzt5mrQlViXVE=; b=Ad+K/21HHHCmG+2LPPxPPbenT+S7mRF6t2x5naSZR5mN4ZY1Dfbmty4mIKdSUorQ6B 4Lypn5IuRidd1Yt/9Znw1lk52fLWKw24w6uFA57h5pqqOltAD4/DCJBzH9QBMiln7ZNg Si/xtk0Z/DxYhzavwXU6THjgtbrqrdlOArErbhS03WXthgfqVQRbiv2dqDKGfgUiFyon CH3nY9Bqhx5h5KJEjQ9Nnc6PnCxd9CojFBGTgv5TV4bGhkR1FQtnwZ+9XX7jfl1f3EPb dNqb67hhHjfgY5Dpa1D3CMTlYg8RYDWo8zNe8prw7KuAidz5xsX67zz2cmHFqmXceCa0 34hQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680151259; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=LkdOS4IPS6lAQ/+/R/HSZz8UmvvCCFlzt5mrQlViXVE=; b=Hr5dIAw5TJavasCdlg/ZPqXzqBAq/rxmXtp3Hz79R0DxTYy2NYoGnPmiVNtJorZ2g8 17vhwPQjvNftJIk9JHEslvHafVyteJ5VAOjFJABH6fyOgvfa8IVnA6chfyMzGkw6YPfW /5AycIaH7c5UnIRqTNGuczeYLw6wGlvpehnNH6009bbJcHyCbOIW2KLVyb04U7PO9jhq LntUCOYTInTYUr9m4a0lwxbzHN+KPcBhgDcEq6uyt2/X0+Jopf5LQBHEOHUQmqpSmvWh NZT6pR6pgmIV36rEs/JrTkM8xtL4KHA2lNXAkVmpWq3UrXe+szJxlnegGwP/n0B6Qfts jREg== X-Gm-Message-State: AO0yUKXngqOoOvH2WpdtdXI29mOBCVDqGcgvxX326cDUnPLwz4JEzz2m ePd9cAstGg/68qUQQ/cE8orct3uURqWnSw== X-Received: by 2002:a05:6870:b006:b0:17a:d2e0:1a14 with SMTP id y6-20020a056870b00600b0017ad2e01a14mr13809272oae.27.1680151259564; Wed, 29 Mar 2023 21:40:59 -0700 (PDT) Received: from wedsonaf-dev.home.lan ([189.124.190.154]) by smtp.googlemail.com with ESMTPSA id ea43-20020a056870072b00b0017e0c13b29asm7518599oab.36.2023.03.29.21.40.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Mar 2023 21:40:59 -0700 (PDT) From: Wedson Almeida Filho <wedsonaf@gmail.com> To: rust-for-linux@vger.kernel.org Cc: Miguel Ojeda <ojeda@kernel.org>, Alex Gaynor <alex.gaynor@gmail.com>, Boqun Feng <boqun.feng@gmail.com>, Gary Guo <gary@garyguo.net>, =?utf-8?q?B?= =?utf-8?q?j=C3=B6rn_Roy_Baron?= <bjorn3_gh@protonmail.com>, linux-kernel@vger.kernel.org, Wedson Almeida Filho <walmeida@microsoft.com>, Peter Zijlstra <peterz@infradead.org>, Ingo Molnar <mingo@redhat.com>, Will Deacon <will@kernel.org>, Waiman Long <longman@redhat.com> Subject: [PATCH 04/13] locking/spinlock: introduce spin_lock_init_with_key Date: Thu, 30 Mar 2023 01:39:45 -0300 Message-Id: <20230330043954.562237-4-wedsonaf@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230330043954.562237-1-wedsonaf@gmail.com> References: <20230330043954.562237-1-wedsonaf@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761767797079553160?= X-GMAIL-MSGID: =?utf-8?q?1761767797079553160?= |
Series |
[01/13] rust: sync: introduce `LockClassKey`
|
|
Commit Message
Wedson Almeida Filho
March 30, 2023, 4:39 a.m. UTC
From: Wedson Almeida Filho <walmeida@microsoft.com> 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 <peterz@infradead.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Will Deacon <will@kernel.org> Cc: Waiman Long <longman@redhat.com> Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com> --- 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) #else