Re: [PATCH net-next v2 5/6] rust: Add read_poll_timeout function
From: Andrew Lunn
Date: Sat Oct 05 2024 - 14:32:41 EST
> 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?
> + if sleep {
> + // SAFETY: FFI call.
> + unsafe { bindings::might_sleep() }
> + }
What is actually unsafe about might_sleep()? It is a void foo(void)
function, so takes no parameters, returns no results. It cannot affect
anything which Rust is managing.
> + // SAFETY: FFI call.
> + unsafe { bindings::cpu_relax() }
Same here.
Andrew