[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Xen-devel] [PATCH 10/11] qspinlock: Paravirt support
- To: Waiman Long <waiman.long@xxxxxx>, Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
- From: Paolo Bonzini <pbonzini@xxxxxxxxxx>
- Date: Wed, 18 Jun 2014 14:03:12 +0200
- Cc: linux-arch@xxxxxxxxxxxxxxx, gleb@xxxxxxxxxx, kvm@xxxxxxxxxxxxxxx, boris.ostrovsky@xxxxxxxxxx, scott.norton@xxxxxx, raghavendra.kt@xxxxxxxxxxxxxxxxxx, paolo.bonzini@xxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, virtualization@xxxxxxxxxxxxxxxxxxxxxxxxxx, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, chegu_vinod@xxxxxx, david.vrabel@xxxxxxxxxx, oleg@xxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, tglx@xxxxxxxxxxxxx, paulmck@xxxxxxxxxxxxxxxxxx, torvalds@xxxxxxxxxxxxxxxxxxxx, mingo@xxxxxxxxxx
- Delivery-date: Wed, 18 Jun 2014 12:04:24 +0000
- List-id: Xen developer discussion <xen-devel.lists.xen.org>
Il 17/06/2014 00:08, Waiman Long ha scritto:
+void __pv_queue_unlock(struct qspinlock *lock)
+{
+ int val = atomic_read(&lock->val);
+
+ native_queue_unlock(lock);
+
+ if (val & _Q_LOCKED_SLOW)
+ ___pv_kick_head(lock);
+}
+
Again a race can happen here between the reading and writing of the lock
value. I can't think of a good way to do that without using cmpxchg.
Could you just use xchg on the locked byte?
Paolo
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|