|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 11/12] evtchn: convert vIRQ lock to an r/w one
Hi Jan, On 29/09/2020 14:37, Jan Beulich wrote: On 29.09.2020 15:03, Julien Grall wrote:On 28/09/2020 12:02, Jan Beulich wrote:There's no need to serialize all sending of vIRQ-s; all that's needed is serialization against the closing of the respective event channels (by means of a barrier). To facilitate the conversion, introduce a new rw_barrier().Looking at the code below, all the spin_lock() have been replaced by a read_lock_*(). This is a bit surprising,It is, I agree, but that's what it ends up being. It is my understanding that the lock really only exists for the purpose of the barrier in evtchn_close().--- a/xen/common/spinlock.c +++ b/xen/common/spinlock.c @@ -2,7 +2,7 @@ #include <xen/irq.h> #include <xen/smp.h> #include <xen/time.h> -#include <xen/spinlock.h> +#include <xen/rwlock.h>I would prefer if keep including <xen/spinlock.h> as the fact <xen/rwlock.h> include it is merely an implementation details.Can do, sure. Most likely yes. spin_barrier() seems to handle this situation fine because it just wait for the head to change. I don't think we can do the same here... I am thinking that it may be easier to hold the write lock when doing the update.... perhaps this is indeed better. I have to admit that I never fully understood the benefit of using spin_barrier() in this code (as opposed to the use in evtchn_destroy()). I am not entirely sure either. It looks like it is an attempt to make v->virq_to_evtchn[X] visible without holding a lock. Any holder of the lock after spin_barrier() has completed will read 0 and not try to use the lock. But the update of v->virq_to_evtchn[X] should have used either ACCESS_ONCE() or write_atomic(). Cheers, -- Julien Grall
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |