From: Christian Marangi <ansuelsmth@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Yongzhao Chen <yongzhao.derek@gmail.com>,
netdev@vger.kernel.org, Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Russell King <linux@armlinux.org.uk>,
Florian Fainelli <florian.fainelli@broadcom.com>,
linux-kernel@vger.kernel.org, Ziyang Huang <hzyitc@outlook.com>,
Stanislaw Pal <kuncy7@gmail.com>
Subject: Re: [PATCH net-next v8 1/2] net: dsa: qca8k: let regmap serialize register access
Date: Fri, 6 Nov 2026 19:07:19 +0100 [thread overview]
Message-ID: <6aee175b.f01aa0c8.37eba4.18ea@mx.google.com> (raw)
In-Reply-To: <6aca850a-ef67-4451-aaf2-977be884d1b0@lunn.ch>
On Fri, Nov 06, 2026 at 02:38:37PM +0100, Andrew Lunn wrote:
> On Wed, Nov 04, 2026 at 01:01:28PM +0100, Yongzhao Chen wrote:
> > From: Stanislaw Pal <kuncy7@gmail.com>
> >
> > The regmap is created with .disable_locking, on the ground that the
> > qca8k read and write callbacks do their own locking. They only lock the
> > bus transaction, though. Since the driver moved to the regmap
> > read/write API, regmap formats the register and parses the value in the
> > map's shared work_buf, outside of the callbacks, so two concurrent
> > users can swap or corrupt each other's register and value.
> >
> > Most register access runs under rtnl, but not all of it: phylink's
> > resolve work (mac_link_up/down) and the LED class callbacks do not, so
> > a link change can race with an ethtool or LED access and write the
> > wrong switch register or read back the wrong value.
>
> Do any of these operations which don't take RTNL do an open coded
> read/modify/write? Does the regmap read/modify/write operations hold
> the regmap mutex over the entire operation?
>
Maybe I'm just tired from destroying board from my HW project but... I'm a
bit confused of when read/write are not serialized.
Operation of the LED and on the port have their own dedicated register per
port and for shared stuff, there is a dedicated mutex for it.
So I'm not sure what case this patch is fixing...
Both mgmt and mdio operation locks at the start and unlock at the end of
the read/write or rmw operation.
Using the regmap lock seems redundant and this is why I disabled
originally.
I would like to have more explaination for the
"regmap formats the register and parses the value in the
map's shared work_buf, outside of the callbacks, so two concurrent
users can swap or corrupt each other's register and value."
case.
--
Ansuel
next prev parent reply other threads:[~2026-11-06 18:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 12:01 [PATCH net-next v8 0/2] net: dsa: qca8k: preserve port state across MTU changes Yongzhao Chen
2026-11-04 12:01 ` [PATCH net-next v8 1/2] net: dsa: qca8k: let regmap serialize register access Yongzhao Chen
2026-11-06 13:38 ` Andrew Lunn
2026-11-06 18:07 ` Christian Marangi [this message]
2026-11-06 20:36 ` Stanislaw Pal
2026-11-06 22:54 ` Yongzhao Chen
2026-11-04 12:01 ` [PATCH net-next v8 2/2] net: dsa: qca8k: preserve port state across MTU changes Yongzhao Chen
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=6aee175b.f01aa0c8.37eba4.18ea@mx.google.com \
--to=ansuelsmth@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=florian.fainelli@broadcom.com \
--cc=horms@kernel.org \
--cc=hzyitc@outlook.com \
--cc=kuba@kernel.org \
--cc=kuncy7@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=pabeni@redhat.com \
--cc=yongzhao.derek@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
all inboxes | Powered by JetHome®