public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Boqun Feng <boqun.feng@gmail.com>
To: Benno Lossin <benno.lossin@proton.me>
Cc: "Lyude Paul" <lyude@redhat.com>,
	rust-for-linux@vger.kernel.org,
	"Danilo Krummrich" <dakr@redhat.com>,
	airlied@redhat.com, "Ingo Molnar" <mingo@redhat.com>,
	"Will Deacon" <will@kernel.org>,
	"Waiman Long" <longman@redhat.com>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Alex Gaynor" <alex.gaynor@gmail.com>,
	"Wedson Almeida Filho" <wedsonaf@gmail.com>,
	"Gary Guo" <gary@garyguo.net>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@samsung.com>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Martin Rodriguez Reboredo" <yakoyoku@gmail.com>,
	"FUJITA Tomonori" <fujita.tomonori@gmail.com>,
	"Aakash Sen Sharma" <aakashsensharma@gmail.com>,
	"Valentin Obst" <kernel@valentinobst.de>,
	"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] rust: Introduce irq module
Date: Fri, 26 Jul 2024 14:40:54 -0700	[thread overview]
Message-ID: <ZqQX5hPb3yha2opu@boqun-archlinux> (raw)
In-Reply-To: <e46d6e12-144f-47fe-9db4-d7d04914f265@proton.me>

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
> 

  reply	other threads:[~2024-07-26 21:41 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240725222822.1784931-1-lyude@redhat.com>
2024-07-25 22:27 ` [PATCH 1/3] rust: Introduce irq module Lyude Paul
2024-07-26  5:39   ` Greg KH
2024-07-26 17:45     ` Lyude Paul
2024-07-26  7:23   ` Benno Lossin
2024-07-26 18:18     ` Lyude Paul
2024-07-26 19:39       ` Benno Lossin
2024-07-26 10:13   ` Trevor Gross
2024-07-26 21:21   ` Boqun Feng
2024-07-26 21:30     ` Benno Lossin
2024-07-26 21:40       ` Boqun Feng [this message]
2024-07-25 22:27 ` [PATCH 2/3] rust: sync: Introduce LockContainer trait Lyude Paul
2024-07-26  7:40   ` Benno Lossin
2024-07-26 18:20     ` Lyude Paul
2024-07-25 22:27 ` [PATCH 3/3] rust: sync: Add IrqSpinLock Lyude Paul
2024-07-26  7:48   ` Peter Zijlstra
2024-07-26 18:29     ` Lyude Paul
2024-07-26 20:21     ` Lyude Paul
2024-07-26 20:26       ` Peter Zijlstra
2024-07-27 11:21   ` kernel test robot

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=ZqQX5hPb3yha2opu@boqun-archlinux \
    --to=boqun.feng@gmail.com \
    --cc=a.hindborg@samsung.com \
    --cc=aakashsensharma@gmail.com \
    --cc=airlied@redhat.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=benno.lossin@proton.me \
    --cc=bjorn3_gh@protonmail.com \
    --cc=dakr@redhat.com \
    --cc=fujita.tomonori@gmail.com \
    --cc=gary@garyguo.net \
    --cc=kernel@valentinobst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=lyude@redhat.com \
    --cc=mingo@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=wedsonaf@gmail.com \
    --cc=will@kernel.org \
    --cc=yakoyoku@gmail.com \
    /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