🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12354

Re: [PATCH net-next v8 1/2] net: dsa: qca8k: let regmap serialize register access

#12354
From: Yongzhao Chen
Date: Fri, 06 Nov 2026 22:54
48 lines
13621 bytes
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
Technical Details
Message-ID: <20261106225403.272212-1-yongzhao.derek@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358212-linux-kernel-netdev=dewy.ru
References: <20261104120130.48455-1-yongzhao.derek@gmail.com> <20261104120130.48455-2-yongzhao.derek@gmail.com> <6aca850a-ef67-4451-aaf2-977be884d1b0@lunn.ch> <6aee175b.f01aa0c8.37eba4.18ea@mx.google.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358212-linux-kernel-netdev=dewy.ru
From: yongzhao.derek@gmail.com (Yongzhao Chen)
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <20261106225403.272212-1-yongzhao.derek@gmail.com>
References: <20261104120130.48455-1-yongzhao.derek@gmail.com>
 <20261104120130.48455-2-yongzhao.derek@gmail.com>
 <6aca850a-ef67-4451-aaf2-977be884d1b0@lunn.ch>
 <6aee175b.f01aa0c8.37eba4.18ea@mx.google.com>
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="3995694"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:QfFU9YVg8vV5SbNgZ8SNoNNKCHE= sha256:8IPnvtQnOFleSNxyfod95+pirSTJGbXXAA7v2Fdug9c=
	sha1:9gSWISD1xPr579No679ALZ9gMrU= sha256:tCR5BPh9YFucxMQOEriwu5Dc20Wm/M9LK3ttDinPDS8=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 9434D11336B; Sat,  7 Nov 2026 01:54:56 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id LwMjgIJKJpgu;
	Sat,  7 Nov 2026 01:54:51 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-358212-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 39E0E113368; Sat,  7 Nov 2026 01:54:42 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 2AD2F2FCC6; Fri,  6 Nov 2026 22:54:16 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794005656;
	b=33DscAZVXH3bo/w8PvdLXmDNny+MqAOtGJ13PKk5svlR+/NH4ajwejPpEFetXBC/l3Gh
	 V+CFNEPayhAzm+Br72VqCv9eXBrPrgBGNub4OnPhRLlglsgZWI9/Ou7JaIwl02krnF/vc
	 QGFD2+BuSqsbp6eb2kBaf35Jtnt0CLItCBwk7GBZUMuEiY9tcUVViEtp6ZpecCHp8a2B7
	 Akw/4H/G0fh2qwR2xvAMZ0pIKNU2Fuuv02lzP425Raj6UYuR0fk2IHMoyQ6HqoFQRHF6f
	 1iAjyg50XJMvlSiynFWHV0cw/CCPHGWgvdcgaiHaKPA25cjdYTuCx5LKdRtpjC9OjwQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794005656;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
	 X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:Date:Message-ID:
	 X-Mailer:In-Reply-To:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Transfer-Encoding;
	bh=fbPspms2sS3O5/nUsYayzrSPxne2ni7ynNvNA4DD4fo=;
	b=nWFRRkNWpTLdChAlOxEc6ODZoycKpRwVXlbuH4zodJVPB/X7tK4EJQS99ttE0i30q31i
	 NrC/CDi5qfLMkpuLC6aBBWkUlvA6Md42wTG2W3ORy+SIM2f7Yh7mD583nyGJwH4IvoFw6
	 9yRy/3Ny9aqEfXSBUdFpH8H+WQ93d2YSV/39BaqciBhzMWS5gto6DUqMedE0zmkLMgAeu
	 pNELgZbcn+1W4QVPcD4QCQmu+ojzXE1fzpwrDtR8X9ZIgvDZHeRPOI8FQZ8mnIh8+nYJq
	 cVwSNA+AdPkhQBOFsaTnOU1n0OpHZfSncZJYnZaxpamAiHinTxU9W/f/T90uvoTHDMw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=0M7AHNmA;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id DECA6606A333;
	Fri,  6 Nov 2026 22:54:15 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=0M7AHNmA
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.47
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794005650;
	b=AMO2PIsItwWr7juTwFJ+w/Klk4zoW1lM0AGY7tu6nd0D+zi+DTe1M/F+O+zM8RelBZEZ
	 yv9guJAdrL+0xBkOPrXAxMs7vacAP9p3ZhOuECV8lFBej8UBbRqFKa7jsnrpjpwKGflNC
	 683ZsIcwUbllZ5iarA2AthRjHtqvda2n+CzmON0HJVAiM2LE9yoLq62hk0eETiXnaeHU6
	 DHZHzP5AVHnn+91Tl8lU1Fiw9dzrYvoMeKxGytVcciDLeBNkn4zFlZUBD5jU2CtXW4osx
	 NQztTCaNAmF6re0VkY4TcxD3XUZbxbBhKSBrGWLU8oIYNyg4CcZJhwXM6fUYAQSzFdg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794005650;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
	 From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:
	 MIME-Version:Content-Transfer-Encoding;
	bh=fbPspms2sS3O5/nUsYayzrSPxne2ni7ynNvNA4DD4fo=;
	b=CFMHFfuWeoJMrTtMU36u/DX2VCcnHXuib4WlOLogwDcYHWZKTFZAcbBoMJUf/RyquNH/
	 HMofc8YVrq0I58V9jQnlRVGsToN5HPnhhZ+0wPcMqBMcVuUxBq5BzqLxwrIq8pCCd6ZMC
	 UPALbZbi3qKZs8C0YlZBox3VNTfkmvgRm1NklFFYtDM42jysTJ5ZGNuNpexQutAUboikk
	 3ehFIbuI1jCCP1sIHXJY5o7dcyCBoK0h/elYRQI+K8e7ETql52viUV930ZIYee8TlRm40
	 LpfrcAjTJBnwMkhS2oFNOKu/wLYIR5U6k7kAveZ4P9BDQexvwq2EVWUDmPoCu6pz2+w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=0M7AHNmA;
	arc=none smtp.remote-ip=209.85.208.47
