From: netdev-bot+sashiko@kernel.org
To: anthony.l.nguyen@intel.com
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
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 [thread overview]
Message-ID: <179573400611.3135.7939999840565341608@kernel.org> (raw)
In-Reply-To: <20261125224428.4126195-4-anthony.l.nguyen@intel.com>
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
next prev parent reply other threads:[~2026-11-26 23:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 22:44 [PATCH net 0/5][pull request] Intel Wired LAN Driver Updates 2026-11-25 (ice) Tony Nguyen
2026-11-25 22:44 ` [PATCH net 1/5] ice: restore DDP state during PFR recovery Tony Nguyen
2026-11-25 22:48 ` netdev-bot+sinfo
2026-11-26 23:00 ` netdev-bot+sashiko
2026-11-25 22:44 ` [PATCH net 2/5] ice: clear Flow Director entries before reset cleanup Tony Nguyen
2026-11-26 23:00 ` netdev-bot+sashiko
2026-11-25 22:44 ` [PATCH net 3/5] ice: ptp: serialize E825 PHY timer start with PTP lock and incval Tony Nguyen
2026-11-26 0:03 ` Jacob Keller
2026-11-26 23:00 ` netdev-bot+sashiko [this message]
2026-11-25 22:44 ` [PATCH net 4/5] ice: remove redundant cross-timestamp PTP command Tony Nguyen
2026-11-26 23:00 ` netdev-bot+sashiko
2026-11-25 22:44 ` [PATCH net 5/5] ice: fix computation of ETF timestamps for E830 Tony Nguyen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179573400611.3135.7939999840565341608@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=aaron.ma@canonical.com \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=ayush1x.singh@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=grzegorz.nitka@intel.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=kuba@kernel.org \
--cc=maciej.machnikowski@intel.com \
--cc=milena.olech@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=richardcochran@gmail.com \
--cc=sergey.temerkhanov@intel.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox