mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kory Maincent <kory.maincent@bootlin.com>
To: Claudiu Beznea <claudiu.beznea@tuxon.dev>
Cc: Florian Fainelli <florian.fainelli@broadcom.com>,
	Broadcom internal kernel review list
	<bcm-kernel-feedback-list@broadcom.com>,
	Andrew Lunn <andrew@lunn.ch>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Richard Cochran <richardcochran@gmail.com>,
	Radu Pirea <radu-nicolae.pirea@oss.nxp.com>,
	Jay Vosburgh <j.vosburgh@gmail.com>,
	Andy Gospodarek <andy@greyhouse.net>,
	Nicolas Ferre <nicolas.ferre@microchip.com>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Jonathan Corbet <corbet@lwn.net>,
	Horatiu Vultur <horatiu.vultur@microchip.com>,
	UNGLinuxDriver@microchip.com, Simon Horman <horms@kernel.org>,
	Vladimir Oltean <vladimir.oltean@nxp.com>,
	donald.hunter@gmail.com, danieller@nvidia.com,
	ecree.xilinx@gmail.com, Andrew Lunn <andrew+netdev@lunn.ch>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	linux-doc@vger.kernel.org,
	Maxime Chevallier <maxime.chevallier@bootlin.com>,
	Rahul Rameshbabu <rrameshbabu@nvidia.com>,
	Willem de Bruijn <willemb@google.com>,
	Shannon Nelson <shannon.nelson@amd.com>,
	Alexandra Winter <wintera@linux.ibm.com>
Subject: Re: [PATCH net-next v21 3/5] net: Add the possibility to support a selected hwtstamp in netdevice
Date: Fri, 17 Jan 2025 13:06:56 +0100	[thread overview]
Message-ID: <20250117130656.23a41605@kmaincent-XPS-13-7390> (raw)
In-Reply-To: <4c6419d8-c06b-495c-b987-d66c2e1ff848@tuxon.dev>

On Fri, 17 Jan 2025 13:57:41 +0200
Claudiu Beznea <claudiu.beznea@tuxon.dev> wrote:

> Hi, Kory,
> 
> On 12.12.2024 19:06, Kory Maincent wrote:
> > Introduce the description of a hwtstamp provider, mainly defined with a
> > the hwtstamp source and the phydev pointer.
> > 
> > Add a hwtstamp provider description within the netdev structure to
> > allow saving the hwtstamp we want to use. This prepares for future
> > support of an ethtool netlink command to select the desired hwtstamp
> > provider. By default, the old API that does not support hwtstamp
> > selectability is used, meaning the hwtstamp provider pointer is unset.
> > 
> > Signed-off-by: Kory Maincent <kory.maincent@bootlin.com>  
> 
> I'm getting this error when doing suspend/resume on the Renesas RZ/G3S
> Smarc Module + RZ SMARC Carrier II board:
> 
> [   39.032969] =============================
> [   39.032983] WARNING: suspicious RCU usage
> [   39.033000] 6.13.0-rc7-next-20250116-arm64-renesas-00002-g35245dfdc62c
> #7 Not tainted
> [   39.033019] -----------------------------
> [   39.033033] drivers/net/phy/phy_device.c:2004 suspicious
> rcu_dereference_protected() usage!

Thanks for the report.
Oh so it seems there are cases where phy_detach is not called under RTNL lock!

This should solve the issue:
-               hwprov = rtnl_dereference(dev->hwprov);
+               rcu_read_lock()
+               hwprov = rcu_dereference(dev->hwprov);
                /* Disable timestamp if it is the one selected */
                if (hwprov && hwprov->phydev == phydev) {
                        rcu_assign_pointer(dev->hwprov, NULL);
                        kfree_rcu(hwprov, rcu_head);
                }
+               rcu_read_unlock();

I will send a patch soon.

Regards,
-- 
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com

  reply	other threads:[~2025-01-17 12:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12 17:06 [PATCH net-next v21 0/5] net: Make timestamping selectable Kory Maincent
2024-12-12 17:06 ` [PATCH net-next v21 1/5] net: Make dev_get_hwtstamp_phylib accessible Kory Maincent
2024-12-12 17:06 ` [PATCH net-next v21 2/5] net: Make net_hwtstamp_validate accessible Kory Maincent
2024-12-12 17:06 ` [PATCH net-next v21 3/5] net: Add the possibility to support a selected hwtstamp in netdevice Kory Maincent
2025-01-17 11:57   ` Claudiu Beznea
2025-01-17 12:06     ` Kory Maincent [this message]
2025-01-17 12:19       ` Claudiu Beznea
2024-12-12 17:06 ` [PATCH net-next v21 4/5] net: ethtool: tsinfo: Enhance tsinfo to support several hwtstamp by net topology Kory Maincent
2024-12-12 17:06 ` [PATCH net-next v21 5/5] net: ethtool: Add support for tsconfig command to get/set hwtstamp config Kory Maincent
2024-12-16 13:00 ` [PATCH net-next v21 0/5] net: Make timestamping selectable patchwork-bot+netdevbpf

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=20250117130656.23a41605@kmaincent-XPS-13-7390 \
    --to=kory.maincent@bootlin.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=andy@greyhouse.net \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=claudiu.beznea@tuxon.dev \
    --cc=corbet@lwn.net \
    --cc=danieller@nvidia.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@google.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=hkallweit1@gmail.com \
    --cc=horatiu.vultur@microchip.com \
    --cc=horms@kernel.org \
    --cc=j.vosburgh@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=maxime.chevallier@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas.ferre@microchip.com \
    --cc=pabeni@redhat.com \
    --cc=radu-nicolae.pirea@oss.nxp.com \
    --cc=richardcochran@gmail.com \
    --cc=rrameshbabu@nvidia.com \
    --cc=shannon.nelson@amd.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=willemb@google.com \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=wintera@linux.ibm.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®