x86/xen: cpuid() cleanup
Subsystems (2)
Juergen Gross
maintainercover x86/xen: cpuid() cleanup
Reduce special casing of xen_cpuid() and disable DCA feature for pv domains as it isn't supported under Xen.
Juergen Gross (2):
x86/xen: don't indicate DCA support in pv domains x86/xen: use capabilities instead of fake cpuid values
arch/x86/xen/enlighten.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
Signature · 1 line
2.10.2
Juergen Gross
maintainerPATCH 1/2 x86/xen: don't indicate DCA support in pv domains
Xen doesn't support DCA (direct cache access) for pv domains. Clear the corresponding capability indicator.
--- arch/x86/xen/enlighten.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/xen/enlighten.c +3 -0
@@ -461,6 +461,9 @@ static void __init xen_init_cpuid_mask(void) cpuid_leaf1_ecx_mask &= ~xsave_mask;/* disable XSAVE & OSXSAVE */ if (xen_check_mwait ()) cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT %32 )); + +/* Disable DCA feature. */ +setup_clear_cpu_cap (X86_FEATURE_DCA ); }static void xen_set_debugreg (int reg,unsigned long val)
Signature · 7 lines
2.10.2 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH 1/2 x86/xen: don't indicate DCA support in pv domains
In reply to Juergen GrossXen doesn't support DCA (direct cache access) for pv domains. Clear the corresponding capability indicator.
--- arch/x86/xen/enlighten.c | 3 +++ 1 file changed, 3 insertions(+)
arch/x86/xen/enlighten.c +3 -0
@@ -461,6 +461,9 @@ static void __init xen_init_cpuid_mask(void) cpuid_leaf1_ecx_mask &= ~xsave_mask;/* disable XSAVE & OSXSAVE */ if (xen_check_mwait ()) cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT %32 )); + +/* Disable DCA feature. */ +setup_clear_cpu_cap (X86_FEATURE_DCA ); }static void xen_set_debugreg (int reg,unsigned long val)
Signature · 1 line
2.10.2
Juergen Gross
maintainerPATCH 2/2 x86/xen: use capabilities instead of fake cpuid values
In reply to Juergen GrossWhen running as pv domain xen_cpuid() is being used instead of native_cpuid(). In xen_cpuid() the aperf/mperf feature is indicated as not being present by special casing the related cpuid leaf.
Instead of delivering fake cpuid values clear the cpu capability bit for aperf/mperf instead.
--- arch/x86/xen/enlighten.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
arch/x86/xen/enlighten.c +3 -8
@@ -301,9 +301,6 @@ xen_running_on_version_or_later(unsigned int major, unsigned int minor)return false; } -#define CPUID_THERM_POWER_LEAF 6 -#define APERFMPERF_PRESENT 0 -static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0 ;static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0 ;
@@ -337,11 +334,6 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, *dx = cpuid_leaf5_edx_val;return ; -case CPUID_THERM_POWER_LEAF : -/* Disabling APERFMPERF for kernel usage */ - maskecx = ~(1 <<APERFMPERF_PRESENT ); -break ; -case 0xb :/* Suppress extended topology stuff */ maskebx =0 ;
@@ -462,6 +454,9 @@ static void __init xen_init_cpuid_mask(void)if (xen_check_mwait ()) cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT %32 )); +/* Disable APERFMPERF feature. */ +setup_clear_cpu_cap (X86_FEATURE_APERFMPERF ); +/* Disable DCA feature. */ setup_clear_cpu_cap (X86_FEATURE_DCA ); }
Signature · 7 lines
2.10.2 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Juergen Gross
maintainerPATCH 2/2 x86/xen: use capabilities instead of fake cpuid values
In reply to Juergen GrossWhen running as pv domain xen_cpuid() is being used instead of native_cpuid(). In xen_cpuid() the aperf/mperf feature is indicated as not being present by special casing the related cpuid leaf.
Instead of delivering fake cpuid values clear the cpu capability bit for aperf/mperf instead.
--- arch/x86/xen/enlighten.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
arch/x86/xen/enlighten.c +3 -8
@@ -301,9 +301,6 @@ xen_running_on_version_or_later(unsigned int major, unsigned int minor)return false; } -#define CPUID_THERM_POWER_LEAF 6 -#define APERFMPERF_PRESENT 0 -static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0 ;static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0 ;
@@ -337,11 +334,6 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, *dx = cpuid_leaf5_edx_val;return ; -case CPUID_THERM_POWER_LEAF : -/* Disabling APERFMPERF for kernel usage */ - maskecx = ~(1 <<APERFMPERF_PRESENT ); -break ; -case 0xb :/* Suppress extended topology stuff */ maskebx =0 ;
@@ -462,6 +454,9 @@ static void __init xen_init_cpuid_mask(void)if (xen_check_mwait ()) cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT %32 )); +/* Disable APERFMPERF feature. */ +setup_clear_cpu_cap (X86_FEATURE_APERFMPERF ); +/* Disable DCA feature. */ setup_clear_cpu_cap (X86_FEATURE_DCA ); }
Signature · 1 line
2.10.2
Boris Ostrovsky
reviewerRe: [PATCH 2/2] x86/xen: use capabilities instead of fake cpuid values
Quoted 27 lines · Juergen Gross
When running as pv domain
xen_cpuid()is being used instead ofnative_cpuid(). Inxen_cpuid()the aperf/mperf feature is indicated as not being present by special casing the related cpuid leaf.Instead of delivering fake cpuid values clear the cpu capability bit for aperf/mperf instead.
Signed-off-by Juergen Gross <[email protected]>--- arch/x86/xen/enlighten.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)arch/x86/xen/enlighten.c +0
-3@@ -301,9 +301,6 @@ xen_running_on_version_or_later(unsigned int major, unsigned int minor)return false; } -#define CPUID_THERM_POWER_LEAF 6 -#define APERFMPERF_PRESENT 0 -static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0 ;static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0 ;
arch/x86/xen/enlighten.c static void xen_cpuid(unsigned int *ax, unsigned int *bx, · line 344
Quoted 8 lines
arch/x86/xen/enlighten.c +0
-5@@ -337,11 +334,6 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, *dx = cpuid_leaf5_edx_val;return ; -case CPUID_THERM_POWER_LEAF : -/* Disabling APERFMPERF for kernel usage */ - maskecx = ~(1 <<APERFMPERF_PRESENT ); -break ; -
But now APERF/MPERF will be reported as supported by CPUID, won't it?
arch/x86/xen/enlighten.c static void __init xen_init_cpuid_mask(void) · line 461
Quoted 12 lines
arch/x86/xen/enlighten.c +3
-0case 0xb :/* Suppress extended topology stuff */ maskebx =0 ;@@ -462,6 +454,9 @@ static void __init xen_init_cpuid_mask(void)if (xen_check_mwait ()) cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT %32 )); +/* Disable APERFMPERF feature. */ +setup_clear_cpu_cap (X86_FEATURE_APERFMPERF ); +/* Disable DCA feature. */ setup_clear_cpu_cap (X86_FEATURE_DCA );
I think both of those can go to xen_set_cpu_features().
-boris
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Boris Ostrovsky
reviewerRe: [PATCH 2/2] x86/xen: use capabilities instead of fake cpuid values
In reply to Juergen GrossQuoted 27 lines · Juergen Gross
When running as pv domain
xen_cpuid()is being used instead ofnative_cpuid(). Inxen_cpuid()the aperf/mperf feature is indicated as not being present by special casing the related cpuid leaf.Instead of delivering fake cpuid values clear the cpu capability bit for aperf/mperf instead.
Signed-off-by Juergen Gross <[email protected]>--- arch/x86/xen/enlighten.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)arch/x86/xen/enlighten.c +0
-3@@ -301,9 +301,6 @@ xen_running_on_version_or_later(unsigned int major, unsigned int minor)return false; } -#define CPUID_THERM_POWER_LEAF 6 -#define APERFMPERF_PRESENT 0 -static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0 ;static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0 ;
arch/x86/xen/enlighten.c static void xen_cpuid(unsigned int *ax, unsigned int *bx, · line 344
Quoted 8 lines
arch/x86/xen/enlighten.c +0
-5@@ -337,11 +334,6 @@ static void xen_cpuid(unsigned int *ax, unsigned int *bx, *dx = cpuid_leaf5_edx_val;return ; -case CPUID_THERM_POWER_LEAF : -/* Disabling APERFMPERF for kernel usage */ - maskecx = ~(1 <<APERFMPERF_PRESENT ); -break ; -
But now APERF/MPERF will be reported as supported by CPUID, won't it?
arch/x86/xen/enlighten.c static void __init xen_init_cpuid_mask(void) · line 461
Quoted 12 lines
arch/x86/xen/enlighten.c +3
-0case 0xb :/* Suppress extended topology stuff */ maskebx =0 ;@@ -462,6 +454,9 @@ static void __init xen_init_cpuid_mask(void)if (xen_check_mwait ()) cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT %32 )); +/* Disable APERFMPERF feature. */ +setup_clear_cpu_cap (X86_FEATURE_APERFMPERF ); +/* Disable DCA feature. */ setup_clear_cpu_cap (X86_FEATURE_DCA );
I think both of those can go to xen_set_cpu_features().
-boris
Juergen Gross
maintainerRe: [PATCH 2/2] x86/xen: use capabilities instead of fake cpuid values
Quoted 35 lines · Boris Ostrovsky
Quoted 32 lines · Juergen Gross
When running as pv domain
xen_cpuid()is being used instead ofnative_cpuid(). Inxen_cpuid()the aperf/mperf feature is indicated as not being present by special casing the related cpuid leaf.Instead of delivering fake cpuid values clear the cpu capability bit for aperf/mperf instead.
Signed-off-by Juergen Gross <[email protected]>--- arch/x86/xen/enlighten.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)arch/x86/xen/enlighten.c +0
-3@@ -301,9 +301,6 @@ xen_running_on_version_or_later(unsigned int major, unsigned int minor)return false; } -#define CPUID_THERM_POWER_LEAF 6 -#define APERFMPERF_PRESENT 0 -static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0 ;static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0 ;@@ -337,11 +334,6 @@ static void xen_cpuid(unsigned int *ax, unsignedint *bx, *dx = cpuid_leaf5_edx_val;return ;
Quoted 8 lines
arch/x86/xen/enlighten.c static void xen_cpuid(unsigned int *ax, unsigned int *bx, · line 344
Quoted 5 lines
arch/x86/xen/enlighten.c +0
-5-case CPUID_THERM_POWER_LEAF : -/* Disabling APERFMPERF for kernel usage */ - maskecx = ~(1 <<APERFMPERF_PRESENT ); -break ; -But now APERF/MPERF will be reported as supported by CPUID, won't it?
Yes. But this shouldn't be a problem as the kernel is always testing X86_FEATURE_APERFMPERF for testing the support.
Quoted 7 lines
Quoted 7 lines
arch/x86/xen/enlighten.c +0
-0case 0xb :/* Suppress extended topology stuff */ maskebx = 0;arch/x86/xen/enlighten.c +0
-0@@ -462,6 +454,9 @@ static void __init xen_init_cpuid_mask(void)if (xen_check_mwait ()) cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT %32 ));
Quoted 8 lines
arch/x86/xen/enlighten.c static void __init xen_init_cpuid_mask(void) · line 461
Quoted 5 lines
arch/x86/xen/enlighten.c +3
-0+/* Disable APERFMPERF feature. */ +setup_clear_cpu_cap (X86_FEATURE_APERFMPERF ); +/* Disable DCA feature. */ setup_clear_cpu_cap (X86_FEATURE_DCA );I think both of those can go to
xen_set_cpu_features().
Okay. I'll move them.
I think we can convert some of the remaining cpuid bit modifications to cpu capabilities as well.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Juergen Gross
maintainerRe: [PATCH 2/2] x86/xen: use capabilities instead of fake cpuid values
In reply to Boris OstrovskyQuoted 35 lines · Boris Ostrovsky
Quoted 32 lines · Juergen Gross
When running as pv domain
xen_cpuid()is being used instead ofnative_cpuid(). Inxen_cpuid()the aperf/mperf feature is indicated as not being present by special casing the related cpuid leaf.Instead of delivering fake cpuid values clear the cpu capability bit for aperf/mperf instead.
Signed-off-by Juergen Gross <[email protected]>--- arch/x86/xen/enlighten.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)arch/x86/xen/enlighten.c +0
-3@@ -301,9 +301,6 @@ xen_running_on_version_or_later(unsigned int major, unsigned int minor)return false; } -#define CPUID_THERM_POWER_LEAF 6 -#define APERFMPERF_PRESENT 0 -static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0 ;static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0 ;@@ -337,11 +334,6 @@ static void xen_cpuid(unsigned int *ax, unsignedint *bx, *dx = cpuid_leaf5_edx_val;return ;
Quoted 8 lines
arch/x86/xen/enlighten.c static void xen_cpuid(unsigned int *ax, unsigned int *bx, · line 344
Quoted 5 lines
arch/x86/xen/enlighten.c +0
-5-case CPUID_THERM_POWER_LEAF : -/* Disabling APERFMPERF for kernel usage */ - maskecx = ~(1 <<APERFMPERF_PRESENT ); -break ; -But now APERF/MPERF will be reported as supported by CPUID, won't it?
Yes. But this shouldn't be a problem as the kernel is always testing X86_FEATURE_APERFMPERF for testing the support.
Quoted 7 lines
Quoted 7 lines
arch/x86/xen/enlighten.c +0
-0case 0xb :/* Suppress extended topology stuff */ maskebx = 0;arch/x86/xen/enlighten.c +0
-0@@ -462,6 +454,9 @@ static void __init xen_init_cpuid_mask(void)if (xen_check_mwait ()) cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT %32 ));
Quoted 8 lines
arch/x86/xen/enlighten.c static void __init xen_init_cpuid_mask(void) · line 461
Quoted 5 lines
arch/x86/xen/enlighten.c +3
-0+/* Disable APERFMPERF feature. */ +setup_clear_cpu_cap (X86_FEATURE_APERFMPERF ); +/* Disable DCA feature. */ setup_clear_cpu_cap (X86_FEATURE_DCA );I think both of those can go to
xen_set_cpu_features().
Okay. I'll move them.
I think we can convert some of the remaining cpuid bit modifications to cpu capabilities as well.
Juergen
Boris Ostrovsky
reviewerRe: [PATCH 2/2] x86/xen: use capabilities instead of fake cpuid values
Quoted 45 lines · Juergen Gross
Quoted 35 lines · Boris Ostrovsky
Quoted 32 lines · Juergen Gross
When running as pv domain
xen_cpuid()is being used instead ofnative_cpuid(). Inxen_cpuid()the aperf/mperf feature is indicated as not being present by special casing the related cpuid leaf.Instead of delivering fake cpuid values clear the cpu capability bit for aperf/mperf instead.
Signed-off-by Juergen Gross <[email protected]>--- arch/x86/xen/enlighten.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)arch/x86/xen/enlighten.c +0
-3@@ -301,9 +301,6 @@ xen_running_on_version_or_later(unsigned int major, unsigned int minor)return false; } -#define CPUID_THERM_POWER_LEAF 6 -#define APERFMPERF_PRESENT 0 -static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0 ;static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0 ;@@ -337,11 +334,6 @@ static void xen_cpuid(unsigned int *ax, unsignedint *bx, *dx = cpuid_leaf5_edx_val;return ;Quoted 8 lines
arch/x86/xen/enlighten.c static void xen_cpuid(unsigned int *ax, unsigned int *bx, · line 344
Quoted 5 lines
arch/x86/xen/enlighten.c +0
-5-case CPUID_THERM_POWER_LEAF : -/* Disabling APERFMPERF for kernel usage */ - maskecx = ~(1 <<APERFMPERF_PRESENT ); -break ; -But now APERF/MPERF will be reported as supported by CPUID, won't it?
Quoted 2 lines
Yes. But this shouldn't be a problem as the kernel is always testing
X86_FEATURE_APERFMPERFfor testing the support.
But X86_FEATURE_APERFMPERF cap is set based on CPUID query.
-boris
Quoted 17 lines
Quoted 8 lines
Quoted 8 lines
arch/x86/xen/enlighten.c +0
-0case 0xb :/* Suppress extended topology stuff */ maskebx = 0;arch/x86/xen/enlighten.c +0
-0@@ -462,6 +454,9 @@ static void __init xen_init_cpuid_mask(void)if (xen_check_mwait ()) cpuid_leaf1_ecx_set_mask = (1 << (X86_FEATURE_MWAIT %32 ));Quoted 8 lines
arch/x86/xen/enlighten.c static void __init xen_init_cpuid_mask(void) · line 461
Quoted 5 lines
arch/x86/xen/enlighten.c +3
-0+/* Disable APERFMPERF feature. */ +setup_clear_cpu_cap (X86_FEATURE_APERFMPERF ); +/* Disable DCA feature. */ setup_clear_cpu_cap (X86_FEATURE_DCA );I think both of those can go to
xen_set_cpu_features().
Quoted 8 lines
Okay. I'll move them.
I think we can convert some of the remaining cpuid bit modifications to cpu capabilities as well.
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Juergen Gross
maintainerRe: [PATCH 2/2] x86/xen: use capabilities instead of fake cpuid values
Quoted 48 lines · Boris Ostrovsky
Quoted 45 lines · Juergen Gross
Quoted 43 lines · Boris Ostrovsky
Quoted 28 lines · Juergen Gross
When running as pv domain
xen_cpuid()is being used instead ofnative_cpuid(). Inxen_cpuid()the aperf/mperf feature is indicated as not being present by special casing the related cpuid leaf.Instead of delivering fake cpuid values clear the cpu capability bit for aperf/mperf instead.
Signed-off-by Juergen Gross <[email protected]>--- arch/x86/xen/enlighten.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)arch/x86/xen/enlighten.c +0
-3@@ -301,9 +301,6 @@ xen_running_on_version_or_later(unsigned int major, unsigned int minor)return false; } -#define CPUID_THERM_POWER_LEAF 6 -#define APERFMPERF_PRESENT 0 -static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0 ;static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0 ;arch/x86/xen/enlighten.c static void xen_cpuid(unsigned int *ax, unsigned · line 345
Quoted 9 lines
arch/x86/xen/enlighten.c +0
-5@@ -337,11 +334,6 @@ static void xen_cpuid(unsigned int *ax, unsignedint *bx, *dx = cpuid_leaf5_edx_val;return ; -case CPUID_THERM_POWER_LEAF : -/* Disabling APERFMPERF for kernel usage */ - maskecx = ~(1 <<APERFMPERF_PRESENT ); -break ; -But now APERF/MPERF will be reported as supported by CPUID, won't it?
Quoted 5 lines
Quoted 2 lines
Yes. But this shouldn't be a problem as the kernel is always testing
X86_FEATURE_APERFMPERFfor testing the support.But
X86_FEATURE_APERFMPERFcap is set based on CPUID query.
Right. And setup_clear_cpu_cap() will result in removing the feature from the capabilities (removes it from boot cpu capabilities at once and is setting it in the mask which is negated and anded into the capabilities after issuing the cpuid queries).
Juergen
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Juergen Gross
maintainerRe: [PATCH 2/2] x86/xen: use capabilities instead of fake cpuid values
In reply to Boris OstrovskyQuoted 48 lines · Boris Ostrovsky
Quoted 45 lines · Juergen Gross
Quoted 43 lines · Boris Ostrovsky
Quoted 28 lines · Juergen Gross
When running as pv domain
xen_cpuid()is being used instead ofnative_cpuid(). Inxen_cpuid()the aperf/mperf feature is indicated as not being present by special casing the related cpuid leaf.Instead of delivering fake cpuid values clear the cpu capability bit for aperf/mperf instead.
Signed-off-by Juergen Gross <[email protected]>--- arch/x86/xen/enlighten.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)arch/x86/xen/enlighten.c +0
-3@@ -301,9 +301,6 @@ xen_running_on_version_or_later(unsigned int major, unsigned int minor)return false; } -#define CPUID_THERM_POWER_LEAF 6 -#define APERFMPERF_PRESENT 0 -static __read_mostly unsigned int cpuid_leaf1_edx_mask = ~0 ;static __read_mostly unsigned int cpuid_leaf1_ecx_mask = ~0 ;arch/x86/xen/enlighten.c static void xen_cpuid(unsigned int *ax, unsigned · line 345
Quoted 9 lines
arch/x86/xen/enlighten.c +0
-5@@ -337,11 +334,6 @@ static void xen_cpuid(unsigned int *ax, unsignedint *bx, *dx = cpuid_leaf5_edx_val;return ; -case CPUID_THERM_POWER_LEAF : -/* Disabling APERFMPERF for kernel usage */ - maskecx = ~(1 <<APERFMPERF_PRESENT ); -break ; -But now APERF/MPERF will be reported as supported by CPUID, won't it?
Quoted 5 lines
Quoted 2 lines
Yes. But this shouldn't be a problem as the kernel is always testing
X86_FEATURE_APERFMPERFfor testing the support.But
X86_FEATURE_APERFMPERFcap is set based on CPUID query.
Right. And setup_clear_cpu_cap() will result in removing the feature from the capabilities (removes it from boot cpu capabilities at once and is setting it in the mask which is negated and anded into the capabilities after issuing the cpuid queries).
Juergen