X-Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id A735D606A326
	for <netdev@vger.kernel.org>; Fri,  6 Nov 2026 22:54:09 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A735D606A326
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-6b1b13e09ffso1424320a12.3
        for <netdev@vger.kernel.org>; Fri, 06 Nov 2026 14:54:09 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1794005648; x=1794610448; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=fbPspms2sS3O5/nUsYayzrSPxne2ni7ynNvNA4DD4fo=;
        b=0M7AHNmAt0fUBLx8XdzysHSARdvqRt9HK0sAIYFVEZW4+8tfz+wB4r1CWNhp87oKnb
         H8xiX8SNlsxG1iWOQCqbnu12N51XMnkNrw3H2fd9fMY/3HUvpUv/afJ6UnjUP1emVk/f
         HKmLzR6g9vzac1S660i6wJot727gk/SKnPKDLspcMM6+zTNeB01Yhi3N+J84GQLIFGkG
         XCe7A4UY2gW7be/cx/7RQyiaGWZ8cwezd30gp9i03f7lD3mKIEvHq7+owprtxJqH0Zv8
         IHKiw6uNfjUWH1fpmNZC2STvlbv2j90un6HauQeqbzpGfl/S63fT2x5kbXrG8Gbltw1k
         HOpg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1794005648; x=1794610448;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=fbPspms2sS3O5/nUsYayzrSPxne2ni7ynNvNA4DD4fo=;
        b=Cb2dMi2HN0wjQ8d9SDDyDmvlYilQ9Ejsx7nvVWWQuKhpMEvW1XNE2rnAHJ5dciB95z
         9sOth7v4nEinDNAIBIVqQ0/xxKxjSV1eJfphihVTbpV3qnVnKAGmo86coHUpTMwbiQNW
         +eZvvWfL6n8loUMxwM3abVeqeXulIQjLZVzm9ZQiqelicUt2kf9gkyKni3CJfDhD8vz8
         kxWmGMbm1vCmhOHyOqdZ9lkI3G9wWyX2x8qclsF9d2QmFXQguGFRbmKi2CLmDdHqpHe3
         B1mZU+2ee8m+ZfL43eBFr/GplTiJIfFIgdZSS7jJDUppehLn8vdJd6Sz0aMD48V8R8/N
         a8Jw==
X-Forwarded-Encrypted: i=1; AL+hErFkiwx22pB6Bq5f2nUXyc0kA7gu1B35O76EM4F613a0QMVs4MSFcjSql516w7NvLYV5EvWFvCw=@vger.kernel.org
X-Gm-Message-State: APuU4Z8SCPxF0EufmTHZGzg+PgQYcQjsTV5SnZYWTgPskHi3Nq5ZwHl1
	E6qa8HzOS6+K4mjB2Zof18sQ2Ofpe77sKRNiybA0NhGuIGVmPbiooxZb
X-Gm-Gg: AYBFou00hLshxXuV9Axgt9UkRuVi9vHB+/jl/hkdVFlmk69uyurTUBESKtq2kgxV6L6
	Z04xRFDwmFHD1HFgcQlltqcAAVeWWEJKDrJqkyp+ESwRZJfGr16aP43fdfhIAFvMP8175gWm7Ud
	VRiAnwWWKSr+xqBlKs0l4OMuIY88sIW2uQ/AjIEwQxsziki93A1XtAOLpd9AoWymu8iwSoarSNg
	Pe1s+B4Vjooezi2/OumH8WaPjqHGNTZxI2hx0N/kuYqeV3ufYClyj+rShhgHuwl7JLP9AUsgEQl
	m8tNsNBCpA28kvSH+TIxF3lcKf4x3wY4+jGMGV9rvaGnIafoXdWnpdDEhfuiwT+iRVAEWKtPXFo
	DC2Ri9/n/VX4w8/4Q/R4+itlayQT7rqOEzVzGXFbdmld2X+IVIDO5eJz++nTxlZalOiRUul7XUz
	ezq7osjWtipf/AKKwCdpsbVysNjWid2Dhkf1WMxLOMY6cNYFfNptkT79jRukiALGiPgtuvjRwaQ
	74DEMSEVkr/45EVc/e8xjkM14G17IbCX/qwtGE/znX+FM9dHY8oGYsEq/WfIjeRY0h3i06peq64
	9djPDMFndY3k5maxu2rFub4VmQBy27BtEIJFpK2amyAdQMrhhC4FEXOVTVTu8VDPW+JKlPJNkym
	3eaxzUxPTQkCO8tI23Yy32RGLUnrd/DjN7g==
X-Received: by 2002:a05:6402:5514:b0:6b5:8200:5008 with SMTP id 4fb4d7f45d1cf-6b597838b71mr2795992a12.45.1794005647881;
        Fri, 06 Nov 2026 14:54:07 -0800 (PST)
X-Received: from CCM-PC (83-233-221-133.cust.bredband2.com. [83.233.221.133])
        by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6b664b165e9sm1095181a12.29.2026.11.06.14.54.06
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Fri, 06 Nov 2026 14:54:07 -0800 (PST)
X-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>
X-Mailer: git-send-email 2.55.0.windows.5
X-In-Reply-To: <6aee175b.f01aa0c8.37eba4.18ea@mx.google.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list