Re: [PATCH v5 1/2] rust: revocable: Refactor revocation mechanism to remove generic revoke_internal

From: Benno Lossin
Date: Thu Jul 03 2025 - 04:25:04 EST


On Thu Jun 26, 2025 at 6:59 PM CEST, Marcelo Moreira wrote:
> The revocation mechanism is refactored by removing the generic
> `revoke_internal` function. Its logic is now directly integrated into
> two distinct public functions: `revoke()` and `revoke_nosync()`.
>
> `revoke_nosync()` is an `unsafe` function that requires the caller to
> guarantee no concurrent users, thus avoiding an RCU grace period.
> `revoke()` is a safe function that internally waits for the RCU grace
> period to ensure all concurrent accesses have completed before dropping
> the wrapped object.
>
> This change improves API clarity and simplifies associated `SAFETY`
> comments by making the synchronization behavior explicit in the function
> signatures.
>
> Suggested-by: Benno Lossin <lossin@xxxxxxxxxx>
> Suggested-by: Danilo Krummrich <dakr@xxxxxxxxxx>
> Signed-off-by: Marcelo Moreira <marcelomoreira1905@xxxxxxxxx>

With the patch order changed:

Reviewed-by: Benno Lossin <lossin@xxxxxxxxxx>

---
Cheer,
Benno

> ---
> rust/kernel/revocable.rs | 48 ++++++++++++++++++----------------------
> 1 file changed, 21 insertions(+), 27 deletions(-)