Article View: linux.kernel.netdev
Article #13778RE: [PATCH net-next v1 1/3] r8169: make PHY OCP access safe in atomic context
From: Javen
Date: Tue, 10 Nov 2026 09:58
Date: Tue, 10 Nov 2026 09:58
31 lines
10811 bytes
10811 bytes
> >On Mon, Nov 09, 2026 at 10:30:20AM +0800, javen wrote: >> From: Javen Xu <javen_xu@realsil.com.cn> >> >> r8168_phy_ocp_read() and r8168_phy_ocp_write() wait for the GPHY_OCP >> handshake with rtl_loop_wait(), which may sleep (fsleep(25)). Upcoming >> PTP support for RTL8127A accesses the PTP block through the same PHY >> OCP interface from atomic context (spinlock held, NAPI RX path), and >> concurrently with phylib MDIO accesses. >> >> Busy-wait for the handshake with readl_poll_timeout_atomic() instead, >> keeping the previous maximum wait time of 250us, and serialize the >> GPHY_OCP register accesses with a new spinlock. > >There are many drivers which need to access PHY registers via blocking MDIO >accesses. Why is this driver different? In v1, RX timestamp was read in rtl_rx(), i.e. in NAPI context and tx is in ndo_start_xmit. Since neither of those fast-paths can sleep, I had to export the raw PHY OCP accessors and wrap them in a spinlock. I will try to move all the code to phy driver and all accesses will use phy_read_mmd()/phy_write_mmd() and will be serialized by a mutex. Thanks, Javen > > Andrew
Technical Details
Message-ID:
<b986c9c9f4b1407b99f62975885b73e6@realsil.com.cn>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360045-linux-kernel-netdev=dewy.ruReferences:
<20261109023022.770-1-javen_xu@realsil.com.cn> <20261109023022.770-2-javen_xu@realsil.com.cn> <7791e7b5-fdc8-4c8c-ab5b-dcc7d7a6506a@lunn.ch>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-360045-linux-kernel-netdev=dewy.ru From: javen_xu@realsil.com.cn (Javen) Newsgroups: linux.kernel.netdev Subject: RE: [PATCH net-next v1 1/3] r8169: make PHY OCP access safe in atomic context Date: Tue, 10 Nov 2026 09:58:22 +0000 Organization: Usenet Network Message-ID: <b986c9c9f4b1407b99f62975885b73e6@realsil.com.cn> References: <20261109023022.770-1-javen_xu@realsil.com.cn> <20261109023022.770-2-javen_xu@realsil.com.cn> <7791e7b5-fdc8-4c8c-ab5b-dcc7d7a6506a@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: usenet.network; logging-data="578911"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:E3nRlTLrGu34O7WyF++yhFeIl9k= sha256:2NO+bXZccJmDWhFS/VpRNROGl0+0+wk2IG2f9qsOoxQ= sha1:JzN3BXVckA8RmdKS2ouWdsX+MRE= sha256:CC1vu7LUqHZBvR5KOtwECXr+6YeP1T/2AgU+pogBXNY= Content-Language: zh-CN 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 F3D04113AE5; Tue, 10 Nov 2026 13:15:29 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.151 X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31 tests=[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 (2048-bit key) header.d=realsil.com.cn 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 7PBv2x9iqkaj; Tue, 10 Nov 2026 13:15:23 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-360045-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=realsil.com.cn X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74]) by mail.dewy.ru (Postfix) with ESMTPS id C1D59113A82; Tue, 10 Nov 2026 13:15:14 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sto.lore.kernel.org (Postfix) with ESMTP id 0E57C681BE6; Tue, 10 Nov 2026 09:59:59 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail; t=1794304750; b=2joUtZEpsDFp4sn9Yqb/UYjFOnG1+e/uuEIrqULI6FduHFHfZi7toyThEyuArz3HuOH4 qU8M1y/6J+QJyoDOGGK5gr2BGmYWVdSaulOvPb2iqUqQgnHGIbh3UCtjClpKeIbjyL22D wm6/7yBOw8ZwdxRF/cf7YpvYiHLcmE9WzwQ3GDAl24m+oX26KceiFutRiwfSfBaCTSHBp 7M1+X9EJxSg3w/tbgWgS7lK+dR5gzVIiONMp+PIglZp+zD/yhXjOoqQQ6K7NczWnKvT+g D6lqHX8kUJTnQQKyeaxz2sWLYtRxdZ3Dyp0ENhZtnVAN4Oh6FXZ8Z13ZTjaVlP+gISA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794304750; h=X-Original-To:Received:DMARC-Filter:X-SpamFilter-By:DKIM-Signature: Received:Received:Received:From:To:CC:Subject:Thread-Topic: Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language: Content-Language:Content-Type:Content-Transfer-Encoding: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version; bh=oS004R4Q/p4GtJUctdLJ+apSKurv7OcxpF2uLd03vYs=; b=flN57q/jgFsKuaOEJfcR5XzEVDm1gvvYIlIe8aTji/MohWdZo5KzJJRKfIV0Znv9AsBn DaVSCv6gEkCXYUqyLsYoHtoWU8ZsQGGPWEObsQ8bufkUgcQgqsi/wFrcRa4vSHsiVvEiS Eiq8i51FoSNDHamkiExi/MvMJaIWfzfQnQX4TlB3BrUJ2IA8wRUJcKYtZUlnEg/8R5eNs OUAIPEtKfLQPNon+RDgdX1XuELV7NYHF5SwmV4j1bSOWu61AQmWMHNePFd3oYJE6V23SQ J1T5dgKrhX3A74SvFxiofrj5NgGhNKhgkSWEDh6KF6HthPngTNmuwta/3Q765yCGj7g== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=realsil.com.cn header.i=@realsil.com.cn header.a=rsa-sha256 header.s=dkim header.b=H7OYMvPt; dmarc=pass header.from=realsil.com.cn; spf=pass smtp.mailfrom=realsil.com.cn; arc=fail 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 B44E2606A330; Tue, 10 Nov 2026 09:59:10 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=realsil.com.cn header.i=@realsil.com.cn header.a=rsa-sha256 header.s=dkim header.b=H7OYMvPt X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=211.75.126.72 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794304744; b=ZAGI53vsUTC95MGNVGwDBL75RZupYR8aWUBHUaqCK6wX2Y2wPbXvyoD2FdRDI06AO+qp MUOU/vgFaug7k6KC8OW0FG9Jc7kezvk+eDHgTu0PJTC2+oWc4Xff/ZdZQ+vLgT5pW9s+J XlCyub91sAYgZCLn98YLX/S8rb54hhxcVLsAW1yEo7w3oR0VJ/foSkM2gd+bVEX5qcBl3 pHsyQhADajcWxqn2PbOiKZ/ZGPqVsZmZ+XtC8ZY56pxUIMdWGwatZak0dmEx6Irfh4ETD sS3Ol5MqdPPDLtW+H7PLkuzAZtrZChAWhOEuw2POsdcnt4YNWA4Ewj6QUv1SQGQNfFw== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794304744; h=DMARC-Filter:X-SpamFilter-By:DKIM-Signature:Received:Received: Received:From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID: References:In-Reply-To:Accept-Language:Content-Language: x-originating-ip:Content-Type:Content-Transfer-Encoding:MIME-Version; bh=oS004R4Q/p4GtJUctdLJ+apSKurv7OcxpF2uLd03vYs=; b=klHgM+pYC+wWtUvsDyS0PJBm6vvFsPSkDwd16t+nn+BIhjCN38ufpW9UVzZRuMiiE9OJ +Ql6ttfwPif4PHOWHGhfNBMsPKGiTg1vzD4fHsL9MBzcbgEQlPu22SnmoElUBX7qkUyB/ EV1WkadSA9fsTqR/V31zMrTNsJyOydAdiyGwxpTVSpUmMQmjzSimROVkZhOpD2KwBi4Rf xQwnARruBfy2ZRWow0nmOyLOKwWr8ffvhHHgs5rBBOCvYiQkzbICsuh/AMk6BLp0Bgzre 9ViwM+v2iKFX2ZmAkAy7YRsDAn/zlkYGAo7dR/dbx3zYH/fpXWGy3LMJEWIwNJ4+6yg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=realsil.com.cn; spf=pass smtp.mailfrom=realsil.com.cn; dkim=pass header.d=realsil.com.cn header.i=@realsil.com.cn header.a=rsa-sha256 header.s=dkim header.b=H7OYMvPt; arc=none smtp.remote-ip=211.75.126.72 X-Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6244B606A325; Tue, 10 Nov 2026 09:59:01 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6244B606A325 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=realsil.com.cn X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=realsil.com.cn X-SpamFilter-By: ArmorX SpamTrap 5.80 with qID 6AA9wLtU51227499, This message is accepted by code: ctloc85258 X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=realsil.com.cn; s=dkim; t=1794304702; bh=oS004R4Q/p4GtJUctdLJ+apSKurv7OcxpF2uLd03vYs=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:Content-Transfer-Encoding:MIME-Version; b=H7OYMvPtEQwelq4oV/ukBmax69NFK/5CVHXvZ65VWQxdnVcZau8HIcaBk7KLiWnU0 LM0gHWZSBdWCK3bi3Bgs1sc7/0k+YjJR0lipFXzdTo4TCC++onU4SM4P3323EaWXEs A1WFd0N7HrPyRsuS9cKvZkJ/nmzHuB+MOs3j7NjHy8vNtfR6IbmUrw+nQLd0wkvud+ HYHsSdr2mWGy+bYgwu+V0UGwWn07aDqSFAD6HNhKOp+z5h8XjMhq4DS7KdPF7fYdbP Jth5JEIPOCMkCoQxRaft7ncYGv0KACZF45REnyfnj+wTdC+lVeT5FVBsL3JuxNehpQ MmTZYCRrf77Xg== X-Received: from RS-EX-MBS1.realsil.com.cn ([172.29.17.101]) by rtits2.realtek.com.tw (8.15.2/3.29/5.94) with ESMTPS id 6AA9wLtU51227499 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 10 Nov 2026 17:58:22 +0800 X-Received: from RS-EX-MBS3.realsil.com.cn (172.29.17.103) by RS-EX-MBS1.realsil.com.cn (172.29.17.101) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Tue, 10 Nov 2026 17:58:22 +0800 X-Received: from RS-EX-MBS3.realsil.com.cn ([172.29.17.103]) by RS-EX-MBS3.realsil.com.cn ([172.29.17.103]) with mapi id 15.02.2562.056; Tue, 10 Nov 2026 17:58:22 +0800 X-CC: "hkallweit1@gmail.com" <hkallweit1@gmail.com>, "nic_swsd@realtek.com" <nic_swsd@realtek.com>, "andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>, "davem@davemloft.net" <davem@davemloft.net>, "edumazet@google.com" <edumazet@google.com>, "kuba@kernel.org" <kuba@kernel.org>, "pabeni@redhat.com" <pabeni@redhat.com>, "horms@kernel.org" <horms@kernel.org>, "netdev@vger.kernel.org" <netdev@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org> X-Thread-Topic: [PATCH net-next v1 1/3] r8169: make PHY OCP access safe in atomic context X-Thread-Index: AQHdb/JH1RCIF5rgLEGFx9BLgCKrZrclsS4AgAFgmNA= X-In-Reply-To: <7791e7b5-fdc8-4c8c-ab5b-dcc7d7a6506a@lunn.ch> X-Accept-Language: zh-CN, en-US 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