kvm/i386: fix a check that ensures we are running on host intel CPU
PATCH 1/1 kvm/i386: fix a check that ensures we are running on host intel CPU
is_host_cpu_intel() returns TRUE if the host cpu in Intel based. RAPL needs Intel host cpus. If the host CPU is not Intel baseed, we should report error. Fix the check accordingly.
--- target/i386/kvm/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target/i386/kvm/kvm.c +1 -1
@@ -2898,7 +2898,7 @@ static int kvm_msr_energy_thread_init(KVMState *s, MachineState *ms)* 1. Host cpu must be Intel cpu * 2. RAPL must be enabled on the Host */ -if (is_host_cpu_intel ()) { +if (!is_host_cpu_intel ()) {error_report ("The RAPL feature can only be enabled on hosts\ with Intel CPU models" ); ret =1 ;
Signature · 1 line
2.42.0
Paolo Bonzini
maintainerQuoted 5 lines · Ani Sinha
is_host_cpu_intel()returns TRUE if the host cpu in Intel based. RAPL needs Intel host cpus. If the host CPU is not Intel baseed, we should report error. Fix the check accordingly.Signed-off-by Ani Sinha <[email protected]>
It's the function that is returning the incorrect value too; so your patch is breaking the feature: this line in is_host_cpu_intel()
return strcmp(vendor, CPUID_VENDOR_INTEL);
needs to be changed to use g_str_equal.
Paolo
Quoted 17 lines
--- target/i386/kvm/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/i386/kvm/kvm.c +1
-1@@ -2898,7 +2898,7 @@ static int kvm_msr_energy_thread_init(KVMState *s, MachineState *ms)* 1. Host cpu must be Intel cpu * 2. RAPL must be enabled on the Host */ -if (is_host_cpu_intel ()) { +if (!is_host_cpu_intel ()) {error_report ("The RAPL feature can only be enabled on hosts\ with Intel CPU models" ); ret =1 ;
Quoted 10 lines · Paolo Bonzini
Quoted 4 lines · Ani Sinha
is_host_cpu_intel()returns TRUE if the host cpu in Intel based. RAPL needs Intel host cpus. If the host CPU is not Intel baseed, we should report error. Fix the check accordingly.Signed-off-by Ani Sinha <[email protected]>
Quoted 5 lines
It's the function that is returning the incorrect value too; so your patch is breaking the feature: this line in
is_host_cpu_intel()return
strcmp(vendor, CPUID_VENDOR_INTEL);needs to be changed to use
g_str_equal.
Ah that is why it got unnoticed as programatically it was not broken. I will send a v2.
Quoted 20 lines
Paolo
Quoted 16 lines
--- target/i386/kvm/kvm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)target/i386/kvm/kvm.c +1
-1@@ -2898,7 +2898,7 @@ static int kvm_msr_energy_thread_init(KVMState *s, MachineState *ms)* 1. Host cpu must be Intel cpu * 2. RAPL must be enabled on the Host */ -if (is_host_cpu_intel ()) { +if (!is_host_cpu_intel ()) {error_report ("The RAPL feature can only be enabled on hosts\ with Intel CPU models" ); ret =1 ;