[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ZqQX5hPb3yha2opu@boqun-archlinux>
Date: Fri, 26 Jul 2024 14:40:54 -0700
From: Boqun Feng <boqun.feng@...il.com>
To: Benno Lossin <benno.lossin@...ton.me>
Cc: Lyude Paul <lyude@...hat.com>, 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 Fri, Jul 26, 2024 at 09:30:00PM +0000, Benno Lossin wrote:
> 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
Ah, you're right. I was thinking ahead, i.e. dont_interrupt_me() takes a
`IrqDisabled` instead of a `&IrqDisabled`. But it comes along with the
deal of making `IrqDisabled` `Copy` ;-)
> 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
Yes, scoped spawned timers and works will be very useful, because they
can use stacks for the data structures.
Regards,
Boqun
> 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