mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Igor Velkov <iav@iav.lv>
To: Andrew Lunn <andrew@lunn.ch>
Cc: "Heiner Kallweit" <hkallweit1@gmail.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	"Wei Fang" <wei.fang@nxp.com>,
	"Niklas Söderlund" <niklas.soderlund@ragnatech.se>,
	"Paul Barker" <paul@pbarker.dev>,
	"Florian Fainelli" <florian.fainelli@broadcom.com>,
	"Doug Berger" <opendmb@gmail.com>,
	"Thangaraj Samynathan" <Thangaraj.S@microchip.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Igor Velkov" <iav@iav.lv>
Subject: Re: [PATCH net v2 1/2] net: phy: move irq_suspended and irq_rerun out of the bitfield
Date: Mon, 26 Oct 2026 19:32:15 +0200	[thread overview]
Message-ID: <20261026-phylib-v2-lock-reply-1@iav.lv> (raw)
In-Reply-To: <b99454f1-9c3e-42eb-ad03-3941015879a2@lunn.ch>

On Mon, Oct 26, 2026, Andrew Lunn wrote:
> As you say, it is an IRQ thread. Because interrupt handlers might need
> to access the PHY, which is a blocking operation,
> request_threaded_irq() is used in phy_request_interrupt(). So you can
> just take the mutex and make the RMW thread atomic.

The lock in phy_interrupt() only orders against writers that hold it.
phy_suspend() writes wol_enabled and suspended unlocked, e.g. from
phy_stop() in the MAC's suspend while the link-down interrupt may set
irq_rerun, and it cannot take the lock: phy_may_wakeup() can call
phy_ethtool_get_wol(), which takes it. mdio_bus_phy_suspend() and
phy_config_interrupt() write that word unlocked too. As bools,
irq_suspended and irq_rerun share it with none of them.
Would you still prefer the lock?

  reply	other threads:[~2026-10-26 17:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26  4:53 [PATCH net v2 0/2] net: phy: postpone PHY interrupts during sleep with MAC-managed PM Igor Velkov
2026-10-26  4:53 ` [PATCH net v2 1/2] net: phy: move irq_suspended and irq_rerun out of the bitfield Igor Velkov
2026-10-26 12:54   ` Andrew Lunn
2026-10-26 17:32     ` Igor Velkov [this message]
2026-10-26  4:53 ` [PATCH net v2 2/2] net: phy: postpone PHY interrupts during sleep with MAC-managed PM Igor Velkov

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=20261026-phylib-v2-lock-reply-1@iav.lv \
    --to=iav@iav.lv \
    --cc=Thangaraj.S@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=florian.fainelli@broadcom.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=lukas@wunner.de \
    --cc=netdev@vger.kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=opendmb@gmail.com \
    --cc=pabeni@redhat.com \
    --cc=paul@pbarker.dev \
    --cc=rafael.j.wysocki@intel.com \
    --cc=wei.fang@nxp.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

all inboxes | Powered by JetHome®