[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y4hxen0fOSVnXWbf@unreal>
Date: Thu, 1 Dec 2022 11:18:50 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Tony Nguyen <anthony.l.nguyen@...el.com>
Cc: davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
edumazet@...gle.com, Jacob Keller <jacob.e.keller@...el.com>,
netdev@...r.kernel.org, richardcochran@...il.com,
Gurucharan G <gurucharanx.g@...el.com>
Subject: Re: [PATCH net-next 08/14] ice: protect init and calibrating fields
with spinlock
On Wed, Nov 30, 2022 at 11:43:24AM -0800, Tony Nguyen wrote:
> From: Jacob Keller <jacob.e.keller@...el.com>
>
> Ensure that the init and calibrating fields of the PTP Tx timestamp tracker
> structure are only modified under the spin lock. This ensures that the
> accesses are consistent and that new timestamp requests will either begin
> completely or get ignored.
>
> Signed-off-by: Jacob Keller <jacob.e.keller@...el.com>
> Tested-by: Gurucharan G <gurucharanx.g@...el.com> (A Contingent worker at Intel)
> Signed-off-by: Tony Nguyen <anthony.l.nguyen@...el.com>
> ---
> drivers/net/ethernet/intel/ice/ice_ptp.c | 55 ++++++++++++++++++++++--
> drivers/net/ethernet/intel/ice/ice_ptp.h | 2 +-
> 2 files changed, 52 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice_ptp.c b/drivers/net/ethernet/intel/ice/ice_ptp.c
> index a7d950dd1264..0e39fed7cfca 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ptp.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ptp.c
> @@ -599,6 +599,42 @@ static u64 ice_ptp_extend_40b_ts(struct ice_pf *pf, u64 in_tstamp)
> (in_tstamp >> 8) & mask);
> }
>
> +/**
> + * ice_ptp_is_tx_tracker_init - Check if the Tx tracker is initialized
> + * @tx: the PTP Tx timestamp tracker to check
> + *
> + * Check that a given PTP Tx timestamp tracker is initialized. Acquires the
> + * tx->lock spinlock.
> + */
> +static bool
> +ice_ptp_is_tx_tracker_init(struct ice_ptp_tx *tx)
> +{
> + bool init;
> +
> + spin_lock(&tx->lock);
> + init = tx->init;
> + spin_unlock(&tx->lock);
> +
> + return init;
How this type of locking can be correct?
It doesn't protect anything and equal to do not have locking at all.
Thanks
Powered by blists - more mailing lists