[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v8.1 12/27] xsplice: Implement support for applying/reverting/replacing patches.



>>> On 22.04.16 at 19:26, <konrad.wilk@xxxxxxxxxx> wrote:
>> >+/* Defines an outstanding patching action. */
>> >+struct xsplice_work
>> >+{
>> >+    atomic_t semaphore;          /* Used for rendezvous. */
>> >+    atomic_t irq_semaphore;      /* Used to signal all IRQs disabled. */
>> 
>> Why do you, btw, need two of them? I would seem to me that having just one
>> for both purposes should be fine.
> 
> The 'semaphore' is used to get all of the CPUs synced up in the code. Once
> they have been synced up (so semaphore == total_cpus-1) we go to the next 
> stage
> where all of them disable their IRQs -- and the master patches. Once the 
> patching
> is done all of them renable their IRQs.
> 
> I am not exactly sure how I would reuse the 'semaphore' on the second part 
> of this
> (disable IRQs).

Right now you have

+        timeout = xsplice_work.timeout + NOW();
+        if ( xsplice_spin(&xsplice_work.semaphore, timeout, cpus, "CPU") )
+            goto abort;
+
+        /* All CPUs are waiting, now signal to disable IRQs. */
+        xsplice_work.ready = 1;
+        smp_wmb();
+
+        atomic_inc(&xsplice_work.irq_semaphore);

This atomic_inc() could simply become
atomic_set(&xsplice_work.semaphore, 0), while at the same time
getting moved up ahead of the setting of xsplice_work.ready (with
suitable addition of barriers).

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.