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

[Xen-devel] Re: [PATCH] EPT: Flush running cpus, add mask to flush when scheduled in



>--- a/xen/arch/x86/hvm/vmx/vmx.c       Tue Sep 15 10:08:12 2009 +0100
>+++ b/xen/arch/x86/hvm/vmx/vmx.c       Mon Sep 21 18:52:26 2009 +0100
>...
>@@ -1219,7 +1226,11 @@
>     if ( d->arch.hvm_domain.hap_enabled && d->vcpu && d->vcpu[0] )
>     {
>         ASSERT(local_irq_is_enabled());
>-        on_each_cpu(__ept_sync_domain, d, 1);
>+        /* Mark cpus that may need flushing on next schedule */
>+        cpus_complement(d->arch.hvm_domain.vmx.ept_needs_flush,
>+                        d->domain_dirty_cpumask);
>+        /* And flush on actively-running processors */
>+        on_selected_cpus(&d->domain_dirty_cpumask, __ept_sync_domain, d, 1);
>     }
> }
> 

Passing a pointer to the global cpu mask looks racy here: What if a CPU
disappears from domain_dirty_cpumask under your feet?

Also, merely using cpus_complement() here seem inefficient: It should be
possible to accumulate the flush activity, and avoid re-flushing on a CPU
which e.g. got flushed on the second from the last run through this code
(and not dirtied afterwards). I.e. I'd think there should be cpus_andnot()
here, and setting of the bits as CPUs get dirtied.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

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