Skip to contentSkip to conversation

x86: clarify shadow paging Dom0 support

PATCH In review Wei Liu 3 participants 6 messages Mar 27, 2017

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH v3 1/1 x86: clarify shadow paging Dom0 support

Classic PV shadow paging Dom0 has been broken for years, and can't possibly be configured after 4045953.

PVH shadow paging Dom0 should still be possible.

Change the code and documentation to clarify that.

---
v3:
1. don't panic

v2:
1. simplify need_paging
2. move panic to construct_dom0

Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Tim Deegan <[email protected]>
Cc George Dunlap <[email protected]>
Cc Roger Pau Monné <[email protected]>
---
 docs/misc/xen-command-line.markdown |  8 ++------
 xen/arch/x86/dom0_build.c           | 11 ++++++++---
 xen/arch/x86/pv/dom0_build.c        |  5 -----
 3 files changed, 10 insertions(+), 14 deletions(-)
docs/misc/xen-command-line.markdown +2 -6
index bdbdb8a53b..9eb85d68b5 100644
@@ -652,11 +652,6 @@ restrictions set up here. Note that the values to be specified here are
 ACPI PXM ones, not Xen internal node numbers. `relaxed` sets up vCPU
 affinities to prefer but be not limited to the specified node(s).
 
-### dom0\_shadow
-> `= <boolean>`
-
-This option is deprecated, please use `dom0=shadow` instead.
-
 ### dom0\_vcpus\_pin
 > `= <boolean>`
 
@@ -679,7 +674,8 @@ Flag that makes a dom0 boot in PVHv2 mode.
 
 > Default: `false`
 
-Flag that makes a dom0 use shadow paging.
+Flag that makes a dom0 use shadow paging. Only works when "pvh" is
+enabled.
 
 ### dtuart (ARM)
 > `= path [:options]`
xen/arch/x86/dom0_build.c +8 -3
index 20221b5e32..8597d43b11 100644
@@ -174,7 +174,6 @@ struct vcpu *__init alloc_dom0_vcpu0(struct domain *dom0)
 
 #ifdef CONFIG_SHADOW_PAGING
 bool __initdata opt_dom0_shadow;
-boolean_param("dom0_shadow", opt_dom0_shadow);
 #endif
 bool __initdata dom0_pvh;
 
@@ -252,8 +251,8 @@ unsigned long __init dom0_compute_nr_pages(
             avail -= max_pdx >> s;
     }
 
