Re: "Dead loop on virtual device" error without softirq-BKL on PREEMPT_RT

From: Bert Karwatzki

Date: Tue Feb 17 2026 - 11:53:45 EST


Am Dienstag, dem 17.02.2026 um 12:24 +0100 schrieb Bert Karwatzki:
> Am Dienstag, dem 17.02.2026 um 11:42 +0100 schrieb Bert Karwatzki:
> >
> > I just wondered if we can completely skip the
> >
> > if (READ_ONCE(txq->xmit_lock_owner) != cpu) {
> > [...]
> > } else 
> > {
> > /* "Recursion" alert */
> > }
> >
> > check, as the synchronization will we provided by HARD_TX_{LOCK,UNLOCK}.
> >
>
> I thought about that again, and it seems like a bad idea as (in the non-preempt) case
> other threads trying to access the queue would wait for the spinlock to be freed, perhaps
> one can just change the code like this:

My argument above seems wrong: In the non-preempt case we cannot have another thread accessing the txq
from the same CPU if the lock is taken (it is not preemptible) and for other threads
accessing the txq from different CPUs the check (txq->xmit_lock_owner != cpu) would succeed
and they would try the spinlock anyway, So this would not speak against killing the lock owner
check. As for the recursion detection, perhaps dev_xmit_recursion() is enough?


Another Idea (more vague ...):

Using the CPU Id as the lock_owner seems to make sense for locks that are not
preemptible (raw_spinlock in the RT case). For preemptible locks a thread ID (which one exactly I'm not sure ...)
would perhaps make a better lock owner ...

Bert Karwatzki