All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Allow PV superpages to work with live migration
@ 2010-05-17 19:10 Dave McCracken
  2010-05-18 12:35 ` Tim Deegan
  0 siblings, 1 reply; 6+ messages in thread
From: Dave McCracken @ 2010-05-17 19:10 UTC (permalink / raw)
  To: Keir Fraser; +Cc: Jeremy Fitzhardinge, Xen Developers List

[-- Attachment #1: Type: Text/Plain, Size: 360 bytes --]


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.

[-- Attachment #2: xen-unstable-smigrate-1.patch --]
[-- Type: text/x-patch, Size: 824 bytes --]

--- xen-unstable//xen/include/asm-x86/guest_pt.h	2010-04-19 09:23:24.000000000 -0500
+++ xen-hmigrate//xen/include/asm-x86/guest_pt.h	2010-05-17 14:00:34.000000000 -0500
@@ -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

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Allow PV superpages to work with live migration
  2010-05-17 19:10 [PATCH] Allow PV superpages to work with live migration Dave McCracken
@ 2010-05-18 12:35 ` Tim Deegan
  2010-05-18 14:20   ` Dave McCracken
  0 siblings, 1 reply; 6+ messages in thread
From: Tim Deegan @ 2010-05-18 12:35 UTC (permalink / raw)
  To: Dave McCracken; +Cc: Jeremy Fitzhardinge, Xen Developers List, Keir Fraser

At 20:10 +0100 on 17 May (1274127046), Dave McCracken wrote:
> 
> 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
> --- xen-unstable//xen/include/asm-x86/guest_pt.h	2010-04-19 09:23:24.000000000 -0500
> +++ xen-hmigrate//xen/include/asm-x86/guest_pt.h	2010-05-17 14:00:34.000000000 -0500
> @@ -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

Content-Description: ATT00001..txt
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel


-- 
Tim Deegan <Tim.Deegan@citrix.com>
Principal Software Engineer, XenServer Engineering
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Allow PV superpages to work with live migration
  2010-05-18 12:35 ` Tim Deegan
@ 2010-05-18 14:20   ` Dave McCracken
  2010-05-18 14:32     ` Tim Deegan
  0 siblings, 1 reply; 6+ messages in thread
From: Dave McCracken @ 2010-05-18 14:20 UTC (permalink / raw)
  To: Tim Deegan; +Cc: Jeremy Fitzhardinge, Xen Developers List, Keir Fraser

On Tuesday, May 18, 2010, Tim Deegan wrote:
> > 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);

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Allow PV superpages to work with live migration
  2010-05-18 14:20   ` Dave McCracken
@ 2010-05-18 14:32     ` Tim Deegan
  2010-05-18 14:33       ` Keir Fraser
  2010-05-18 16:21       ` Dave McCracken
  0 siblings, 2 replies; 6+ messages in thread
From: Tim Deegan @ 2010-05-18 14:32 UTC (permalink / raw)
  To: Dave McCracken; +Cc: Jeremy Fitzhardinge, Xen Developers List, Keir Fraser

At 15:20 +0100 on 18 May (1274196018), Dave McCracken wrote:
> On Tuesday, May 18, 2010, Tim Deegan wrote:
> > 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?

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.

-- 
Tim Deegan <Tim.Deegan@citrix.com>
Principal Software Engineer, XenServer Engineering
Citrix Systems UK Ltd.  (Company #02937203, SL9 0BG)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Allow PV superpages to work with live migration
  2010-05-18 14:32     ` Tim Deegan
@ 2010-05-18 14:33       ` Keir Fraser
  2010-05-18 16:21       ` Dave McCracken
  1 sibling, 0 replies; 6+ messages in thread
From: Keir Fraser @ 2010-05-18 14:33 UTC (permalink / raw)
  To: Tim Deegan, Dave McCracken; +Cc: Jeremy Fitzhardinge, Xen Developers List

On 18/05/2010 15:32, "Tim Deegan" <Tim.Deegan@eu.citrix.com> wrote:

> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Allow PV superpages to work with live migration
  2010-05-18 14:32     ` Tim Deegan
  2010-05-18 14:33       ` Keir Fraser
@ 2010-05-18 16:21       ` Dave McCracken
  1 sibling, 0 replies; 6+ messages in thread
From: Dave McCracken @ 2010-05-18 16:21 UTC (permalink / raw)
  To: Tim Deegan; +Cc: Jeremy Fitzhardinge, Xen Developers List, Keir Fraser

On Tuesday, May 18, 2010, Tim Deegan wrote:
> At 15:20 +0100 on 18 May (1274196018), Dave McCracken wrote:
> > 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.

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.

On Tuesday, May 18, 2010, Keir wrote:
> I already fixed this when I applied the patch this morning.

Thanks.

Dave

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-05-18 16:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-17 19:10 [PATCH] Allow PV superpages to work with live migration Dave McCracken
2010-05-18 12:35 ` Tim Deegan
2010-05-18 14:20   ` Dave McCracken
2010-05-18 14:32     ` Tim Deegan
2010-05-18 14:33       ` Keir Fraser
2010-05-18 16:21       ` Dave McCracken

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.