From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2A9420CCD3 for ; Fri, 23 May 2025 11:53:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=140.211.166.137 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748001212; cv=none; b=VXLf/viFH16Ov7nz2LShoghPNln5Tq/I7mBCTuy7M6t3pmk57+rTPDguNyQPnAsIsWd01TowmYvG4SBg1DPNpjCJUpvYDOT48yK/n0ME0Q3zrYYQtRSE0ZTTjJI/smV8ZE1geXjmfn4Zms9a3BD0c++Owgl7T+H808/W6my8+Rw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1748001212; c=relaxed/simple; bh=8m+84PI0xY9G72NqwkULWmDnkygrhJle3AVSGN4iBy0=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:From:To:Cc: References:In-Reply-To; b=Owlio1i1wq5XgDEcBkSnr8H7EKPGjyCCLh9LHOYFp5IszeZkHPDz7fu7kJ34hwuiTM3eqj9DrdC/+R3nyVfCtJoeRuzx8CgWMma0ayw3xuSBMc31aW5diPxkCDWKP9tQNvuJ8xlfFAoxjIss4aMbxVBlwYVgd7ra3G1rBuMbD2M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=HH0ieDuw; arc=none smtp.client-ip=140.211.166.137 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="HH0ieDuw" Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 135DC407AB for ; Fri, 23 May 2025 11:53:31 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org X-Spam-Flag: NO X-Spam-Score: -2.101 X-Spam-Level: Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id WJBiql8HD_u8 for ; Fri, 23 May 2025 11:53:30 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2600:3c04:e001:324:0:1991:8:25; helo=tor.source.kernel.org; envelope-from=lossin@kernel.org; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 7C93D4079D Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=kernel.org DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 7C93D4079D Authentication-Results: smtp4.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=HH0ieDuw Received: from tor.source.kernel.org (tor.source.kernel.org [IPv6:2600:3c04:e001:324:0:1991:8:25]) by smtp4.osuosl.org (Postfix) with ESMTPS id 7C93D4079D for ; Fri, 23 May 2025 11:53:30 +0000 (UTC) Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by tor.source.kernel.org (Postfix) with ESMTP id 7787861154; Fri, 23 May 2025 11:53:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63A2FC4CEE9; Fri, 23 May 2025 11:53:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1748001208; bh=8m+84PI0xY9G72NqwkULWmDnkygrhJle3AVSGN4iBy0=; h=Date:Subject:From:To:Cc:References:In-Reply-To:From; b=HH0ieDuwDesIqqzHmBoGn0nrdJiFp0qwHGygl8el1oYhY7/ywg8llks+Sav6g6uB7 dR5wP2t7h+EKFThc7llYcOBpe9tuPOatOSThkedmIyaB1LPZ6mQCrUTlpM+h4DVd/S rtjeYlNKtJ+OlcuIOn5zQW8SprmEChmKQCb1St2IDi6yFd+SbaPSyYI4/oc06NFD3m 03SoDlOdj2GbuHh73CQnb/i38BfpolGphuHrPF5Qo67LbhUtBONtTGzVPDRk8rYErl SO92yaffzXJOsVmmQteXH5i37MNPUgQ+U6rQxP1P4QFmolqjuannH5sEJxDcc4pr1b zKyY2cktRtz5g== Precedence: bulk X-Mailing-List: linux-kernel-mentees@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Fri, 23 May 2025 13:53:24 +0200 Message-Id: Subject: Re: [PATCH v2] rust: doc: Clarify safety invariants for Revocable type From: "Benno Lossin" To: "Danilo Krummrich" Cc: "Marcelo Moreira" , "Boqun Feng" , , , , , , <~lkcamp/patches@lists.sr.ht> X-Mailer: aerc 0.20.1 References: In-Reply-To: On Fri May 23, 2025 at 10:55 AM CEST, Danilo Krummrich wrote: > On Fri, May 23, 2025 at 10:42:58AM +0200, Benno Lossin wrote: >> On Fri May 23, 2025 at 2:13 AM CEST, Marcelo Moreira wrote: >> > 3. Clarified revoke_internal for SYNC =3D false and swap correction >> > Proposed Documentation: >> > if self.is_available.swap(false, Ordering::Relaxed) { >> > if SYNC { >> > // SAFETY: Just an FFI call, there are no further requ= irements. >> > unsafe { bindings::synchronize_rcu() }; >>=20 >> @Boqun: is this true? >>=20 >> If the answer is yes, then we should add this as a safe function in the >> rcu module. > > I think it's a case for Klint, since synchronize_rcu() must not be called= from > atomic context, since it may block. Otherwise, there shouldn't be any add= itional > requirements. Makes sense, but then we should add this as a safe function (in a separate patch). After all we already have other safe functions that should be unsafe were it not for klint. >> > } else { >> > // This branch for `revoke_nosync` requires the caller to prove >> > that `data` >> > // can be dropped immediately without waiting for any RCU grace= period. >>=20 >> I'm not sure that having a single function that does the revocation, but >> has this going on is a good idea. The safety requirements will be pretty >> complex. >>=20 >> @Danilo what do you think of inlining this function? > > Sure, if it makes documentation significantly easier, which seems to be t= he > case, then it's probably worth. Yeah then let's do it (also separate patch). --- Cheers, Benno