mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Yongzhao Chen <yongzhao.derek@gmail.com>
To: Christian Marangi <ansuelsmth@gmail.com>
Cc: Andrew Lunn <andrew@lunn.ch>, Stanislaw Pal <kuncy7@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>
Subject: Re: [PATCH net-next v8 1/2] net: dsa: qca8k: let regmap serialize register access
Date: Fri,  6 Nov 2026 23:54:02 +0100	[thread overview]
Message-ID: <20261106225403.272212-1-yongzhao.derek@gmail.com> (raw)
In-Reply-To: <6aee175b.f01aa0c8.37eba4.18ea@mx.google.com>

Hi Ansuel,

On Fri, Nov 06, 2026 at 07:07:19PM +0100, Christian Marangi wrote:
> 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...

Stanislaw has walked through the regmap path. I can add a reproduction
of it in which the two accesses read different registers.

It is a local KUnit test on UML. It builds qca8k-8xxx.c with the real
regmap_config, register callbacks, PCS and MTU code against the real
regmap core; only the MDIO bus below the driver is a fake register
file. The test stops one access inside its MDIO read and resumes it
once a second access has started and blocked, so the second access runs
between the first one's ->read() callback and its parse_val().

With two qca8k_pcs_get_state() calls, for port 6 and port 0, each
reading its own PORT_STATUS register, port 6 returns port 0's link
state. Separate registers do not help, because both reads format the
register and return the value through the one map->work_buf.

A second case runs the MTU code against a PCS poll. The PORT_STATUS
value that 2/2 saves is replaced, and MAX_FRAME_SIZE is written while a
CPU MAC is enabled. 2/2 relies on 1/2 for this, because readers such as
the PCS poll do not take its new mutex.

On net-next, both cases fail with only 2/2 applied and pass with 1/2
added.

The limits: the test forces the interleaving (a gate in the fake bus
and a SCHED_FIFO thread on a single-CPU UML kernel), it covers only the
MDIO path, not the management frames, and I have not seen the
corruption on hardware. The test calls qca8k_pcs_get_state() directly,
so it does not show that two PCS polls meet on a given board; the
callers that can meet without rtnl are the ones Stanislaw listed.

The test is not part of the series. I can post it if that helps.

If this answers what the patch fixes, I would keep 1/2 as is in v9 and
add the two-reader case to its commit message. Would you rather see a
different fix?

Thanks,
Yongzhao Chen

  parent reply	other threads:[~2026-11-06 22:54 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
2026-11-06 20:36       ` Stanislaw Pal
2026-11-06 22:54       ` Yongzhao Chen [this message]
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=20261106225403.272212-1-yongzhao.derek@gmail.com \
    --to=yongzhao.derek@gmail.com \
    --cc=andrew@lunn.ch \
    --cc=ansuelsmth@gmail.com \
    --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 \
    /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®