* [v3] libxc: Expose the 1GB pages cpuid flag to guest
@ 2014-11-28 3:28 Liang Li
2014-11-28 9:16 ` Jan Beulich
0 siblings, 1 reply; 6+ messages in thread
From: Liang Li @ 2014-11-28 3:28 UTC (permalink / raw)
To: xen-devel
Cc: wei.liu2, ian.campbell, stefano.stabellini, tim, Liang Li,
ian.jackson, JBeulich, andrew.cooper3, yang.z.zhang
If hardware support the 1GB pages, expose the feature to guest by
default. Users don't have to use a 'cpuid= ' option in config fil
e to turn it on.
Signed-off-by: Liang Li <liang.z.li@intel.com>
Signed-off-by: Yang Zhang <yang.z.zhang@intel.com>
---
tools/libxc/xc_cpuid_x86.c | 3 +++
xen/arch/x86/hvm/hvm.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c
index a18b1ff..c97f91a 100644
--- a/tools/libxc/xc_cpuid_x86.c
+++ b/tools/libxc/xc_cpuid_x86.c
@@ -109,6 +109,7 @@ static void amd_xc_cpuid_policy(
regs[3] &= (0x0183f3ff | /* features shared with 0x00000001:EDX */
bitmaskof(X86_FEATURE_NX) |
bitmaskof(X86_FEATURE_LM) |
+ bitmaskof(X86_FEATURE_PAGE1GB) |
bitmaskof(X86_FEATURE_SYSCALL) |
bitmaskof(X86_FEATURE_MP) |
bitmaskof(X86_FEATURE_MMXEXT) |
@@ -192,6 +193,7 @@ static void intel_xc_cpuid_policy(
bitmaskof(X86_FEATURE_ABM));
regs[3] &= (bitmaskof(X86_FEATURE_NX) |
bitmaskof(X86_FEATURE_LM) |
+ bitmaskof(X86_FEATURE_PAGE1GB) |
bitmaskof(X86_FEATURE_SYSCALL) |
bitmaskof(X86_FEATURE_RDTSCP));
break;
@@ -386,6 +388,7 @@ static void xc_cpuid_hvm_policy(
clear_bit(X86_FEATURE_LM, regs[3]);
clear_bit(X86_FEATURE_NX, regs[3]);
clear_bit(X86_FEATURE_PSE36, regs[3]);
+ clear_bit(X86_FEATURE_PAGE1GB, regs[3]);
}
break;
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 8f49b44..c825618 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -4287,7 +4287,7 @@ void hvm_cpuid(unsigned int input, unsigned int *eax, unsigned int *ebx,
!host_tsc_is_safe() )
*edx &= ~cpufeat_mask(X86_FEATURE_RDTSCP);
/* Hide 1GB-superpage feature if we can't emulate it. */
- if (!hvm_pse1gb_supported(d))
+ if (!hvm_pse1gb_supported(d) || paging_mode_shadow(d))
*edx &= ~cpufeat_mask(X86_FEATURE_PAGE1GB);
/* Only provide PSE36 when guest runs in 32bit PAE or in long mode */
if ( !(hvm_pae_enabled(v) || hvm_long_mode_enabled(v)) )
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [v3] libxc: Expose the 1GB pages cpuid flag to guest
2014-11-28 3:28 [v3] libxc: Expose the 1GB pages cpuid flag to guest Liang Li
@ 2014-11-28 9:16 ` Jan Beulich
2014-11-28 10:29 ` Li, Liang Z
0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2014-11-28 9:16 UTC (permalink / raw)
To: Liang Li
Cc: tim, wei.liu2, ian.campbell, stefano.stabellini, andrew.cooper3,
ian.jackson, xen-devel, yang.z.zhang
>>> On 28.11.14 at 04:28, <liang.z.li@intel.com> wrote:
> --- a/xen/arch/x86/hvm/hvm.c
> +++ b/xen/arch/x86/hvm/hvm.c
> @@ -4287,7 +4287,7 @@ void hvm_cpuid(unsigned int input, unsigned int *eax, unsigned int *ebx,
> !host_tsc_is_safe() )
> *edx &= ~cpufeat_mask(X86_FEATURE_RDTSCP);
> /* Hide 1GB-superpage feature if we can't emulate it. */
> - if (!hvm_pse1gb_supported(d))
> + if (!hvm_pse1gb_supported(d) || paging_mode_shadow(d))
> *edx &= ~cpufeat_mask(X86_FEATURE_PAGE1GB);
With
#define hvm_pse1gb_supported(d) \
(cpu_has_page1gb && paging_mode_hap(d))
the change above is pointless. While, considering this, comments on
v2 may have been misleading, you should have simply updated the
patch description instead to clarify why the v2 change was okay
even for the shadow mode case.
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v3] libxc: Expose the 1GB pages cpuid flag to guest
2014-11-28 9:16 ` Jan Beulich
@ 2014-11-28 10:29 ` Li, Liang Z
2014-11-28 10:32 ` Andrew Cooper
2014-11-28 10:39 ` Jan Beulich
0 siblings, 2 replies; 6+ messages in thread
From: Li, Liang Z @ 2014-11-28 10:29 UTC (permalink / raw)
To: Jan Beulich
Cc: tim@xen.org, wei.liu2@citrix.com, ian.campbell@citrix.com,
stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com,
ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, Zhang, Yang Z
>> - if (!hvm_pse1gb_supported(d))
>> + if (!hvm_pse1gb_supported(d) || paging_mode_shadow(d))
>> *edx &= ~cpufeat_mask(X86_FEATURE_PAGE1GB);
>
>With
>
>#define hvm_pse1gb_supported(d) \
> (cpu_has_page1gb && paging_mode_hap(d))
>the change above is pointless. While, considering this, comments on
>v2 may have been misleading, you should have simply updated the patch description instead to clarify why the v2 change was okay even for the shadow mode case.
I checked the code and found that for a normal guest can only be in hap mode or shadow mode before I sending the patch, but I am not share if it's true for dom0.
Liang
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v3] libxc: Expose the 1GB pages cpuid flag to guest
2014-11-28 10:29 ` Li, Liang Z
@ 2014-11-28 10:32 ` Andrew Cooper
2014-11-28 10:38 ` Li, Liang Z
2014-11-28 10:39 ` Jan Beulich
1 sibling, 1 reply; 6+ messages in thread
From: Andrew Cooper @ 2014-11-28 10:32 UTC (permalink / raw)
To: Li, Liang Z, Jan Beulich
Cc: wei.liu2@citrix.com, ian.campbell@citrix.com,
stefano.stabellini@eu.citrix.com, tim@xen.org,
ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, Zhang, Yang Z
On 28/11/14 10:29, Li, Liang Z wrote:
>>> - if (!hvm_pse1gb_supported(d))
>>> + if (!hvm_pse1gb_supported(d) || paging_mode_shadow(d))
>>> *edx &= ~cpufeat_mask(X86_FEATURE_PAGE1GB);
>> With
>>
>> #define hvm_pse1gb_supported(d) \
>> (cpu_has_page1gb && paging_mode_hap(d))
>> the change above is pointless. While, considering this, comments on
>> v2 may have been misleading, you should have simply updated the patch description instead to clarify why the v2 change was okay even for the shadow mode case.
> I checked the code and found that for a normal guest can only be in hap mode or shadow mode before I sending the patch, but I am not share if it's true for dom0.
>
> Liang
Dom0 may either be PV (in which case neither hap nor shadow, and cant
use 1GB pages anyway), or experimentally PVH which is currently
restricted to hap.
~Andrew
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v3] libxc: Expose the 1GB pages cpuid flag to guest
2014-11-28 10:32 ` Andrew Cooper
@ 2014-11-28 10:38 ` Li, Liang Z
0 siblings, 0 replies; 6+ messages in thread
From: Li, Liang Z @ 2014-11-28 10:38 UTC (permalink / raw)
To: Andrew Cooper, Jan Beulich
Cc: wei.liu2@citrix.com, ian.campbell@citrix.com,
stefano.stabellini@eu.citrix.com, tim@xen.org,
ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, Zhang, Yang Z
>>> (cpu_has_page1gb && paging_mode_hap(d)) the change above is
>>> pointless. While, considering this, comments on
>>> v2 may have been misleading, you should have simply updated the patch description instead to clarify why the v2 change was okay even for the shadow mode case.
>> I checked the code and found that for a normal guest can only be in hap mode or shadow mode before I sending the patch, but I am not share if it's true for dom0.
>>
>> Liang
>
> Dom0 may either be PV (in which case neither hap nor shadow, and cant use 1GB pages anyway), or experimentally PVH which is currently restricted to hap.
>
>~Andrew
Thanks for clarification. I will resend the v2 patch.
Liang
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v3] libxc: Expose the 1GB pages cpuid flag to guest
2014-11-28 10:29 ` Li, Liang Z
2014-11-28 10:32 ` Andrew Cooper
@ 2014-11-28 10:39 ` Jan Beulich
1 sibling, 0 replies; 6+ messages in thread
From: Jan Beulich @ 2014-11-28 10:39 UTC (permalink / raw)
To: Liang Z Li
Cc: tim@xen.org, wei.liu2@citrix.com, ian.campbell@citrix.com,
stefano.stabellini@eu.citrix.com, andrew.cooper3@citrix.com,
ian.jackson@eu.citrix.com, xen-devel@lists.xen.org, Yang Z Zhang
>>> On 28.11.14 at 11:29, <liang.z.li@intel.com> wrote:
>> > - if (!hvm_pse1gb_supported(d))
>>> + if (!hvm_pse1gb_supported(d) || paging_mode_shadow(d))
>>> *edx &= ~cpufeat_mask(X86_FEATURE_PAGE1GB);
>>
>>With
>>
>>#define hvm_pse1gb_supported(d) \
>> (cpu_has_page1gb && paging_mode_hap(d))
>
>>the change above is pointless. While, considering this, comments on
>>v2 may have been misleading, you should have simply updated the patch
> description instead to clarify why the v2 change was okay even for the shadow
> mode case.
>
> I checked the code and found that for a normal guest can only be in hap mode
> or shadow mode before I sending the patch, but I am not share if it's true
> for dom0.
The CPUID code in libxc doesn't apply to Dom0 at all, and CPUID
handling is also special cased in the hypervisor for Dom0. Plus
finally Dom0 only possibly being PV or PVH, PVH requiring HAP
and PV generally not allowing large pages anyway, your concern
is unnecessary.
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-11-28 10:39 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-28 3:28 [v3] libxc: Expose the 1GB pages cpuid flag to guest Liang Li
2014-11-28 9:16 ` Jan Beulich
2014-11-28 10:29 ` Li, Liang Z
2014-11-28 10:32 ` Andrew Cooper
2014-11-28 10:38 ` Li, Liang Z
2014-11-28 10:39 ` Jan Beulich
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.