-    need_paging = is_hvm_domain(d) ? !iommu_hap_pt_share || !paging_mode_hap(d)
-                                   : opt_dom0_shadow;
+    need_paging = is_hvm_domain(d) &&
+        (!iommu_hap_pt_share || !paging_mode_hap(d));
     for ( ; ; need_paging = 0 )
     {
         nr_pages = dom0_nrpages;
@@ -456,6 +455,12 @@ int __init construct_dom0(struct domain *d, const module_t *image,
 
     process_pending_softirqs();
 
+    if ( opt_dom0_shadow && !dom0_pvh )
+    {
+        opt_dom0_shadow = false;
+        printk("Shadow Dom0 requires PVH. Option ignored.");
+    }
+
     return (is_hvm_domain(d) ? dom0_construct_pvh : dom0_construct_pv)
            (d, image, image_headroom, initrd,bootstrap_map, cmdline);
 }
xen/arch/x86/pv/dom0_build.c +0 -5
index 65cd2c5019..18c19a256f 100644
@@ -870,11 +870,6 @@ int __init dom0_construct_pv(struct domain *d,
     regs->rsi = vstartinfo_start;
     regs->eflags = X86_EFLAGS_IF;
 
-#ifdef CONFIG_SHADOW_PAGING
-    if ( opt_dom0_shadow && paging_enable(d, PG_SH_enable) == 0 )
-        paging_update_paging_modes(v);
-#endif
-
     if ( test_bit(XENFEAT_supervisor_mode_kernel, parms.f_required) )
         panic("Dom0 requires supervisor-mode execution");
 
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
author
#1 lore raw

xen/arch/x86/dom0_build.c int __init construct_dom0(struct domain *d, const module_t *image, · line 461

Quoted 5 lines · Wei Liu
xen/arch/x86/dom0_build.c +4 -0
+    if ( opt_dom0_shadow && !dom0_pvh )
+    {
+        opt_dom0_shadow = false;
+        printk("Shadow Dom0 requires PVH. Option ignored.");

There should be a '\n' at the end.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

Acked-by
#2 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 27.03.17 at 15:36, <[email protected]> wrote:

xen/arch/x86/dom0_build.c int __init construct_dom0(struct domain *d, const module_t *image, · line 461

Quoted 5 lines · Wei Liu
xen/arch/x86/dom0_build.c +4 -0
+    if ( opt_dom0_shadow && !dom0_pvh )
+    {
+        opt_dom0_shadow = false;
+        printk("Shadow Dom0 requires PVH. Option ignored.");

There should be a '\n' at the end.

With additionally XENLOG_WARNING added

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#3 lore raw
In reply to Wei Liu
Quoted 77 lines · Wei Liu

Classic PV shadow paging Dom0 has been broken for years, and can't possibly be configured after 4045953.

PVH shadow paging Dom0 should still be possible.

Change the code and documentation to clarify that.

---
v3:
1. don't panic

v2:
1. simplify need_paging
2. move panic to construct_dom0

Cc Jan Beulich <[email protected]>
Cc Andrew Cooper <[email protected]>
Cc Tim Deegan <[email protected]>
Cc George Dunlap <[email protected]>
Cc Roger Pau Monné <[email protected]>
---
 docs/misc/xen-command-line.markdown |  8 ++------
 xen/arch/x86/dom0_build.c           | 11 ++++++++---
 xen/arch/x86/pv/dom0_build.c        |  5 -----
 3 files changed, 10 insertions(+), 14 deletions(-)
docs/misc/xen-command-line.markdown +2 -6
index bdbdb8a53b..9eb85d68b5 100644
@@ -652,11 +652,6 @@ restrictions set up here. Note that the values to be specified here are
 ACPI PXM ones, not Xen internal node numbers. `relaxed` sets up vCPU
 affinities to prefer but be not limited to the specified node(s).
 
-### dom0\_shadow
-> `= <boolean>`
-
-This option is deprecated, please use `dom0=shadow` instead.
-
 ### dom0\_vcpus\_pin
 > `= <boolean>`
 
@@ -679,7 +674,8 @@ Flag that makes a dom0 boot in PVHv2 mode.
 
 > Default: `false`
 
-Flag that makes a dom0 use shadow paging.
+Flag that makes a dom0 use shadow paging. Only works when "pvh" is
+enabled.
 
 ### dtuart (ARM)
 > `= path [:options]`
xen/arch/x86/dom0_build.c +2 -3
index 20221b5e32..8597d43b11 100644
@@ -174,7 +174,6 @@ struct vcpu *__init alloc_dom0_vcpu0(struct domain *dom0)
 
 #ifdef CONFIG_SHADOW_PAGING
 bool __initdata opt_dom0_shadow;
-boolean_param("dom0_shadow", opt_dom0_shadow);
 #endif
 bool __initdata dom0_pvh;
 
@@ -252,8 +251,8 @@ unsigned long __init dom0_compute_nr_pages(
             avail -= max_pdx >> s;
     }
 
-    need_paging = is_hvm_domain(d) ? !iommu_hap_pt_share || !paging_mode_hap(d)
-                                   : opt_dom0_shadow;
+    need_paging = is_hvm_domain(d) &&
+        (!iommu_hap_pt_share || !paging_mode_hap(d));
     for ( ; ; need_paging = 0 )
     {
         nr_pages = dom0_nrpages;

xen/arch/x86/dom0_build.c int __init construct_dom0(struct domain *d, const module_t *image, · line 462

Quoted 8 lines
xen/arch/x86/dom0_build.c +5 -0
@@ -456,6 +455,12 @@ int __init construct_dom0(struct domain *d, const module_t *image,
 
     process_pending_softirqs();
 
+    if ( opt_dom0_shadow && !dom0_pvh )
+    {
+        opt_dom0_shadow = false;
+        printk("Shadow Dom0 requires PVH. Option ignored.");
+    }

This needs to be inside a #ifdef CONFIG_SHADOW_PAGING to avoid breaking the build.

With the other corrections as well, Reviewed-by: Andrew Cooper <[email protected]>

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

author
#4 lore raw
Quoted 4 lines · Andrew Cooper

This needs to be inside a #ifdef CONFIG_SHADOW_PAGING to avoid breaking the build.

I just found out there is a similar issue in x86/setup.c and I sent a separate patch to fix that.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#5 lore raw
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 27.03.17 at 16:15, <[email protected]> wrote:
Quoted 4 lines · Andrew Cooper

This needs to be inside a #ifdef CONFIG_SHADOW_PAGING to avoid breaking the build.

I just found out there is a similar issue in x86/setup.c and I sent a separate patch to fix that.

The situation there is different: What you can't have without CONFIG_SHADOW_PAGING is the identifier used as an lvalue.

Jan

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel