Re: [PATCH net-next v8 1/2] net: dsa: qca8k: let regmap serialize register access
From: Yongzhao Chen
Date: Fri Nov 06 2026 - 17:54:21 EST
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