Re: [PATCH v6] x86/hpet: Reduce HPET counter read contention

From: Waiman Long
Date: Thu Aug 25 2016 - 16:24:08 EST

On 08/25/2016 02:50 PM, Dave Hansen wrote:
On 08/12/2016 05:59 PM, Waiman Long wrote:
+ * The lock and the hpet value are stored together and can be read in a
+ * single atomic 64-bit read. It is explicitly assumed that arch_spinlock_t
+ * is 32 bits in size.
This requirement forces us to give up all of the goodness of lockdep.
Is this strictly a performance optimization or is there some function
requirement behind it as well?

Yes, it is mostly performance optimization. Using a full spinlock will require additional synchronization code like a memory barrier to prevent race between the lock and HPET value with respect to the readers.

It is a simple lock that won't have additional locks nested inside. So I wonder if there is any value in having the lockdep functionality for this lock.