Article View: linux.kernel.netdev
Article #23263Re: [PATCH net 3/5] ice: ptp: serialize E825 PHY timer start with PTP lock and incval
From: netdev-bot+sashiko
Date: Thu, 26 Nov 2026 23:00
Date: Thu, 26 Nov 2026 23:00
164 lines
13686 bytes
13686 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The concern says the sentence 'The caller must acquire PTP
semaphore lock', which the patch adds after the Return: bullet list in…
Pre-existing issues:
- [Medium] At this commit, ice_capture_crosststamp() in
drivers/net/ethernet/intel/ice/ice_ptp.c writes the shared GLTSYN_CMD…
- [Medium] ice_start_phy_timer_e82x() in
drivers/net/ethernet/intel/ice/ice_ptp_hw.c repeats the unlocked…
- [Low] The kernel-doc Return list of ice_start_phy_timer_eth56g() in
drivers/net/ethernet/intel/ice/ice_ptp_hw.c (lines 2134-2136) has only…
--
ice: ptp: serialize E825 PHY timer start with PTP lock and incval
This patch holds the PTP hardware semaphore across the whole of
ice_start_phy_timer_eth56g(). It now covers the first GLTSYN_CMD write,
the incval read, the PHY incval init and the phase sync. The phase-sync
helper becomes ice_sync_phy_timer_eth56g_unlocked(), which expects the
caller to already hold the semaphore.
> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
> index 3a41c711e751b..16333d4a34ccf 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c
[ ... ]
> @@ -2041,22 +2041,18 @@ static int ice_read_phy_and_phc_time_eth56g(struct ice_hw *hw, u8 port,
> *
> * Return:
> * * %0 - success
> - * * %-EBUSY- failed to acquire PTP semaphore
> * * %other - PHY read/write failed
> + *
> + * The caller must acquire PTP semaphore lock
> */
[Severity: Low]
This is a pre-existing issue, but with the -EBUSY entry dropped here, is
-EBUSY still documented anywhere in this call chain?
The kernel-doc for ice_start_phy_timer_eth56g() only lists:
* Return:
* * %0 - success
* * %other - PHY read/write failed
The function returns -EBUSY directly when ice_ptp_lock() fails, and it did
so before this patch too. Could a %-EBUSY entry be added to the
ice_start_phy_timer_eth56g() kernel-doc?
[ ... ]
> @@ -2155,19 +2149,24 @@ int ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port)
> if (err)
> return err;
>
> + if (!ice_ptp_lock(hw)) {
> + dev_err(ice_hw_to_dev(hw), "Failed to acquire PTP semaphore\n");
> + return -EBUSY;
> + }
> +
> ice_ptp_src_cmd(hw, ICE_PTP_NOP);
[Severity: Medium]
This isn't a bug introduced by this patch, but is the PTP semaphore enough
to keep every other writer off GLTSYN_CMD here?
ice_capture_crosststamp() in ice_ptp.c also writes GLTSYN_CMD. It holds
only the cross-timestamp semaphore (cfg->lock_reg, which is PFHH_SEM on
E82x/E825), not the PFTSYN_SEM semaphore taken by ice_ptp_lock():
drivers/net/ethernet/intel/ice/ice_ptp.c:ice_capture_crosststamp() {
...
/* Program cmd to master timer */
ice_ptp_src_cmd(hw, ICE_PTP_READ_TIME);
...
err_timeout:
/* Clear the master timer */
ice_ptp_src_cmd(hw, ICE_PTP_NOP);
...
}
On E825, a PTP_SYS_OFFSET_PRECISE request (phc2sys uses it by default)
could overwrite the source command partway through ice_ptp_tmr_cmd()
(adjtime/adjfine). It could do the same partway through
ice_sync_phy_timer_eth56g_unlocked(). Wouldn't that produce the same
PHY/PHC divergence the commit message describes?
This appears to come from commit 88c360e49f51. The next patch in this
series, "ice: remove redundant cross-timestamp PTP command", removes both
ice_ptp_src_cmd() calls from ice_capture_crosststamp(), so the race is gone
by the end of the series.
[ ... ]
> @@ -2193,11 +2187,11 @@ int ice_start_phy_timer_eth56g(struct ice_hw *hw, u8 port)
>
> ice_ptp_exec_tmr_cmd(hw);
>
> - ice_ptp_unlock(hw);
> -
> - err = ice_sync_phy_timer_eth56g(hw, port);
> + err = ice_sync_phy_timer_eth56g_unlocked(hw, port);
> if (err)
> - return err;
> + goto err_ptp_unlock;
> +
> + ice_ptp_unlock(hw);
[Severity: Medium]
This is a pre-existing issue, but does ice_start_phy_timer_e82x() need the
same change?
It is called from the same ice_ptp_port_phy_restart() path, which holds
only the per-port ps_lock. Without the PTP semaphore it still reads the
incval, writes the shared GLTSYN_CMD, and fires GLTSYN_CMD_SYNC three
times:
drivers/net/ethernet/intel/ice/ice_ptp_hw.c:ice_start_phy_timer_e82x() {
...
lo = rd32(hw, GLTSYN_INCVAL_L(tmr_idx));
hi = rd32(hw, GLTSYN_INCVAL_H(tmr_idx));
incval = (u64)hi << 32 | lo;
...
err = ice_ptp_one_port_cmd(hw, port, ICE_PTP_INIT_INCVAL);
if (err)
return err;
/* Do not perform any action on the main timer */
ice_ptp_src_cmd(hw, ICE_PTP_NOP);
ice_ptp_exec_tmr_cmd(hw);
...
ice_ptp_exec_tmr_cmd(hw);
...
ice_ptp_exec_tmr_cmd(hw);
err = ice_sync_phy_timer_e82x(hw, port);
...
}
The semaphore is only taken later, inside ice_sync_phy_timer_e82x().
ps_lock does not exclude ice_ptp_adjtime() or ice_ptp_adjfine() running
under ice_ptp_lock() on this PF or another one. It also does not exclude
ice_ptp_settime64()->ice_ptp_restart_all_phy().
Can this NOP replace an ADJ_TIME or INIT_INCVAL that ice_ptp_tmr_cmd() has
staged, or can one of these execs latch it early? Either would leave the
E822/E823 PHY timer offset from the PHC.
The commit message limits the fix to E825, so this may belong in a
separate patch.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261125224428.4126195-2-anthony.l.nguyen%40intel.com
Technical Details
Message-ID:
<179573400611.3135.7939999840565341608@kernel.org>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372380-linux-kernel-netdev=dewy.ruReferences:
<20261125224428.4126195-4-anthony.l.nguyen@intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-372380-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 3/5] ice: ptp: serialize E825 PHY timer start with PTP lock and incval Date: Thu, 26 Nov 2026 23:00:06 +0000 Organization: Usenet Network Message-ID: <179573400611.3135.7939999840565341608@kernel.org> References: <20261125224428.4126195-4-anthony.l.nguyen@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="588715"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:00OFJDFpycFNYXtvCMSscJpOvTk= sha256:fKF1C3Xw9+xXO+fZnCUkaDFssTz56C/YXS4Qzs1VGE4= sha1:8Qu43O11qgJFT9lC77YJb6d2EEE= sha256:S2Lm5G5K9ZIqA3CioYNV7X2VELtwBgrc3vj/zbf5ZDk= 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 1457A125F0A; Fri, 27 Nov 2026 02:00:26 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.4 X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 Nbl16N18ZLv8; Fri, 27 Nov 2026 02:00:22 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-372380-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 5BA9A125F0D; Fri, 27 Nov 2026 02:00:13 +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 025532B332; Thu, 26 Nov 2026 23:00:09 +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=1795734008; b=OhJHD3yD3stRKdDavm/fzpQ2rqHb71ryFubBt0qeDPQC8x153DphwSGMtSIrfkdVDA7u Ad6Q/jp2axgNB2sliDIS27kCYx6Qh1dWOk2gasKq4WTqI9zJcL1ifnwfglkOPpseqJwfq hh7gjubyekS2fPDGLOMxD4tsTeLO+OabafIQlliIB77OYDgF5uygWJS8dceoJgdyYifos eCST1svDvjNgEudvyrJ11knmTMaf+p9yIa710VLD+R8RTYdvc80VUgL+bBni42/gYVS6l DY5frPwjZDgG6UuHgKm/08ma/PU9e3snUQrMKkPV7yI1qZNEGaS7lM+2FCudE2g5DQQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795734008; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=ET6CA/3hcvG1l/nBa4rZu+CNkHEqOV0iUcKI77Rplwc=; b=jj6LtG1OD4/6sOtiWhMX0oAUpuNdbO8OEWYNhrJPkmqb6RxQCjtNjQT0bsd1IGOW0OEU S21x2V5VKxPUWvm+2zdMhGHF0HAyTKQjPJhmoQFJIbMk9cceX9Xgsm+Os3bzOFZ28wa4C sPXQWR/wG4KVqeO4QcisqtXshctQlhBYTvsnWtF1Ui28DSGbWnHfGnRcWBsoL7tS4ky6f FLgBkb3PwxVt5+nvS6CswZWbLc270JWnmEZE7j/H+u2o+m5upPtFy7yVz/cJ+I2cbBLm2 ZrSfMbSg7hTSupEc9RyxPtzXM+jnadqMPNpzTfapBmbxUgZ2rC8uhlrMzDZ+W2R9LaA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=g8GVZN7H; 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 CEFA7606A323; Thu, 26 Nov 2026 23:00:08 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=g8GVZN7H X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795734008; b=XCFQOXtTHmX//40IE8wvUsYpkxqeGya+h7MJEA5TNOiTNCxcZN/D6UERXWkP78e1iJ5g /RVombFwkR98GN3kzjh/fM1PJvr4VwgxKHKTrveOJghODY/HE1jejT+lswABeykGSAcj3 NdZEIgHb/5LTl9eR2Y+4wvYYBWUmwa3jKtHOd5FZaPZaq6hHrPCLUys2xmahRjbEAOPUM qvhNpmPJj7bLt7rtKki59PSPI/4fwmcjcGaEuCGNEQmdD4a6L6u95/uDI65J5KFT3d/qd NgykdlITSF3sRfCWvMXzpXMucNRKRtVrVTMjDLBvoxzk5Gz5rXgOeTvOFOScg7Vcqlg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795734008; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=ET6CA/3hcvG1l/nBa4rZu+CNkHEqOV0iUcKI77Rplwc=; b=M3edoWNRBR+CQJ3P03p8z3fv1a/NuhbTFWD/pS6PB9cuOzlWOTr+OCNZ4gHfpe2TD1rs VAUruXsJY8z1Y2bGg3TO327rzFHelbzGja582BlS4EpSqmvigbPfy+cf+o7TP81xodagq EUqHYYvW2GFeTN7tU5aZskkU01IEVYw3lQNf86qsxf3Xs1Ap7jvNqvgaR0Z6tWHsRV4h4 qIiGzJTz5WceOrlykNGB7BBAneUhtNuEJXntv127e+6KMMRtmTQsjmyR68CnuIj3szX5g 7LpZZYPAq4cq9mwyg8snu5z6mYmWfvgKlNVJEBFfygtmpBKHDseRSe3LNjGht7SbOKg== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=g8GVZN7H; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE3F9606A326 for <netdev@vger.kernel.org>; Thu, 26 Nov 2026 23:00:07 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8BAC11F00898; Thu, 26 Nov 2026 23:00:06 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795734007; bh=ET6CA/3hcvG1l/nBa4rZu+CNkHEqOV0iUcKI77Rplwc=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=g8GVZN7HhgOEXCEGk/IJNSF3V3JFBFk2xOT0Ufm6Ljfvz2Hp6+PLWJwZ6CTTJG3Uh 1RPahfrvdkaGd5J3YjonkI7fJn5pnq7TH5r2Qwnd3VQur+gZbfK1K3QkevWErtW4CS BAZnQKG/jaAzQOQDZrPLDCiaxQDOt7vYRyAPZISdmXshX0bX8eFXv41GA4Is1L8hi0 AgU4pxoWUTmW3lCYSTEB9LpjG0fXAKT2Quy/HRXPT59Pidew5fojHksXtbFiOVUYAM loEe8MC51z8trgv8rI9qi1Z2PuNocKyPXprFhk/jK8Z2vpGRlW3TaGQWw+hx47UW5v EhyYMiNWKt8+Q== X-Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, edumazet@kernel.org, andrew+netdev@lunn.ch, willemb@google.com, netdev@vger.kernel.org, grzegorz.nitka@intel.com, przemyslaw.kitszel@intel.com, aaron.ma@canonical.com, maciej.machnikowski@intel.com, jacob.e.keller@intel.com, richardcochran@gmail.com, sergey.temerkhanov@intel.com, milena.olech@intel.com, horms@kernel.org, aleksandr.loktionov@intel.com, ayush1x.singh@intel.com X-In-Reply-To: <20261125224428.4126195-4-anthony.l.nguyen@intel.com> X-sashiko-severity: Low 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