Re: [Question] Detecting Sleep-in-Atomic Context in PREEMPT_RT via RV (Runtime Verification) monitor rtapp:sleep

From: Sebastian Andrzej Siewior
Date: Tue Dec 02 2025 - 06:26:57 EST


On 2025-12-02 12:14:09 [+0100], Nam Cao wrote:
> > RV is not a static checker, it is a run-time checker.
> >
> > Just in case you are not aware yet, there is also Smatch:
> > https://github.com/error27/smatch. But I can't offer much help there.
>
> I was looking up something unrelated, and I found that Smatch does
> detect this sleep-in-atomic problem:
> https://staticthinking.wordpress.com/2024/05/24/sleeping-in-atomic-warnings/
>
> I'm not sure if its design takes PREEMPT_RT into consideration. But
> seems worth having a look.

It does not look like it does. Judging from
https://github.com/error27/smatch/blob/master/check_preempt_info.c

it increments the preempt-counter on preempt_disable() and spin_lock().
So it won't yell at
preempt_disable();
spin_lock();

while CONFIG_DEBUG_ATOMIC_SLEEP would.

> Nam

Sebastian