Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp992084rwd; Thu, 25 May 2023 06:50:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6u7IF+3GLvtBpKnKcg20o3A/QpDdJvPtdkAbnl0+OlPxLhL7U5CxxCan1VfePixJuR8pls X-Received: by 2002:a05:6a00:3915:b0:63b:8dcc:84de with SMTP id fh21-20020a056a00391500b0063b8dcc84demr2869247pfb.4.1685022654602; Thu, 25 May 2023 06:50:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685022654; cv=none; d=google.com; s=arc-20160816; b=j9TMrXct5onkRjX1S2Bies+56yGI2bVMwX+8o+r25j14BjdADL1O7PRHNmBxKVZcOj Q28rzhaQwMVsiH6gZTEdDUHoK+uwpu+5mIe0zRSU/VEq+AsVEjS0kDASI2mCczw83hN2 jwgEZL7yHx7DpezmpfSuXhEJ7WSthu037DXEb2IS8vmFRllMIrDrd5G32uL2Oe7L4TtZ IUS7ZMG2jVvRymE29nlwudIF0fyGTKG/l92gmEqKPznXpQcISkfgeYq8cIGz18SKChHE +55KAx3pD/cLWz8j+sFh6alp3RVwHvpGUaBb6uvoCMiNkQcMc9xyeJ8ywNkk3SLf6XWt JxSg== 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 :feedback-id:references:in-reply-to:message-id:subject:cc:from:to :dkim-signature:date; bh=7IixD+bhmeF+BKHzzoQ2QhW1JCPmJJ1WQf05j26o1sY=; b=XifkijhhOvFsNOSBxXEFOVKNALRxBqPl3IHqe5FDkjsKt+f6IYLi5SxLPb0O2PGyuW XTsIEaE6sPWCTVThwBjjWYAeZnb0ZeNZTlrJ0JqIxU1vW1LWTktAr1kKHEaDz3/Htbld WIyEgrYPxYw9BnuRFvr9xQgLasNRXNM5JI9ntVbxKXxCWfqozGRmntn27in5hKuuOqLo +nnxkhr7Vnna5G+Y5A6LJh4C6CXNNYjArJgfJ745xjK9wIQAO+yhIyjaaAVDacL2rjdw ETKx0v7uxf2ykqbF5pNnSQ6Q5Jov008hYW+D9SFuiYiNFINrkDL/wksrxa00CKXc5q1Z U0FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=DYGfzTpQ; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j63-20020a638042000000b0052c73367c13si1174194pgd.871.2023.05.25.06.50.40; Thu, 25 May 2023 06:50:54 -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=@proton.me header.s=protonmail header.b=DYGfzTpQ; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241111AbjEYNfV (ORCPT + 99 others); Thu, 25 May 2023 09:35:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230464AbjEYNfU (ORCPT ); Thu, 25 May 2023 09:35:20 -0400 Received: from mail-4322.protonmail.ch (mail-4322.protonmail.ch [185.70.43.22]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A4A4132; Thu, 25 May 2023 06:35:15 -0700 (PDT) Date: Thu, 25 May 2023 13:35:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1685021712; x=1685280912; bh=7IixD+bhmeF+BKHzzoQ2QhW1JCPmJJ1WQf05j26o1sY=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=DYGfzTpQu21styBltnt9D3k03W6GJg/uDtdfvnDhGdlAkMwooOCP07D9xAQ+v0Wle KbKuwPAFzEvhNoPQ1nq7IxFvMvcr5KZr0c3jE2ihw1dMspOJYajdYkiKhTL0jgcrL8 VX9v2M3+UZJwdBgpDwL8eaiW2Ot1x743FfbdZK6hPcqXn2cRwonPFhT3036J3r0n/c tPpCXSVwyt5qf44euL/D1m9D6kHglDndgT1xe7Vb2qJwz1FM2Yr1kJ4EWSCu8GbEWW k5Ym3rg8IWCXZ2PdDnA62WRuqHwtHGoupZ7Jvqx0S+qUMucL6cwo0UokPYRlRlkjaS 0J5j2mM4B2C0Q== To: Alice Ryhl From: Benno Lossin Cc: Miguel Ojeda , Wedson Almeida Filho , Alex Gaynor , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Ingo Molnar , Peter Zijlstra , Will Deacon , Mark Rutland , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Andreas Hindborg Subject: Re: [PATCH v2 1/4] rust: sync: reword the `Arc` safety comment for `Send` Message-ID: In-Reply-To: <20230523144418.1250547-2-aliceryhl@google.com> References: <20230523144418.1250547-1-aliceryhl@google.com> <20230523144418.1250547-2-aliceryhl@google.com> Feedback-ID: 71780778:user:proton MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no 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 5/23/23 16:44, Alice Ryhl wrote: > The safety comment on `impl Send for Arc` talks about "directly" > accessing the value, when it really means "accessing the value with a > mutable reference". This commit clarifies that. >=20 > Suggested-by: Boqun Feng > Signed-off-by: Alice Ryhl > Reviewed-by: Andreas Hindborg > Reviewed-by: Boqun Feng Reviewed-by: Benno Lossin > --- > rust/kernel/sync/arc.rs | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/rust/kernel/sync/arc.rs b/rust/kernel/sync/arc.rs > index e6d206242465..87a4c9ed712b 100644 > --- a/rust/kernel/sync/arc.rs > +++ b/rust/kernel/sync/arc.rs > @@ -146,8 +146,8 @@ impl, U: ?Sized> core::ops::Dis= patchFromDyn> for Ar >=20 > // SAFETY: It is safe to send `Arc` to another thread when the under= lying `T` is `Sync` because > // it effectively means sharing `&T` (which is safe because `T` is `Syn= c`); additionally, it needs > -// `T` to be `Send` because any thread that has an `Arc` may ultimate= ly access `T` directly, for > -// example, when the reference count reaches zero and `T` is dropped. > +// `T` to be `Send` because any thread that has an `Arc` may ultimate= ly access `T` using a > +// mutable reference, for example, when the reference count reaches zero= and `T` is dropped. > unsafe impl Send for Arc {} >=20 > // SAFETY: It is safe to send `&Arc` to another thread when the unde= rlying `T` is `Sync` for the > -- > 2.40.1.698.g37aff9b760-goog >=20 --=20 Cheers, Benno