Subject: Re: [PATCH net-next] bnxt_en: replace PTP spinlock with seqlock

From: Vadim Fedorenko <[email-masked]>
Date: Tue, 15 Oct 2024 11:25:00 +0100

On 15/10/2024 00:35, Jakub Kicinski wrote:
> On Mon, 14 Oct 2024 16:29:47 -0700 Vadim Fedorenko wrote:
>> -	spin_lock_bh(&ptp->ptp_lock);
>> +	write_seqlock_irqsave(&ptp->ptp_lock, flags);
>>   	timecounter_adjtime(&ptp->tc, delta);
>> -	spin_unlock_bh(&ptp->ptp_lock);
>> +	write_sequnlock_irqrestore(&ptp->ptp_lock, flags);
> 
> I think when you adjtime / adjfine (IOW on all the write path) you still
> need the spin lock. But in addition also the seq lock. And then the
> read path can take just the seq lock.

I think there is a spinlock in seqlock_t which is used to prevent
multiple writers.

> This will also remove any uncertainty about the bit ops.

Should I use read_seqlock_excl_bh()/write_seqlock_bh() for the bit ops
then?