From: Alice Ryhl <aliceryhl@google.com>
To: Danilo Krummrich <dakr@kernel.org>
Cc: gregkh@linuxfoundation.org, rafael@kernel.org, ojeda@kernel.org,
boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com,
a.hindborg@kernel.org, tmgross@umich.edu,
daniel.almeida@collabora.com, tamird@kernel.org,
acourbot@nvidia.com, work@onurozkan.dev, lyude@redhat.com,
driver-core@lists.linux.dev, linux-kernel@vger.kernel.org,
rust-for-linux@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] rust: devres: ensure revocation is complete before device finishes unbinding
Date: Thu, 2 Jul 2026 10:33:52 +0000 [thread overview]
Message-ID: <akY-kHO1o3WgUSoW@google.com> (raw)
In-Reply-To: <20260628200304.2365598-1-dakr@kernel.org>
On Sun, Jun 28, 2026 at 10:02:53PM +0200, Danilo Krummrich wrote:
> Now that the revocation Completion is in place, also address the
> symmetric case. When Devres::drop() wins the is_available swap and the
> devres callback loses, the callback returns to devres_release_all()
> without waiting. This means device unbinding can complete while
> Devres::drop() is still executing drop_in_place() on another CPU, which
> is a problem if T's destructor accesses device state.
>
> Make the synchronization bidirectional. Whichever side performs
> drop_in_place() signals the Completion, and the other side waits.
>
> This does not reintroduce the nested Devres deadlock fixed by commit
> ba268514ea14 ("rust: devres: fix race condition due to nesting"),
> because that deadlock was caused by drop waiting for the release
> callback to return (the old 'devm' Completion). Here, both sides only
> wait for drop_in_place() to finish, which completes within the current
> call chain. The Arc<Inner<T>> keeps the Inner allocation alive
> independently.
>
> Cc: stable@vger.kernel.org
> Fixes: ba268514ea14 ("rust: devres: fix race condition due to nesting")
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
next prev parent reply other threads:[~2026-07-02 10:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-28 17:44 [PATCH] rust: devres: fix race between concurrent revokers Danilo Krummrich
2026-06-28 20:02 ` [PATCH] rust: devres: ensure revocation is complete before device finishes unbinding Danilo Krummrich
2026-07-02 10:33 ` Alice Ryhl [this message]
2026-07-02 11:10 ` Gary Guo
2026-07-02 10:33 ` [PATCH] rust: devres: fix race between concurrent revokers Alice Ryhl
2026-07-02 11:10 ` Gary Guo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=akY-kHO1o3WgUSoW@google.com \
--to=aliceryhl@google.com \
--cc=a.hindborg@kernel.org \
--cc=acourbot@nvidia.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun@kernel.org \
--cc=dakr@kernel.org \
--cc=daniel.almeida@collabora.com \
--cc=driver-core@lists.linux.dev \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lyude@redhat.com \
--cc=ojeda@kernel.org \
--cc=rafael@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tamird@kernel.org \
--cc=tmgross@umich.edu \
--cc=work@onurozkan.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox