Netdev List
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: <netdev-bot+sashiko@kernel.org>, <anthony.l.nguyen@intel.com>
Cc: <davem@davemloft.net>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<edumazet@kernel.org>, <andrew+netdev@lunn.ch>,
	<netdev@vger.kernel.org>, <poros@redhat.com>,
	<maciej.machnikowski@intel.com>, <przemyslaw.korba@intel.com>,
	<grzegorz.nitka@intel.com>, <sergey.temerkhanov@intel.com>,
	<arkadiusz.kubalewski@intel.com>, <richardcochran@gmail.com>,
	<horms@kernel.org>
Subject: Re: [PATCH net v3 11/14] ice: wait for in-flight Tx timestamps before removing the tracker
Date: Mon, 19 Oct 2026 17:05:42 -0700	[thread overview]
Message-ID: <879b8b42-403b-4f07-8fb0-d4c599d55435@intel.com> (raw)
In-Reply-To: <179244085491.3135.8474994286741014334@kernel.org>

On 10/19/2026 1:14 PM, netdev-bot+sashiko@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential
> issue(s) to consider.
> 
> Critical: 0 · High: 0 · Medium: 2 · Low: 0
> 
> If you believe none of the issues are legitimate, please reply to each
> issue of Medium severity or higher and explain why the AI is wrong.
> If any of them are legitimate and you plan to respin, please let patchwork
> know by including "pw-bot: cr" as a separate line at the end of your reply
> (one such reply per series is enough).
> 
> - [Medium] On E830, the new drain wait runs, but the flush that follows
>   cannot clear the ready entries it waited for.
> - [Medium] The tracker is released while the PF's Tx path is still live,
>   and the new drain wait gives up after 10 ms.
> 
> --
> 
> ice: wait for in-flight Tx timestamps before removing the tracker
> 
> This patch adds ice_ptp_wait_for_tracker_drain(). It polls the PHY Tx
> timestamp ready bitmap for up to 10 ms, until every in-use tracker index
> reports ready. ice_ptp_release_tx_tracker() now calls it before
> ice_ptp_flush_tx_tracker(), so in-flight captures get cleared instead of
> being left as orphaned ready bits, and E810 is skipped via
> tx->has_ready_bitmap.
> 
>> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
>> index 32be908373c30..ca581490f3edb 100644
>> --- a/drivers/net/ethernet/intel/ice/ice_ptp.c
>> +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
>> @@ -751,6 +751,68 @@ ice_ptp_alloc_tx_tracker(struct ice_ptp_tx *tx)
> 
> [ ... ]
> 
>> +static void
>> +ice_ptp_wait_for_tracker_drain(struct ice_pf *pf, struct ice_ptp_tx *tx)
>> +{
>> +	bool drained;
>> +	int err;
>> +
>> +	if (!tx->has_ready_bitmap)
>> +		return;
> 
> [Severity: Medium]
> Does this wait do anything useful on E830? ice_ptp_init_tx() sets:
> 

E830 should be doing something to clear timestamps, and its an oversight
and pre-existing issue that it doesn't. This should be an issue
addressed by a follow up patch and not this series.

> 	tx->has_ready_bitmap = pf->hw.mac_type != ICE_MAC_E810;
> 
> E830 passes this check. ice_ptp_is_tracker_drained() then polls the
> E830 valid bits through ice_get_phy_tx_tstamp_ready_e830() for up to
> 10 ms.
> 
> The flush that follows calls ice_clear_phy_tstamp() for each ready
> index, and that function has no E830 case:
> 
> drivers/net/ethernet/intel/ice/ice_ptp_hw.c:ice_clear_phy_tstamp() {
> 	switch (hw->mac_type) {
> 	case ICE_MAC_E810:
> 		return ice_clear_phy_tstamp_e810(hw, block, idx);
> 	case ICE_MAC_GENERIC:
> 		return ice_clear_phy_tstamp_e82x(hw, block, idx);
> 	case ICE_MAC_GENERIC_3K_E825:
> 		return ice_clear_ptp_tstamp_eth56g(hw, block, idx);
> 	default:
> 		return -EOPNOTSUPP;
> 	}
> }
> 
> ice_ptp_flush_tx_tracker() ignores the return value, so the failure is
> silent.
> 
> The commit message says:
> 
>   Only later devices (E822, E825, E830) have the bitmap and potential
>   issues with internal tracking.
> 
> On E830, won't the valid bits this wait collected still be set after
> the flush? If so, the patch adds up to 10 ms of latency there without
> fixing the desync.
> 
> ice_read_phy_tstamp() already has an E830 case that reads
> E830_PRTTSYN_TXTIME_H/L, but the clear path never uses it. Should
> ice_clear_phy_tstamp() get an E830 case, or should E830 skip the wait?
> The E830 case is still missing at the end of the series.
> 
>> +
>> +	err = read_poll_timeout(ice_ptp_is_tracker_drained,
>> +				drained, drained, 500, 10 * USEC_PER_MSEC, false,
>> +				pf, tx);
>> +	if (err) {
>> +		dev_dbg(ice_pf_to_dev(pf), "Timed out waiting for in-flight Tx timestamps on block %u\n",
>> +			tx->block);
>> +	}
>> +}
> 
> [ ... ]
> 
>> @@ -868,6 +930,8 @@ ice_ptp_release_tx_tracker(struct ice_pf *pf, struct ice_ptp_tx *tx)
>>  	/* wait for potentially outstanding interrupt to complete */
>>  	synchronize_irq(pf->oicr_irq.virq);
>>  
>> +	ice_ptp_wait_for_tracker_drain(pf, tx);
>> +
>>  	ice_ptp_flush_tx_tracker(pf, tx);
> 
> [Severity: Medium]
> Is the Tx path still live when this runs? On the remove and devlink
> reload paths the order is:
> 
> ice_unload()
>   ice_deinit_features()
>     ice_ptp_release()
>       ice_ptp_release_tx_tracker()
>         ice_ptp_wait_for_tracker_drain()
>         ice_ptp_flush_tx_tracker()
>   ...
>   ice_unregister_netdev()
> 
> Nothing quiesces the Tx queues before the tracker is released.
> ice_ptp_release() masks PFINT_OICR_TSYN_TX and turns off Rx
> timestamping. Clearing tx->init only stops ice_ptp_request_ts() from
> handing out new indexes.
> 
> Two cases seem to slip past the 10 ms wait:
> 
>   ice_tstamp() has already reserved an index through
>   ice_ptp_request_ts(), but the TSYN context descriptor has not been
>   posted yet.
> 
>   A TSYN descriptor stays in the hardware Tx ring for more than 10 ms,
>   for example at low link speed, under PFC/pause backpressure, or with
>   rate limiting.
> 
> In either case read_poll_timeout() times out with only a dev_dbg().
> ice_ptp_flush_tx_tracker() then sees the index as not ready, skips
> ice_clear_phy_tstamp(), and frees the entry. When the frame finally
> goes out, the PHY sets a ready bit (Q_REG_TX_MEMORY_STATUS on E82x)
> that no tracker owns.
> 
> On E82x that quad memory is shared with the other ports of the quad,
> possibly including ports owned by other PFs. ice_ptp_process_tx_tstamp()
> only walks in_use, so nothing ever reads the orphaned entry.
> 
> Isn't that the same "delivery for the whole quad degrades to the
> periodic work" situation the commit message describes? Would it be more
> robust to flush after Tx has been stopped, instead of relying on a fixed
> timeout? The ordering is the same at the end of the series.
> 

