]> xenbits.xensource.com Git - xen.git/commitdiff
sync CPU state upon final domain destruction
authorJan Beulich <jbeulich@suse.com>
Wed, 20 Dec 2017 15:19:12 +0000 (16:19 +0100)
committerJan Beulich <jbeulich@suse.com>
Wed, 20 Dec 2017 15:19:12 +0000 (16:19 +0100)
See the code comment being added for why we need this.

This is being placed here to balance between the desire to prevent
future similar issues (the risk of which would grow if it was put
further down the call stack, e.g. in vmx_vcpu_destroy()) and the
intention to limit the performance impact (otherwise it could also go
into rcu_do_batch(), paralleling the use in do_tasklet_work()).

Reported-by: Igor Druzhinin <igor.druzhinin@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
master commit: 24246e1fb7496b830aca8a6a1fd3064ca1e3ebf9
master date: 2017-11-23 11:38:22 +0100

xen/common/domain.c

index c5c78b9b3cefc4a6be86f61b52db32710b5e14f6..047a489647843067125aeffa779f73f44a970c54 100644 (file)
@@ -798,6 +798,14 @@ static void complete_domain_destroy(struct rcu_head *head)
     struct vcpu *v;
     int i;
 
+    /*
+     * Flush all state for the vCPU previously having run on the current CPU.
+     * This is in particular relevant for x86 HVM ones on VMX, so that this
+     * flushing of state won't happen from the TLB flush IPI handler behind
+     * the back of a vmx_vmcs_enter() / vmx_vmcs_exit() section.
+     */
+    sync_local_execstate();
+
     for ( i = d->max_vcpus - 1; i >= 0; i-- )
     {
         if ( (v = d->vcpu[i]) == NULL )