All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alice Ryhl <aliceryhl@google.com>
To: Andreas Hindborg <a.hindborg@kernel.org>
Cc: "Miguel Ojeda" <ojeda@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Benno Lossin" <lossin@kernel.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>,
	rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] rust: xarray: fix false positive lockdep warnings
Date: Fri, 5 Jun 2026 11:17:04 +0000	[thread overview]
Message-ID: <aiKwMKyHaZ1WqI5I@google.com> (raw)
In-Reply-To: <20260605-xarray-lockdep-fix-v2-1-25a5509abee3@kernel.org>

On Fri, Jun 05, 2026 at 11:14:29AM +0200, Andreas Hindborg wrote:
> `xa_init_flags()` is a static inline that expands `spin_lock_init()`,
> which generates a single static `lock_class_key` per compilation unit.
> When used through the Rust binding helper, every Rust `XArray`
> instance ends up sharing that single key. Lockdep then sees concurrent
> locking of distinct Rust `XArray`s as recursive locking on the same
> class and emits false-positive lock-ordering reports.
> 
> Add a custom helper `xa_init_flags_with_key()` that mirrors
> `xa_init_flags()` but takes an explicit name and `struct
> lock_class_key` from the caller. Update `XArray::new` to take a name
> and a `LockClassKey`, and add a `new_xarray!` macro that uses
> `optional_name!` and `static_lock_class!` to generate a unique class
> per instantiation site.
> 
> Remove the now unused `rust_helper_xa_init_flags`.
> 
> This was previously part of the series at [1].
> 
> Link: https://lore.kernel.org/r/20251203-xarray-entry-send-v1-0-9e5ffd5e3cf0@kernel.org [1]
> Fixes: 210b81578efbe ("rust: xarray: Add an abstraction for XArray")
> Suggested-by: Alice Ryhl <aliceryhl@google.com>
> Acked-by: Tamir Duberstein <tamird@kernel.org>
> Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>

Reviewed-by: Alice Ryhl <aliceryhl@google.com>

  reply	other threads:[~2026-06-05 11:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-05  9:14 [PATCH v2] rust: xarray: fix false positive lockdep warnings Andreas Hindborg
2026-06-05 11:17 ` Alice Ryhl [this message]
2026-06-05 12:09 ` Tamir Duberstein
2026-06-05 12:32   ` Tamir Duberstein
2026-06-05 12:09 ` Tamir Duberstein

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=aiKwMKyHaZ1WqI5I@google.com \
    --to=aliceryhl@google.com \
    --cc=a.hindborg@kernel.org \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=gary@garyguo.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.