Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3192444rwl; Sun, 9 Apr 2023 09:49:39 -0700 (PDT) X-Google-Smtp-Source: AKy350aGA3b6d24mYzMMTumpd0ZkmZrnCmklKR0MY7ECcPqe8GUUoVTtlJnM2ThMyC1Sda8pfgMv X-Received: by 2002:a50:ff03:0:b0:502:52dc:b9d0 with SMTP id a3-20020a50ff03000000b0050252dcb9d0mr7123250edu.26.1681058978874; Sun, 09 Apr 2023 09:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681058978; cv=none; d=google.com; s=arc-20160816; b=0er78y482j43pv/+DCDVTkkuQ71YCuO88He3mzFcJv5v7FezHjtxeH5Hkx6T3hNhLJ DFFfLNFMbzv2Ljjg5mfV3WfE0Np9uP2Y7HtY0WE87/t7W9+2iTiO/c/QS7ncgjGci5n5 yyAbniYYys3a7YjvLycMC9WwhjkXUK4YMbuI5dvCc8m1AKJmSGA2/gBrD+yjkR6TP6R6 chKD0ljxk+9R8ifX/dDscXSMyXkT+gmxts+C3a+TwwCr1krAEEvRhxlbx/HDMs+lJ8ln jWgOp3xDGUTDwknEtOkCjC9lKzarVZgQkkyetDOP/tv9SgiQnZuoI2tVFosqmqpR5B0u M6MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id:dkim-signature; bh=hr7IpqkVVvaH5bCublyFVgApREgtsWPOkPRTPgJ+F6M=; b=PgTEU9lmjTgmRotzomHtBOlxSRpLmZ6xhwmVbhCwlowbARPwCF67TktlPMCbnmfPze vl64pKAKEOGzf1riqltBBjTVxavCaK16UXhbmkRpgRNXwPjwvBEMjmk2uwIn91bGsfgB IdBA8Nta9braWqI2SKbapyX0pUpFP4Aj94Lu5+y8G7QnLkRVM9tTJjzF62EzQRa26FUO vNB6op9xN7GdtVf6YEw0x53igyg9vgEDEcbX+uSvCrec1Gxnn/xj+oQp+RARDCUd2oU0 /kKHoUDoc4Q0pb0oqChYqX24ihDiMlDKHDcbfIu56klm/UE4uA36m+gwPafTdY7lsh17 CDqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=I9abLB1P; 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 qa43-20020a17090786ab00b0094a6d9f31e0si2043617ejc.840.2023.04.09.09.49.14; Sun, 09 Apr 2023 09:49:38 -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=I9abLB1P; 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 S229573AbjDIQsM (ORCPT + 99 others); Sun, 9 Apr 2023 12:48:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229485AbjDIQsL (ORCPT ); Sun, 9 Apr 2023 12:48:11 -0400 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8568D3C39; Sun, 9 Apr 2023 09:48:01 -0700 (PDT) Received: by mail-ot1-x32b.google.com with SMTP id w15-20020a056830410f00b006a386a0568dso8793234ott.4; Sun, 09 Apr 2023 09:48:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1681058881; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=hr7IpqkVVvaH5bCublyFVgApREgtsWPOkPRTPgJ+F6M=; b=I9abLB1PvolfWqqE8UtbrJ/PP/3MdCP0zMlH1Yr0fFq7V2xIONDjn2GpJfrVcYt1Vt pXtX4dYEx6tgfvlEIdnsvCLoFKfEXCpAJopTgCQhM7ps6m/PRMx7vwG3qMUn0Gp+b3Mr gfF2O8J14VjwLL+zmtWOFma18SL9M5Nulzy605iQl3wS4HEIxQb4QxOEmhsfgP5RWCHb atIwaBA2ZAX99W/ni/enn0fz/Eqi6qbmgFR8jKWBzY6IJWavQcDzC/jRGtU3TqqiH8Cu MvDI4C6dI0KdPL8wvioJ812L0/yi4gKQLgiDmOLPi68iAeCObBNoZuH6W1vHVD1kLM4Q C+Mw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681058881; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hr7IpqkVVvaH5bCublyFVgApREgtsWPOkPRTPgJ+F6M=; b=CKesR1/iErh3UqvscfMFuIB53xGMJNxDVhPbNL3UjBNBR1fQUZt3lAkxmg4T5OH2yj W2A/eAOe5Wa80WYEV+GzMpfUsNqTXCGXeowaRVUEnOXAdV8TaRJ/TZGpAEi2R7lUuebw GeC/rRnaIrk9CBL2NfYiS/IPoKBNA4btLvLmGvmYfgNm1JPHRCeE36W6raXi5qzNubDg J2JmZ/Kri7lYa3LLYwI9YwaQLMqIEDdj0P1xDtsp/XYnnVkU8LvJyeA5ZBiInDHh7zHe gqosLYC69wBs6KqGXkn0Hm7IRsikqkScorXWwMQm5CC1yq95f6FfpgLfx3HqXo8/UvkZ yEWw== X-Gm-Message-State: AAQBX9fbtb+TchZsfjToREq1Ckamj8PAOVejgSoOKLXZ3IvXyf7dGQ+t D8W3ig4w+/e/bTbv6x7MwBUmXfrV1Ow= X-Received: by 2002:a9d:6d01:0:b0:6a3:e0bc:86a9 with SMTP id o1-20020a9d6d01000000b006a3e0bc86a9mr2102900otp.33.1681058880873; Sun, 09 Apr 2023 09:48:00 -0700 (PDT) Received: from [192.168.54.90] (static.220.238.itcsa.net. [190.15.220.238]) by smtp.gmail.com with ESMTPSA id z22-20020a05683010d600b006a119c75ad8sm3503780oto.55.2023.04.09.09.47.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 Apr 2023 09:48:00 -0700 (PDT) Message-ID: <5956fa17-027a-e5fc-5fcf-f80a1544eac6@gmail.com> Date: Sun, 9 Apr 2023 13:47:56 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.1 From: Martin Rodriguez Reboredo Subject: Re: [PATCH v3 04/13] locking/spinlock: introduce spin_lock_init_with_key To: Wedson Almeida Filho , rust-for-linux@vger.kernel.org Cc: Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=c3=b6rn_Roy_Baron?= , linux-kernel@vger.kernel.org, Wedson Almeida Filho , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long References: <20230408075340.25237-1-wedsonaf@gmail.com> <20230408075340.25237-4-wedsonaf@gmail.com> Content-Language: en-US In-Reply-To: <20230408075340.25237-4-wedsonaf@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, 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: X-Mailing-List: linux-kernel@vger.kernel.org On 4/8/23 04:53, 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 > Signed-off-by: Wedson Almeida Filho > --- > v1 -> v2: No changes > v2 -> v3: 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) > > #else Reviewed-by: Martin Rodriguez Reboredo