[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <DBNRDMPLIAAI.16E3LKVM8VBRO@kernel.org>
Date: Mon, 28 Jul 2025 16:30:09 +0200
From: "Danilo Krummrich" <dakr@...nel.org>
To: "Daniel Almeida" <daniel.almeida@...labora.com>
Cc: "FUJITA Tomonori" <fujita.tomonori@...il.com>, <kernel@...r.org>,
<linux-kernel@...r.kernel.org>, <rust-for-linux@...r.kernel.org>,
<netdev@...r.kernel.org>, <andrew@...n.ch>, <hkallweit1@...il.com>,
<tmgross@...ch.edu>, <ojeda@...nel.org>, <alex.gaynor@...il.com>,
<gary@...yguo.net>, <bjorn3_gh@...tonmail.com>, <benno.lossin@...ton.me>,
<a.hindborg@...sung.com>, <aliceryhl@...gle.com>,
<anna-maria@...utronix.de>, <frederic@...nel.org>, <tglx@...utronix.de>,
<arnd@...db.de>, <jstultz@...gle.com>, <sboyd@...nel.org>,
<mingo@...hat.com>, <peterz@...radead.org>, <juri.lelli@...hat.com>,
<vincent.guittot@...aro.org>, <dietmar.eggemann@....com>,
<rostedt@...dmis.org>, <bsegall@...gle.com>, <mgorman@...e.de>,
<vschneid@...hat.com>, <tgunders@...hat.com>, <me@...enk.dev>,
<david.laight.linux@...il.com>, <acourbot@...dia.com>
Subject: Re: [PATCH v11 7/8] rust: Add read_poll_timeout functions
On Mon Jul 28, 2025 at 4:13 PM CEST, Daniel Almeida wrote:
> Tyr needs read_poll_timeout_atomic() too, but I never really understood
> if that's not achievable by setting sleep_delta==0, which skips the
> call to fsleep().
read_poll_timeout_atomic() uses udelay() instead of fsleep(), where the latter
may sleep.
In [1] I explicitly asked for not having the
if sleep_delta != 0 {
might_sleep();
}
conditional.
It hides bugs and callers should be explicit about what they want. Either they
want something that actually may sleep or they want something that can be used
from atomic context.
Even better, in Rust we can use Klint to validate correct usage at compile time
with this separation.
[1] https://lore.kernel.org/lkml/DBNPR4KQZXY5.279JBMO315A12@kernel.org/
Powered by blists - more mailing lists