[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z6DS6cIWgGsX7FXL@tardis.local>
Date: Mon, 3 Feb 2025 06:30:01 -0800
From: Boqun Feng <boqun.feng@...il.com>
To: Alice Ryhl <aliceryhl@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Miguel Ojeda <ojeda@...nel.org>,
Gary Guo <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>,
Benno Lossin <benno.lossin@...ton.me>,
Andreas Hindborg <a.hindborg@...nel.org>,
Trevor Gross <tmgross@...ch.edu>, Ingo Molnar <mingo@...hat.com>,
Will Deacon <will@...nel.org>, Waiman Long <longman@...hat.com>,
rust-for-linux@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] rust: sync: add wait_interruptible_freezable
On Mon, Feb 03, 2025 at 02:41:37PM +0100, Alice Ryhl wrote:
> On Mon, Feb 3, 2025 at 2:38 PM Peter Zijlstra <peterz@...radead.org> wrote:
> >
> > On Mon, Feb 03, 2025 at 12:56:05PM +0100, Alice Ryhl wrote:
> > > On Mon, Feb 3, 2025 at 12:54 PM Peter Zijlstra <peterz@...radead.org> wrote:
> > > >
> > > > On Thu, Jan 30, 2025 at 11:30:44AM +0000, Alice Ryhl wrote:
> > > > > Binder allows you to freeze a process where some of its threads are
> > > > > blocked on the Binder driver. To make this work, we need to pass
> > > > > TASK_FREEZABLE when going to sleep in the appropriate places. Thus, add
> > > > > a new method wait_interruptible_freezable for the condition variable so
> > > > > that sleeps where this is supported can be marked as such.
> > > >
> > > > The constraint on freezable is that you must not hold locks. There is a
> > > > lockdep check for this in the code, but it would probably make sense to
> > > > teach Rust about this constraint as well, hmm?
> > >
> > > Unfortunately, I don't think there's any way to enforce this at
> > > compile time, but I'm definitely happy to add this in the
> > > documentation.
> >
> > Ah, ISTR people talking about teaching Rust about the whole raw_spinlock
> > vs spinlock vs mutex nesting order and figured if it can do that, then
Peter, are you talking about the POC idea I proposed on tracking irqsave
status:
https://lore.kernel.org/rust-for-linux/20241018055125.2784186-1-boqun.feng@gmail.com/
? I'm working on this right now, however, I don't think this would help
spinlock or mutex nesting? Because there's no global(percpu) status of
acquiring these locks. Am I missing something here?
Regards,
Boqun
> > this should be doable too.
> >
> > But perhaps that never quite happened.
>
> There isn't too much progress on that front lately, but you are right
> that this work could be extended to support this case too.
>
> > Yes, documentation would be good. Just in case it isn't obviuos,
> > freezing a task that holds a lock can trivially deadlock vs another task
> > that needs that lock to complete before it too can hit freezable.
>
> I'll include those details, thanks!
>
> Alice
Powered by blists - more mailing lists