[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e46d6e12-144f-47fe-9db4-d7d04914f265@proton.me>
Date: Fri, 26 Jul 2024 21:30:00 +0000
From: Benno Lossin <benno.lossin@...ton.me>
To: Boqun Feng <boqun.feng@...il.com>, Lyude Paul <lyude@...hat.com>
Cc: rust-for-linux@...r.kernel.org, Danilo Krummrich <dakr@...hat.com>, airlied@...hat.com, Ingo Molnar <mingo@...hat.com>, Will Deacon <will@...nel.org>, Waiman Long <longman@...hat.com>, Peter Zijlstra <peterz@...radead.org>, Miguel Ojeda <ojeda@...nel.org>, Alex Gaynor <alex.gaynor@...il.com>, Wedson Almeida Filho <wedsonaf@...il.com>, Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>, Andreas Hindborg <a.hindborg@...sung.com>, Alice Ryhl <aliceryhl@...gle.com>, Martin Rodriguez Reboredo <yakoyoku@...il.com>, FUJITA Tomonori <fujita.tomonori@...il.com>, Aakash Sen Sharma <aakashsensharma@...il.com>, Valentin Obst <kernel@...entinobst.de>, open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 1/3] rust: Introduce irq module
On 26.07.24 23:21, Boqun Feng wrote:
> On Thu, Jul 25, 2024 at 06:27:50PM -0400, Lyude Paul wrote:
> [...]
>> +pub struct IrqDisabled<'a>(PhantomData<&'a ()>);
>
> I think you need to make this type !Send and !Sync (because you are
> going to make it Copy). Otherwise, you will be able to pass the irq
> disabled token to another thread on a different CPU which doesn't have
> irq disabled.
Oh yeah this is a good catch! (although it should not matter at the
moment, see the end of the note below)
Just a note: it is not because of making it Copy, this problem already
exists in the current implementation. One could have sent the reference
to a different thread using a "scoped spawn"-esque function [1]. IIRC we
currently do not have such a function, but it should be possible to
later add such a function. (and it is much more accurate to make this
type not be thread safe)
[1]: https://doc.rust-lang.org/std/thread/struct.Scope.html#method.spawn
---
Cheers,
Benno
Powered by blists - more mailing lists