Re: [PATCH net-next v2 5/6] rust: Add read_poll_timeout function
From: FUJITA Tomonori
Date: Mon Oct 14 2024 - 23:37:20 EST
On Sat, 5 Oct 2024 15:22:23 -0700
Boqun Feng <boqun.feng@xxxxxxxxx> wrote:
> On Sat, Oct 05, 2024 at 08:32:01PM +0200, Andrew Lunn wrote:
>> > might_sleep() is called via a wrapper so the __FILE__ and __LINE__
>> > debug info with CONFIG_DEBUG_ATOMIC_SLEEP enabled isn't what we
>> > expect; the wrapper instead of the caller.
>>
>> So not very useful. All we know is that somewhere in Rust something is
>> sleeping in atomic context. Is it possible to do better? Does __FILE__
>> and __LINE__ exist in Rust?
>>
>
> Sure, you can use:
>
> https://doc.rust-lang.org/core/macro.line.html
To get the proper file name and line number with those macros, we need
to use __might_sleep() instead of might_sleep(). We could also call to
might_resched() there to emulate might_sleep() but fsleep() works
without it so I call only __might_sleep() in the next version.