Re: [Question] Detecting Sleep-in-Atomic Context in PREEMPT_RT via RV (Runtime Verification) monitor rtapp:sleep
From: Nam Cao
Date: Thu Dec 11 2025 - 00:43:19 EST
Yunseong Kim <ysk@xxxxxxxxxxx> writes:
> I specifically believe that RV can encompass the role of
> CONFIG_DEBUG_ATOMIC_SLEEP and even go beyond it.
>
> My reasoning is that even if a sleepable (PREEMPT_RT) spinlock is used
> within an IRQ/preemption disabled section, CONFIG_DEBUG_ATOMIC_SLEEP
> might not trigger a warning if scheduling does not actually occur (i.e.,
> if there is no contention for that spinlock). This is because the actual
> debugging check happens in __might_resched().
That's not how it works. See the description of CONFIG_DEBUG_ATOMIC_SLEEP:
"If you say Y here, various routines which may sleep will become very
noisy if they are called inside atomic sections: when a spinlock is
held, inside an rcu read side critical section, inside preempt disabled
sections, inside an interrupt, etc..."
Nam