public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@nabladev.com>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Jakub Kicinski <kuba@kernel.org>
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>,
	Nicolai Buchwitz <nb@tipi-net.de>,
	Paolo Abeni <pabeni@redhat.com>,
	Ronald Wahl <ronald.wahl@raritan.com>,
	Yicong Hui <yiconghui@gmail.com>,
	linux-kernel@vger.kernel.org, Thomas Gleixner <tglx@kernel.org>
Subject: Re: [net,PATCH v2] net: ks8851: Reinstate disabling of BHs around IRQ handler
Date: Mon, 13 Apr 2026 17:31:34 +0200	[thread overview]
Message-ID: <16fdeec9-9208-4c9b-b228-d6c6e045e116@nabladev.com> (raw)
In-Reply-To: <20260413125744.TVKkZcEK@linutronix.de>

On 4/13/26 2:57 PM, Sebastian Andrzej Siewior wrote:
> On 2026-04-12 10:51:25 [-0700], Jakub Kicinski wrote:
>>> Does the backtrace make the problem clearer, with the annotation above ?
>>
>> Sebastian, do you have any recommendation here? tl;dr is that the driver does
> …
> 
> What about this:
> 
> --- a/drivers/net/ethernet/micrel/ks8851_par.c
> +++ b/drivers/net/ethernet/micrel/ks8851_par.c
> @@ -63,7 +63,7 @@ static void ks8851_lock_par(struct ks8851_net *ks, unsigned long *flags)
>   {
>   	struct ks8851_net_par *ksp = to_ks8851_par(ks);
>   
> -	spin_lock_irqsave(&ksp->lock, *flags);
> +	spin_lock_bh(&ksp->lock);
>   }
>   
>   /**
> @@ -77,7 +77,7 @@ 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);
> +	spin_unlock_bh(&ksp->lock);
>   }
>   
>   /**
> 
> 
> I don't see why it needs to disable interrupts.

Because when the lock is held, the PAR code shouldn't be interrupted by 
an interrupt, otherwise it would completely mess up the state of the 
KS8851 MAC. The spinlock does not protect only the IRQ handler, it 
protects also ks8851_start_xmit_par() and ks8851_write_mac_addr() and 
ks8851_read_mac_addr() and ks8851_net_open() and ks8851_net_stop() and 
other sites which call ks8851_lock()/ks8851_unlock() which cannot be 
executed concurrently, but where BHs can be enabled.

> ? This seems to be used by
> the _par driver and the _common part. The comments refer to DMA but I
> see only FIFO access.

The KS8851 does its own internal DMA into the SRAM, from which the data 
are copied by the driver into system DRAM.

> And while at it, I would recommend to
> 
> diff --git a/drivers/net/ethernet/micrel/ks8851_common.c b/drivers/net/ethernet/micrel/ks8851_common.c
> index 8048770958d60..f1c662887646c 100644
> --- a/drivers/net/ethernet/micrel/ks8851_common.c
> +++ b/drivers/net/ethernet/micrel/ks8851_common.c
> @@ -378,9 +378,12 @@ static irqreturn_t ks8851_irq(int irq, void *_ks)
>   	if (status & IRQ_LCI)
>   		mii_check_link(&ks->mii);
>   
> -	if (status & IRQ_RXI)
> +	if (status & IRQ_RXI) {
> +		local_bh_disable();
>   		while ((skb = __skb_dequeue(&rxq)))
>   			netif_rx(skb);
> +		local_bh_enable();
> +	}
>   
>   	return IRQ_HANDLED;
>   }
> 
> Because otherwise it will kick-off backlog NAPI after every packet if
> multiple packets are available.
I think this patch will do the same, but the above should be done for 
the SPI part ?

  reply	other threads:[~2026-04-13 15:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-08 16:24 [net,PATCH v2] net: ks8851: Reinstate disabling of BHs around IRQ handler Marek Vasut
2026-04-09  6:52 ` Nicolai Buchwitz
2026-04-09 15:26   ` Marek Vasut
2026-04-10  7:29     ` Nicolai Buchwitz
2026-04-12 16:01 ` Jakub Kicinski
2026-04-12 16:27   ` Marek Vasut
2026-04-12 17:51     ` Jakub Kicinski
2026-04-13 12:57       ` Sebastian Andrzej Siewior
2026-04-13 15:31         ` Marek Vasut [this message]
2026-04-13 16:03           ` Sebastian Andrzej Siewior
2026-04-14  8:55             ` Sebastian Andrzej Siewior
2026-04-14 10:26               ` Marek Vasut
2026-04-13 15:44         ` Jakub Kicinski
2026-04-13 16:10           ` Sebastian Andrzej Siewior
2026-04-14 10:07             ` Marek Vasut
2026-04-14 10:48       ` Sebastian Andrzej Siewior

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=16fdeec9-9208-4c9b-b228-d6c6e045e116@nabladev.com \
    --to=marex@nabladev.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bigeasy@linutronix.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nb@tipi-net.de \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=ronald.wahl@raritan.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox