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

Re: [Xen-devel] [PATCH v8 10/19] x86/VPMU: Interface for setting PMU mode and flags

On 07/29/2014 02:19 AM, Jan Beulich wrote:
On 28.07.14 at 19:13, <boris.ostrovsky@xxxxxxxxxx> wrote:
On 07/28/2014 12:36 PM, Jan Beulich wrote:
On 28.07.14 at 18:29, <boris.ostrovsky@xxxxxxxxxx> wrote:
On 07/28/2014 11:22 AM, Jan Beulich wrote:
On 01.07.14 at 16:37, <boris.ostrovsky@xxxxxxxxxx> wrote:
+    start = NOW();
+    /*
+     * Note that we may fail here if a CPU is hot-unplugged while we are
+     * waiting. We will then time out.
+     */
+    while ( atomic_read(&vpmu_sched_counter) != allbutself_num )
+    {
+        /* Give up after 5 seconds */
+        if ( NOW() > start + SECONDS(5) )
+        {
+            printk("vpmu_unload_all: failed to sync\n");
+            ret = -EBUSY;
+            break;
+        }
+        cpu_relax();
+        if ( hypercall_preempt_check() )
+            return hypercall_create_continuation(
+                __HYPERVISOR_xenpmu_op, "ih", XENPMU_mode_set, arg);
+    }
I wonder whether this is race free (wrt another CPU doing something
similar) and how you expect the 5s timeout above to ever be reached
(you're virtually guaranteed to get asked to preempt earlier).
Race-wise there is xenpmu_mode_lock in the caller (quoted below).
That wasn't my point: I said "something similar" - imagine another
hypercall behaving this same way, and both hypercalls getting
run concurrently.
Isn't it already possible to have two hypercalls doing continuations at
the same time? (Assuming this was your concern)
Yes, it is, and no, this wasn't my concern. My concern is the waiting
for all CPUs by the code you add.

Oh, I see.

After I rework timeout tracking one of the competing hypercalls (this one, for example), will error out after 5 seconds.


Xen-devel mailing list



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