Re: [PATCH v9 2/2] rust: xarray: Add an abstraction for XArray
From: Tamir Duberstein
Date: Tue Nov 19 2024 - 11:56:42 EST
On Tue, Nov 19, 2024 at 11:43 AM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
>
> On Tue, Nov 19, 2024 at 5:40 PM Tamir Duberstein <tamird@xxxxxxxxx> wrote:
> >
> > On Tue, Nov 19, 2024 at 11:28 AM Alice Ryhl <aliceryhl@xxxxxxxxxx> wrote:
> > >
> > > On Tue, Nov 19, 2024 at 5:24 PM Tamir Duberstein <tamird@xxxxxxxxx> wrote:
> > > >
> > > > On Mon, Nov 18, 2024 at 5:18 PM Boqun Feng <boqun.feng@xxxxxxxxx> wrote:
> > > > >
> > > > > On Mon, Nov 18, 2024 at 11:33:36AM -0500, Tamir Duberstein wrote:
> > > > > [...]
> > > > > > +
> > > > > > +/// A lock guard.
> > > > > > +///
> > > > > > +/// The lock is unlocked when the guard goes out of scope.
> > > > > > +#[must_use = "the lock unlocks immediately when the guard is unused"]
> > > > > > +pub struct Guard<'a, T: ForeignOwnable> {
> > > > > > + xa: &'a XArray<T>,
> > > > > > +}
> > > > >
> > > > > `Guard` would be `Send` if `XArray<T>` is `Sync`, however, it's
> > > > > incorrect since `Guard` represents an xa_lock() held, and that's a
> > > > > spin_lock, so cannot be dropped on another thread/context. `Guard`
> > > > > should probably be marked as `!Send`. Or am I missing something subtle
> > > > > here?
> > > >
> > > > I didn't know about this requirement, thanks for calling it out. I
> > > > have added `_not_send: PhantomData<*mut ()>` in v10.
> > >
> > > You can use _nts: NotThreadSafe. The type in question has landed in
> > > 6.13 and is available in Linus's tree since yesterday.
> >
> > TIL, thanks - though it looks like the field name is still `_not_send`.
> >
> > How do I set the base-commit/deps such that both
> > https://github.com/torvalds/linux/commit/e7572e5deaf3bc36818f19ba35ac8e0c454c8bac
> > and https://github.com/Rust-for-Linux/linux/commit/d072acda4862f095ec9056979b654cc06a22cc68
> > are present, given that the former is in 6.13 and the latter in
> > rust-next?
>
> Either you merge them yourself or you wait for rust-next to get merged
> into Linus's branch.
Sure, I can merge them locally - but how do I properly send a patch
that relies on both to the list?