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>
Cc: Jakub Kicinski <kuba@kernel.org>,
	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: Tue, 14 Apr 2026 12:26:41 +0200	[thread overview]
Message-ID: <a3a1333b-5b08-4f18-8bce-6d83408d915e@nabladev.com> (raw)
In-Reply-To: <20260414085556.SJSDwbpW@linutronix.de>

On 4/14/26 10:55 AM, Sebastian Andrzej Siewior wrote:
> On 2026-04-13 18:03:38 [+0200], To Marek Vasut wrote:
>> On 2026-04-13 17:31:34 [+0200], Marek Vasut wrote:
>>>> 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.
>>
>> I need check this once brain is at full power again. But which
>> interrupt? Your interrupt is threaded. So that should be okay.
> 
> I don't understand. There is no point in using spin_lock_irqsave() in
> ks8851_lock_par(). You don't protect against interrupts because none of
> the user actually run in an interrupt. As far as I can see, the
> interrupt is threaded and the mdio phy link checks should come from the
> workqueue.

Ha, now that the IRQ handler is indeed only threaded, I can use 
spin_lock_bh() indeed. I will send a V3 like that.

> What is wrong is that the ndo_start_xmit callback can be invoked from a
> softirq and such you must disable BHs while acquiring a lock which can
> be accessed from both contexts. Therefore spin_lock() is not sufficient,
> it needs the _bh() and _irq() brings no additional value here.

  reply	other threads:[~2026-04-14 10:26 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
2026-04-13 16:03           ` Sebastian Andrzej Siewior
2026-04-14  8:55             ` Sebastian Andrzej Siewior
2026-04-14 10:26               ` Marek Vasut [this message]
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=a3a1333b-5b08-4f18-8bce-6d83408d915e@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