Skip to contentSkip to conversation

Allow PV superpages to work with live migration

PATCH In review Dave McCracken 3 participants 6 messages May 17, 2010 – May 18, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Allow PV superpages to work with live migration

PV superpages currently do not work with live migration. They fall over dead when the shadow page table is enabled for dirty tracking. The HVM support for superpages in this code has been tested and found to work just fine for PV superpages. This patch modifies the test macro to allow the code to work with PV superpages.

Dave McCracken
Oracle Corp.

/xen/include/asm-x86/guest_pt.h +5 -4
@@ -186,10 +186,11 @@ guest_supports_superpages(struct vcpu *v
     /* The _PAGE_PSE bit must be honoured in HVM guests, whenever
      * CR4.PSE is set or the guest is in PAE or long mode. 
      * It's also used in the dummy PT for vcpus with CR4.PG cleared. */
-    return (is_hvm_vcpu(v) && 
-            (GUEST_PAGING_LEVELS != 2 
-             || !hvm_paging_enabled(v)
-             || (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PSE)));
+    return (opt_allow_hugepage ||
+	    (is_hvm_vcpu(v) && 
+	     (GUEST_PAGING_LEVELS != 2 
+	      || !hvm_paging_enabled(v)
+	      || (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PSE))));
 }
 
 static inline int

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw
Quoted 6 lines · Dave McCracken

PV superpages currently do not work with live migration. They fall over dead when the shadow page table is enabled for dirty tracking. The HVM support for superpages in this code has been tested and found to work just fine for PV superpages. This patch modifies the test macro to allow the code to work with PV superpages.

It rather overshoots. :) This enables PSE even for HVM guests which
have explicitly disabled it. I think you want

    return (is_hvm_vcpu(v) ? (GUEST_PAGING_LEVELS != 2
                              || !hvm_paging_enabled(v)
                              || (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PSE))
                           : opt_allow_hugepage);

Cheers,

Tim.

Content-Description: xen-unstable-smigrate-1.patch

Quoted 8 lines
/xen/include/asm-x86/guest_pt.h +0 -2
@@ -186,10 +186,11 @@ guest_supports_superpages(struct vcpu *v
     /* The _PAGE_PSE bit must be honoured in HVM guests, whenever
      * CR4.PSE is set or the guest is in PAE or long mode. 
      * It's also used in the dummy PT for vcpus with CR4.PG cleared. */
-    return (is_hvm_vcpu(v) && 
-            (GUEST_PAGING_LEVELS != 2 

/xen/include/asm-x86/guest_pt.h guest_supports_superpages(struct vcpu *v · line 196

Quoted 10 lines
/xen/include/asm-x86/guest_pt.h +5 -2
-             || !hvm_paging_enabled(v)
-             || (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PSE)));
+    return (opt_allow_hugepage ||
+	    (is_hvm_vcpu(v) && 
+	     (GUEST_PAGING_LEVELS != 2 
+	      || !hvm_paging_enabled(v)
+	      || (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PSE))));
 }
 
 static inline int

Content-Description: ATT00001..txt

Quoted 4 lines

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

Signature · 3 lines
Tim Deegan <[email protected]>
Principal Software Engineer, XenServer Engineering
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)
#2 lore raw
Quoted 6 lines · Tim Deegan
Quoted 5 lines

PV superpages currently do not work with live migration. They fall over dead when the shadow page table is enabled for dirty tracking. The HVM support for superpages in this code has been tested and found to work just fine for PV superpages. This patch modifies the test macro to allow the code to work with PV superpages.

Quoted 7 lines

It rather overshoots. :) This enables PSE even for HVM guests which
have explicitly disabled it. I think you want

    return (is_hvm_vcpu(v) ? (GUEST_PAGING_LEVELS != 2
                              || !hvm_paging_enabled(v)
                              || (v->arch.hvm_vcpu.guest_cr[4] &

X86_CR4_PSE)) : opt_allow_hugepage);

I'm confused. As far as I know, opt_allow_hugeage only affects PV guests. All I did in the macro was add a test for it. I didn't touch any of the HVM logic. Are you saying the HVM logic is wrong or that opt_allow_hugepage affects HVM guests in some fashion?

Dave McCracken
Oracle Corp.

#3 lore raw
Quoted 9 lines · Dave McCracken
Quoted 7 lines · Tim Deegan

It rather overshoots. :) This enables PSE even for HVM guests which
have explicitly disabled it. I think you want

    return (is_hvm_vcpu(v) ? (GUEST_PAGING_LEVELS != 2
                              || !hvm_paging_enabled(v)
                              || (v->arch.hvm_vcpu.guest_cr[4] &

X86_CR4_PSE)) : opt_allow_hugepage);

Quoted 4 lines

I'm confused. As far as I know, opt_allow_hugeage only affects PV guests. All I did in the macro was add a test for it. I didn't touch any of the HVM logic. Are you saying the HVM logic is wrong or that opt_allow_hugepage affects HVM guests in some fashion?

It would affect them after your change:

+ return (opt_allow_hugepage ||
+ (is_hvm_vcpu(v) &&
+ (GUEST_PAGING_LEVELS != 2

+             || !hvm_paging_enabled(v)
+             || (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PSE))));

This makes the whole predicate true _even_for_hvm_guests_ whenever opt_allow_hugepage is true. It should not be true for HVM guests that have disabled PSE, regardless of the setting of opt_allow_hugepage.

Cheers,

Tim.

Signature · 3 lines
Tim Deegan <[email protected]>
Principal Software Engineer, XenServer Engineering
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)
#4 lore raw
Quoted 3 lines · Tim Deegan

This makes the whole predicate true _even_for_hvm_guests_ whenever opt_allow_hugepage is true. It should not be true for HVM guests that have disabled PSE, regardless of the setting of opt_allow_hugepage.

I already fixed this when I applied the patch this morning.

K.

#5 lore raw
In reply to Tim Deegan
Quoted 14 lines · Tim Deegan
Quoted 4 lines · Dave McCracken

I'm confused. As far as I know, opt_allow_hugeage only affects PV guests. All I did in the macro was add a test for it. I didn't touch any of the HVM logic. Are you saying the HVM logic is wrong or that opt_allow_hugepage affects HVM guests in some fashion?

It would affect them after your change:

/xen/include/asm-x86/guest_pt.h +5 -0
+    return (opt_allow_hugepage ||
+           (is_hvm_vcpu(v) &&
+            (GUEST_PAGING_LEVELS != 2
+             || !hvm_paging_enabled(v)
+             || (v->arch.hvm_vcpu.guest_cr[4] & X86_CR4_PSE))));
Quoted 3 lines

This makes the whole predicate true _even_for_hvm_guests_ whenever opt_allow_hugepage is true. It should not be true for HVM guests that have disabled PSE, regardless of the setting of opt_allow_hugepage.

Ahh, right. It didn't occur to me that people might set that parameter on machines with HVM guests. I suppose it would be reasonable if they had a mix of PV and HVM on the same machine.

Quoted 1 line · Keir

I already fixed this when I applied the patch this morning.

Thanks.

Dave