All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicolai Buchwitz <nb@tipi-net.de>
To: Marek Vasut <marex@nabladev.com>
Cc: netdev@vger.kernel.org, stable@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Ronald Wahl <ronald.wahl@raritan.com>,
	Yicong Hui <yiconghui@gmail.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [net,PATCH] net: ks8851: Reinstate disabling of BHs around IRQ handler
Date: Wed, 08 Apr 2026 12:54:53 +0200	[thread overview]
Message-ID: <f4010cedaa49afc1648a73775a987ee5@tipi-net.de> (raw)
In-Reply-To: <20260407212344.80265-1-marex@nabladev.com>

On 7.4.2026 23:23, Marek Vasut wrote:

> [...]

> 
> diff --git a/drivers/net/ethernet/micrel/ks8851_common.c 
> b/drivers/net/ethernet/micrel/ks8851_common.c
> index 8048770958d60..dadedea016fac 100644
> --- a/drivers/net/ethernet/micrel/ks8851_common.c
> +++ b/drivers/net/ethernet/micrel/ks8851_common.c
> @@ -316,6 +316,7 @@ static irqreturn_t ks8851_irq(int irq, void *_ks)
>  	unsigned int status;
>  	struct sk_buff *skb;
> 
> +	local_bh_disable();
>  	ks8851_lock(ks, &flags);

This breaks the SPI variant on non-RT. The SPI path sleeps in
spi_sync() -> wait_for_completion_timeout(), which can't be
done with BH disabled. Confirmed on hardware (KS8851 SPI on
CM4S, PREEMPT non-RT):

   BUG: scheduling while atomic: irq/38-eth2/708/0x00000201
   ...
   spi_transfer_one_message+0x518/0x770
   __spi_pump_transfer_message+0x1dc/0x5f0
   __spi_sync+0x2b4/0x460
   spi_sync+0x38/0x68
   ks8851_rdfifo_spi+0x60/0xc0
   ks8851_irq+0x310/0x3c8

The fix needs to be PAR-specific since the SPI variant doesn't
have the deadlock problem anyway (ks8851_start_xmit_spi doesn't
take the lock).

> 
>  	status = ks8851_rdreg16(ks, KS_ISR);
> @@ -381,6 +382,7 @@ static irqreturn_t ks8851_irq(int irq, void *_ks)
>  	if (status & IRQ_RXI)
>  		while ((skb = __skb_dequeue(&rxq)))
>  			netif_rx(skb);
> +	local_bh_enable();
> 
>  	return IRQ_HANDLED;
>  }

In order to make this work I would propose something like this (which 
works in my SPI setup):

--- a/drivers/net/ethernet/micrel/ks8851_par.c
+++ b/drivers/net/ethernet/micrel/ks8851_par.c
@@ -60,12 +60,14 @@ static void ks8851_lock_par(struct ks8851_net *ks, 
unsigned long *flags)
  {
  	struct ks8851_net_par *ksp = to_ks8851_par(ks);

+	local_bh_disable();
  	spin_lock_irqsave(&ksp->lock, *flags);
  }

  static void ks8851_unlock_par(struct ks8851_net *ks, unsigned long 
*flags)
  {
  	struct ks8851_net_par *ksp = to_ks8851_par(ks);

  	spin_unlock_irqrestore(&ksp->lock, *flags);
+	local_bh_enable();
  }

Tested-by: Nicolai Buchwitz <nb@tipi-net.de>  # KS8851 SPI, non-RT 
(regression + proposed fix)

  parent reply	other threads:[~2026-04-08 10:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-07 21:23 [net,PATCH] net: ks8851: Reinstate disabling of BHs around IRQ handler Marek Vasut
2026-04-08  7:51 ` Nicolai Buchwitz
2026-04-08 10:54 ` Nicolai Buchwitz [this message]
2026-04-08 15:41   ` Marek Vasut
2026-04-08 19:15     ` Nicolai Buchwitz
2026-04-08 21:21       ` Marek Vasut

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=f4010cedaa49afc1648a73775a987ee5@tipi-net.de \
    --to=nb@tipi-net.de \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marex@nabladev.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ronald.wahl@raritan.com \
    --cc=stable@vger.kernel.org \
    --cc=yiconghui@gmail.com \
    /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.