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

[Xen-changelog] [xen stable-4.4] x86: vcpu_destroy_pagetables() must not return -EINTR



commit 818e40bb2581def3ae855e92ccb220d1a21bd219
Author:     Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
AuthorDate: Tue Feb 3 12:33:41 2015 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Feb 3 12:33:41 2015 +0100

    x86: vcpu_destroy_pagetables() must not return -EINTR
    
    .. otherwise it has the side effect that: domain_relinquish_resources
    will stop and will return to user-space with -EINTR which it is not
    equipped to deal with that error code; or vcpu_reset - which will
    ignore it and convert the error to -ENOMEM..
    
    The preemption mechanism we have for domain destruction is to return
    -EAGAIN (and then user-space calls the hypercall again) and as such we need
    to catch the case of:
    
    domain_relinquish_resources
      ->vcpu_destroy_pagetables
        -> put_page_and_type_preemptible
           -> __put_page_type
               returns -EINTR
    
    and convert it to the proper type. For:
    
    XEN_DOMCTL_setvcpucontext
     -> vcpu_reset
       -> vcpu_destroy_pagetables
    
    we need to return -ERESTART otherwise we end up returning -ENOMEM.
    
    There are also other callers of vcpu_destroy_pagetables: arch_vcpu_reset
    (vcpu_reset) are:
     - hvm_s3_suspend (asserts on any return code),
     - vlapic_init_sipi_one (asserts on any return code),
    
    Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: de4f284b3d7b47d3b9807f354552ecf3e0fff56b
    master date: 2015-01-26 12:51:09 +0100
---
 xen/arch/x86/mm.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
index c086755..088ce35 100644
--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -2693,7 +2693,11 @@ int vcpu_destroy_pagetables(struct vcpu *v)
 
     v->arch.cr3 = 0;
 
-    return rc;
+    /*
+     * put_page_and_type_preemptible() is liable to return -EINTR. The
+     * callers of us expect -ERESTART so convert it over.
+     */
+    return rc != -EINTR ? rc : -ERESTART;
 }
 
 int new_guest_cr3(unsigned long mfn)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.4

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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