All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bert Karwatzki <spasswolf@web.de>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org,  linux-rt-devel@lists.linux.dev
Subject: Re: "Dead loop on virtual device" error without softirq-BKL on PREEMPT_RT
Date: Tue, 17 Feb 2026 11:42:58 +0100	[thread overview]
Message-ID: <4fba57892e5bd6a1afc4a36a80b40e3ecc28cac5.camel@web.de> (raw)
In-Reply-To: <20260217095700.SjYjM8RO@linutronix.de>

Am Dienstag, dem 17.02.2026 um 10:57 +0100 schrieb Sebastian Andrzej Siewior:
> On 2026-02-17 09:56:48 [+0100], Bert Karwatzki wrote:
> > Am Dienstag, dem 17.02.2026 um 08:19 +0100 schrieb Sebastian Andrzej Siewior:
> > > On 2026-02-17 00:48:25 [+0100], Bert Karwatzki wrote:
> > > > The problem seems to be that different preemtible threads try to send skbs. 
> > > 
> > > This does not matter because the counter is per-thread not per-CPU. 
> > 
> > The "Dead loop on virtual device" messages is not printed because dev_xmit_recursion()
> > returns true, but because READ_ONCE(txq->xmit_lock_owner) == cpu.
> 
> Ach, so it is not the recursion, it is the assigned CPU.
> This is assigned via __netif_tx_lock(). Here we somehow lack the
> expected synchronisation. So the queue should be locked but not by the
> caller.

Yes, the queue gets locked by the first thread (via HARD_TX_LOCK), then the thread gets
preempted before the processing of the skb is complete, then the next thread on the same
CPU calls __dev_queue_xmit() and find that the lockowner has the same CPU id.

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}.

The comment

		/* Other cpus might concurrently change txq->xmit_lock_owner
		 * to -1 or to their cpu id, but not to our id.
		 */
suggests that the case that a thread is preempted while holding the lock was
not taken into account here. And in non-RT cases this would be correct as spin_lock()
disables preemption in that case.

Bert Karwatzki

  reply	other threads:[~2026-02-17 10:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-16 13:43 "Dead loop on virtual device" error without softirq-BKL on PREEMPT_RT Bert Karwatzki
2026-02-16 15:32 ` Bert Karwatzki
2026-02-16 15:37   ` Sebastian Andrzej Siewior
2026-02-16 23:48     ` Bert Karwatzki
2026-02-17  7:19       ` Sebastian Andrzej Siewior
2026-02-17  8:56         ` Bert Karwatzki
2026-02-17  9:57           ` Sebastian Andrzej Siewior
2026-02-17 10:42             ` Bert Karwatzki [this message]
2026-02-17 11:24               ` Bert Karwatzki
2026-02-17 16:52                 ` Bert Karwatzki
2026-02-17 19:10                   ` Bert Karwatzki
2026-02-18  7:30                     ` Sebastian Andrzej Siewior
2026-02-18 12:50                       ` Bert Karwatzki
2026-02-26 17:29                         ` Sebastian Andrzej Siewior
2026-03-18 10:30                           ` Daniel Vacek
2026-03-18 11:18                             ` Sebastian Andrzej Siewior
2026-03-18 14:43                               ` Daniel Vacek
2026-03-18 14:51                                 ` Sebastian Andrzej Siewior
2026-03-18 14:58                                   ` Daniel Vacek
2026-04-01 16:55                                   ` Daniel Vacek
2026-04-02  7:03                                     ` Sebastian Andrzej Siewior
2026-04-02  7:50                                       ` Daniel Vacek
2026-04-02  8:31                                         ` Sebastian Andrzej Siewior
2026-04-02  9:21                                           ` Daniel Vacek
2026-04-02 13:46                                             ` Sebastian Andrzej Siewior
2026-04-02 13:58                                               ` Daniel Vacek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4fba57892e5bd6a1afc4a36a80b40e3ecc28cac5.camel@web.de \
    --to=spasswolf@web.de \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-devel@lists.linux.dev \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.