I'm not sure how we could safely re-arrange this ordering to do it after
stopping the queues. I think we ultimately fix any issues by performing
a soft reset on initializing PTP which would prevent any long term issue
here (especially as we are changing the logic to avoid flushing anywhere
else).

Maybe that means the waiting is pointless to begin with...

>>  
>>  	kfree(tx->tstamps);
> 


  reply	other threads:[~2026-10-20  0:06 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15 19:10 [PATCH net v3 00/14][pull request] ice: E82x: timestamp processing logic fixes Tony Nguyen
2026-10-15 19:10 ` [PATCH net v3 01/14] ice: fix removal of PTP timestamp tracker during reset Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:14     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 02/14] ice: use reference counting and SRCU for PTP port access Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:16     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 03/14] ice: fix PHY port restart serialization Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:21     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 04/14] ice: set in_use only after preparing Tx timestamp index Tony Nguyen
2026-10-15 19:10 ` [PATCH net v3 05/14] ice: call PTP link change only from link events Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:35     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 06/14] ice: E822: keep Tx timestamps disabled during offset calibration Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:37     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 07/14] ice: E822: cancel offset verification work during reset preparation Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:40     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 08/14] ice: E825: stop clearing PHY_REG_TX_OFFSET_READY Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:42     ` Jacob Keller
2026-10-20  1:53       ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 09/14] ice: E825: clear PHY_TSTAMP memory prior to soft reset Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:49     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 10/14] ice: E825: perform a soft reset when starting the PHY timer Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-19 23:57     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 11/14] ice: wait for in-flight Tx timestamps before removing the tracker Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-20  0:05     ` Jacob Keller [this message]
2026-10-15 19:10 ` [PATCH net v3 12/14] ice: keep Tx timestamp slots tracked until completion or timeout Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-20  0:11     ` Jacob Keller
2026-10-15 19:10 ` [PATCH net v3 13/14] ice: skip reading Tx ready bitmap on ports with no timestamps Tony Nguyen
2026-10-15 19:11 ` [PATCH net v3 14/14] ice: don't clear in_use until HW clears ready bitmap Tony Nguyen
2026-10-19 20:14   ` netdev-bot+sashiko
2026-10-20  0:18     ` Jacob Keller

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=879b8b42-403b-4f07-8fb0-d4c599d55435@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=arkadiusz.kubalewski@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=grzegorz.nitka@intel.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=maciej.machnikowski@intel.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=poros@redhat.com \
    --cc=przemyslaw.korba@intel.com \
    --cc=richardcochran@gmail.com \
    --cc=sergey.temerkhanov@intel.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