netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com,
	edumazet@google.com, Jacob Keller <jacob.e.keller@intel.com>,
	netdev@vger.kernel.org, richardcochran@gmail.com,
	Gurucharan G <gurucharanx.g@intel.com>
Subject: Re: [PATCH net-next v2 09/15] ice: protect init and calibrating check in ice_ptp_request_ts
Date: Thu, 8 Dec 2022 11:22:35 +0200	[thread overview]
Message-ID: <Y5Gs27MjJ1RrkVld@unreal> (raw)
In-Reply-To: <20221207210937.1099650-10-anthony.l.nguyen@intel.com>

On Wed, Dec 07, 2022 at 01:09:31PM -0800, Tony Nguyen wrote:
> From: Jacob Keller <jacob.e.keller@intel.com>
> 
> When requesting a new timestamp, the ice_ptp_request_ts function does not
> hold the Tx tracker lock while checking init and calibrating. This means
> that we might issue a new timestamp request just after the Tx timestamp
> tracker starts being deinitialized. This could lead to incorrect access of
> the timestamp structures. Correct this by moving the init and calibrating
> checks under the lock, and updating the flows which modify these fields to
> use the lock.
> 
> Note that we do not need to hold the lock while checking for tx->init in
> ice_ptp_tstamp_tx. This is because the teardown function will use
> synchronize_irq after clearing the flag to ensure that the threaded
> interrupt completes. Either a) the tx->init flag will be cleared before the
> ice_ptp_tx_tstamp function starts, thus it will exit immediately, or b) the
> threaded interrupt will be executing and the synchronize_irq will wait
> until the threaded interrupt has completed at which point we know the init
> field has definitely been set and new interrupts will not execute the Tx
> timestamp thread function.
> 
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_ptp.c | 36 ++++++++++++++++++++----
>  drivers/net/ethernet/intel/ice/ice_ptp.h |  2 +-
>  2 files changed, 32 insertions(+), 6 deletions(-)

Much better, thanks

  parent reply	other threads:[~2022-12-08  9:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 21:09 [PATCH net-next v2 00/15][pull request] Intel Wired LAN Driver Updates 2022-12-07 (ice) Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 01/15] ice: Use more generic names for ice_ptp_tx fields Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 02/15] ice: Remove the E822 vernier "bypass" logic Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 03/15] ice: Reset TS memory for all quads Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 04/15] ice: fix misuse of "link err" with "link status" Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 05/15] ice: always call ice_ptp_link_change and make it void Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 06/15] ice: handle discarding old Tx requests in ice_ptp_tx_tstamp Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 07/15] ice: check Tx timestamp memory register for ready timestamps Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 08/15] ice: synchronize the misc IRQ when tearing down Tx tracker Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 09/15] ice: protect init and calibrating check in ice_ptp_request_ts Tony Nguyen
2022-12-07 23:36   ` Saeed Mahameed
2022-12-08  0:29     ` Jacob Keller
2022-12-08 19:48     ` Jacob Keller
2022-12-08  9:22   ` Leon Romanovsky [this message]
2022-12-07 21:09 ` [PATCH net-next v2 10/15] ice: disable Tx timestamps while link is down Tony Nguyen
2022-12-07 23:46   ` Saeed Mahameed
2022-12-08  1:15     ` Jacob Keller
2022-12-08 18:17     ` Jacob Keller
2022-12-07 21:09 ` [PATCH net-next v2 11/15] ice: cleanup allocations in ice_ptp_alloc_tx_tracker Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 12/15] ice: handle flushing stale Tx timestamps in ice_ptp_tx_tstamp Tony Nguyen
2022-12-07 23:56   ` Saeed Mahameed
2022-12-08  1:12     ` Jacob Keller
2022-12-07 21:09 ` [PATCH net-next v2 13/15] ice: only check set bits in ice_ptp_flush_tx_tracker Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 14/15] ice: make Tx and Rx vernier offset calibration independent Tony Nguyen
2022-12-07 21:09 ` [PATCH net-next v2 15/15] ice: reschedule ice_ptp_wait_for_offset_valid during reset 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=Y5Gs27MjJ1RrkVld@unreal \
    --to=leon@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gurucharanx.g@intel.com \
    --cc=jacob.e.keller@intel.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.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;
as well as URLs for NNTP newsgroup(s).