[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <PH0PR11MB4792A18466859A327DE68A6EC5659@PH0PR11MB4792.namprd11.prod.outlook.com>
Date: Sun, 28 Nov 2021 11:55:39 +0000
From: "Zhou, Jie2X" <jie2x.zhou@...el.com>
To: "pbonzini@...hat.com" <pbonzini@...hat.com>
CC: "shuah@...nel.org" <shuah@...nel.org>,
"maz@...nel.org" <maz@...nel.org>,
"ricarkol@...gle.com" <ricarkol@...gle.com>,
"drjones@...hat.com" <drjones@...hat.com>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
"linux-kselftest@...r.kernel.org" <linux-kselftest@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"Li, Philip" <philip.li@...el.com>,
"Li, ZhijianX" <zhijianx.li@...el.com>
Subject: Re: kernel-selftests/kvm: kvm.tsc_msrs_test.fail
ping
________________________________________
From: Zhou, Jie2X
Sent: Tuesday, November 23, 2021 6:42 PM
To: pbonzini@...hat.com
Cc: shuah@...nel.org; maz@...nel.org; ricarkol@...gle.com; drjones@...hat.com; kvm@...r.kernel.org; linux-kselftest@...r.kernel.org; linux-kernel@...r.kernel.org; Li, Philip; Li, ZhijianX
Subject: kernel-selftests/kvm: kvm.tsc_msrs_test.fail
hi,
When I do the kvm test in kernel v5.15 by "make run_tests -C tools/testing/selftests/kvm" get following error.
# selftests: kvm: tsc_msrs_test
# ==== Test Assertion Failure ====
# x86_64/tsc_msrs_test.c:88: false
# pid=10432 tid=10432 errno=4 - Interrupted system call
# 1 0x0000000000403168: run_vcpu at tsc_msrs_test.c:86
# 2 0x000000000040297a: main at tsc_msrs_test.c:150
# 3 0x00007f064f88509a: ?? ??:0
# 4 0x0000000000402a89: _start at ??:?
# Failed guest assert: rounded_rdmsr(MSR_IA32_TSC) == val at x86_64/tsc_msrs_test.c:63
# values: 0x1200000000, 0x400000000
The MSR_IA32_TSC register can not be set correctly in guest mode in some machine.
But MSR_IA32_TSC register can be set correctly in host mode in that machine.
Although there are two CPU mode machines both support following function.
IA32_TSC_ADJUST MSR supported = true
TSC: time stamp counter = true
Test passed in cpu mode: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
Test failed in cpu mode: Intel(R) Core(TM) i7-6770HQ CPU @ 2.60GHz.
Add print code to check MSR_IA32_TSC value.
tools/testing/selftests/kvm/x86_64/tsc_msrs_test.c
@@ -151,6 +151,7 @@ int main(void)
val = 4ull * GUEST_STEP;
- ASSERT_EQ(rounded_host_rdmsr(MSR_IA32_TSC), val);
ASSERT_EQ(rounded_host_rdmsr(MSR_IA32_TSC_ADJUST), val - HOST_ADJUST);
+ printf("MSR_IA32_TSC: %llx, MSR_IA32_TSC_ADJUST: %llx, TSC_val: %llx, ADJUST_val: %llx\n\n", rounded_host_rdmsr(MSR_IA32_TSC), rounded_host_rdmsr(MSR_IA32_TSC_ADJUST), val, val - HOST_ADJUST);
In test passed machine(i7-6700) set MSR_IA32_TSC to 0x400000000 and get 0x400000000.
./kvm/x86_64/tsc_msrs_test
MSR_IA32_TSC: 400000000, MSR_IA32_TSC_ADJUST: fffffff400000000, TSC_val: 400000000, ADJUST_val: fffffff400000000
In test failed machine(i7-6770HQ) set MSR_IA32_TSC to 0x400000000 but get 0x1200000000.
./kvm/x86_64/tsc_msrs_test
MSR_IA32_TSC: 1200000000, MSR_IA32_TSC_ADJUST: fffffff400000000, TSC_val: 400000000, ADJUST_val: fffffff400000000
Try to set MSR_IA32_TSC in host mode in test failed machine(i7-6770HQ).
tools/testing/selftests/kvm/x86_64/tsc_msrs_test.c
@@ -151,6 +151,7 @@ int main(void)
val = 4ull * GUEST_STEP;
+ vcpu_set_msr(vm, 0, MSR_IA32_TSC, val);
+ vcpu_set_msr(vm, 0, MSR_IA32_TSC_ADJUST, val - HOST_ADJUST);
ASSERT_EQ(rounded_host_rdmsr(MSR_IA32_TSC), val);
ASSERT_EQ(rounded_host_rdmsr(MSR_IA32_TSC_ADJUST), val - HOST_ADJUST);
+ printf("MSR_IA32_TSC: %llx, MSR_IA32_TSC_ADJUST: %llx, TSC_val: %llx, ADJUST_val: %llx\n\n", rounded_host_rdmsr(MSR_IA32_TSC), rounded_host_rdmsr(MSR_IA32_TSC_ADJUST), val, val - HOST_ADJUST);
The output show MSR_IA32_TSC value is set correctly.
MSR_IA32_TSC: 400000000, MSR_IA32_TSC_ADJUST: fffffff400000000, TSC_val: 400000000, ADJUST_val: fffffff400000000
Why the MSR_IA32_TSC register can not be set correctly in guest mode in test failed machine(i7-6770HQ)?
best regards,
Powered by blists - more mailing lists