🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12198

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

#12198
From: Andrew Lunn
Date: Fri, 06 Nov 2026 13:38
21 lines
9450 bytes
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?

	Andrew
Technical Details
Message-ID: <6aca850a-ef67-4451-aaf2-977be884d1b0@lunn.ch>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358018-linux-kernel-netdev=dewy.ru
References: <20261104120130.48455-1-yongzhao.derek@gmail.com> <20261104120130.48455-2-yongzhao.derek@gmail.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-358018-linux-kernel-netdev=dewy.ru
From: andrew@lunn.ch (Andrew Lunn)
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 14:38:37 +0100
Organization: Usenet Network
Message-ID: <6aca850a-ef67-4451-aaf2-977be884d1b0@lunn.ch>
References: <20261104120130.48455-1-yongzhao.derek@gmail.com>
 <20261104120130.48455-2-yongzhao.derek@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="3891283"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:vqSOr3N3dzy/sJwtmwjvLv1ozrk= sha256:weeRmnj1LyJjkuXwW7hX7rWfwDRPR/oP1A+9JzU0/7o=
	sha1:XQ+x4YBhvqDAvzoqmQXnzcQcgwk= sha256:bcHqUZqURoEI2EzC8/FfMO6S3G0wpcnf9+srmc/BxIo=
Content-Disposition: inline
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 BF675113271; Fri,  6 Nov 2026 16:43:32 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 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, 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 (1024-bit key)
	header.d=lunn.ch
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 ee6HuFTNoGDD;
	Fri,  6 Nov 2026 16:43:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-358018-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 6102411326E; Fri,  6 Nov 2026 16:43:19 +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 B09B92BF0B; Fri,  6 Nov 2026 13:38:58 +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=1793972338;
	b=1IFLxijwCrMeDh3LMFWtU7PpBxL6YrgqfQblj6WB1+PZDELLfRBvOrd2Bhfe6JAV+JU/
	 sdNs6P81ukenSJZortClAZ42NhduGtwrpvz7GbDBINhI869uSwnGEfq0OoA9gW9BewCy4
	 Zqjz/VUyAsTvujP1wX+0opxfEC1kfRHh/81jwPLUCIOx8V4Jb6DSWtL21t7dF6V8nnfy+
	 0ehyidaJJK1NTGMCoG2Joe1Cd7lp66BQWy+kE9IRD/YtrUQDbi3IRnRlLncjiGmgAFb/F
	 dLCxqgxjXh6bUP4/BgGhbaVlAdxHMkPtq6W7KABzcadQsk0gr5S5hBDY1emSkGnQxwA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793972338;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date:
	 From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=yYW2PSaeeOYaOaP10pZyE3iM+rRN0qk/qtsLIw/0pRQ=;
	b=o7SkkPut8unrrHV6V/0Jnu4E9lkq0v9muRBNPhJkdnYX6FmDeZLBOu5qbWmsNY45Gnx1
	 t1DoNejVvuHlNME+PA8mBgtG1gkEktxdwLwgeJ+MFicvjPEnIzqriAxcTxXOfhs8rb7ew
	 OmlnWQ7zq+pOAlmW4w490CcuICCY94pWTPJjdkOswj4QIXuH7hl68bgS3rqO1jKbWWQmP
	 hTR3OvQL7hDagIrJXxWzHLEjph/UBlDL2rgSe+FDmjyRrEzU+hOhuUIGlcYinbASJOir+
	 FwnbZoSqMquTuV4Hoa6Pc3LLVm9PR62/lGaEPjKymx45GEu06pCdmdBBM12tcBlvjow==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=IiQZmQbS;
	dmarc=pass header.from=lunn.ch;
	spf=pass smtp.mailfrom=lunn.ch;
	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 3D546606A332;
	Fri,  6 Nov 2026 13:38:58 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=IiQZmQbS
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793972328;
	b=bMpTaQRR4B0jBZCbEtiU2nW5kTjbXKbc210+GcMzy9JH/UU4my7obF3AisPTcvhAGAgw
	 4gH3l0trddEA17WCu6n+Z6KjGA34eTd0IPH/O5zsglUJPO8hOecp7T3VkWtjyxHoD2nE8
	 M2+gH2+K5BRFvx2UgaG6uYmFMsVJsTLXv2HmPmn0Ekd7hgP9FbwKHC4G8Z9NuZtaRT105
	 yDo3ZR0dzuz6x9n7N3Kkq42R3yISajegIMKt5AWOoxXKEZ7+GJzBCkE6bZDiQHpgqn1RY
	 3Ku/iBX020CEHUyyrE/Jo8SZ0CBEWCCYLkytVXADdOtq5j0hCDY6C+6PNaysJlNDTtw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793972328;
	h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject:
	 Message-ID:References:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To;
	bh=yYW2PSaeeOYaOaP10pZyE3iM+rRN0qk/qtsLIw/0pRQ=;
	b=FnV+g0gQOnTDeoFGaHWRhx6M6OKfFPosWWT5+ZLu4FsjC9RE8LaiKl4kxMTs8aTugn8W
	 7AQwPNTgSi2pE8kDnal2iWDaqGhPpe+KXhm60IcHTvQY8GTU/Oofj6R1mq3gkLp2yul7f
	 DzV5pYYCD9j68t/Sq78elG3bSrSdlapoPjxECEjw6SfusXnP0rmz/wWvrjNMLZm+FptxH
	 u8D3yGq/8bdA9NlcQDHXGgErPVFjZJ0LByMkTpqxOM4xGvjQup6El/FivUfnLzvmSvwTF
	 GtpehJqCL/TbFEf1ztmSnIW1R1ioqgM4LvdbdNhpyspXIb8+oBUlknLSv32auVIueHg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=lunn.ch;
	spf=pass smtp.mailfrom=lunn.ch;
	dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=IiQZmQbS;
	arc=none smtp.remote-ip=156.67.10.101
X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8F28E606A326;
	Fri,  6 Nov 2026 13:38:47 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8F28E606A326
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch
X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch;
	s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version:
	References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject:
	Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:
	Content-ID:Content-Description:Content-Disposition:In-Reply-To:References;
	bh=yYW2PSaeeOYaOaP10pZyE3iM+rRN0qk/qtsLIw/0pRQ=; b=IiQZmQbSiNataEC2O53kuECmZ1
	mW592GsHSYZXP0eU2CmMaABFhhe1oibOG2t7IzwhD2jNONWQLRf9jT2vTv/b+TqcouvggWZON0EiS
	Rvgam6teVku6UVrvA4Jkt9DJqeOFLQjJilt2AmjMHbXr71kHMPqr15k1cuqmxlF2fXKc=;
X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2)
	(envelope-from <andrew@lunn.ch>)
	id 1xPK9N-00EmAO-G0; Fri, 06 Nov 2026 14:38:37 +0100
X-Cc: netdev@vger.kernel.org, Christian Marangi <ansuelsmth@gmail.com>,
	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>
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
X-In-Reply-To: <20261104120130.48455-2-yongzhao.derek@gmail.com>