x86: Use "-cpu host" for PCID tests
PATCH 1/1 x86: Use "-cpu host" for PCID tests
Use the host CPU model for the PCID tests to allow testing the various combinations of PCID and INVPCID enabled/disabled without having to manually change the kvm-unit-tests command line. I.e. give users the option of changing the command line *OR* running on a (virtual) CPU with or without PCID and/or INVPCID.
--- x86/unittests.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
x86/unittests.cfg +1 -1
@@ -228,7 +228,7 @@ extra_params = --append "10000000 `date +%s`" [pcid] file = pcid.flat -extra_params = -cpu qemu64,+pcid +extra_params = -cpu host arch = x86_64 [rdpru]
Signature · 1 line
2.24.1
Quoted 16 lines · Sean Christopherson
Use the host CPU model for the PCID tests to allow testing the various combinations of PCID and INVPCID enabled/disabled without having to manually change the kvm-unit-tests command line. I.e. give users the option of changing the command line *OR* running on a (virtual) CPU with or without PCID and/or INVPCID.
Signed-off-by Sean Christopherson <[email protected]>--- x86/unittests.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)x86/unittests.cfg +0
-0
x86/unittests.cfg extra_params = --append "10000000 `date +%s`" · line 234
Quoted 8 lines
x86/unittests.cfg +1
-1@@ -228,7 +228,7 @@ extra_params = --append "10000000 `date +%s`" [pcid] file = pcid.flat -extra_params = -cpu qemu64,+pcid +extra_params = -cpu host arch = x86_64 [rdpru]
Actually, is there any reason for *not* using '-cpu host' in any of the tests?
Signature · 1 line
Vitaly
Quoted 25 lines · Vitaly Kuznetsov
Quoted 23 lines · Sean Christopherson
Use the host CPU model for the PCID tests to allow testing the various combinations of PCID and INVPCID enabled/disabled without having to manually change the kvm-unit-tests command line. I.e. give users the option of changing the command line *OR* running on a (virtual) CPU with or without PCID and/or INVPCID.
Signed-off-by Sean Christopherson <[email protected]>--- x86/unittests.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)x86/unittests.cfg +1
-1@@ -228,7 +228,7 @@ extra_params = --append "10000000 `date +%s`" [pcid] file = pcid.flat -extra_params = -cpu qemu64,+pcid +extra_params = -cpu host arch = x86_64
Quoted 6 lines
x86/unittests.cfg extra_params = --append "10000000 `date +%s`" · line 234
Quoted 1 line
x86/unittests.cfg +0
-0[rdpru]Reviewed-by Vitaly Kuznetsov <[email protected]>Actually, is there any reason for *not* using '-cpu host' in any of the tests?
Emulation tests, e.g. for UMIP, will want "-cpu <base>,+<feature>", but I can't think of any reason why <base> shouldn't be host.
Paolo Bonzini
maintainerQuoted 5 lines · Sean Christopherson
Use the host CPU model for the PCID tests to allow testing the various combinations of PCID and INVPCID enabled/disabled without having to manually change the kvm-unit-tests command line. I.e. give users the option of changing the command line *OR* running on a (virtual) CPU with or without PCID and/or INVPCID.
I don't understand. :)
Quoted 11 lines
Signed-off-by Sean Christopherson <[email protected]>--- x86/unittests.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)x86/unittests.cfg +0
-0
x86/unittests.cfg extra_params = --append "10000000 `date +%s`" · line 234
Quoted 8 lines
x86/unittests.cfg +1
-1@@ -228,7 +228,7 @@ extra_params = --append "10000000 `date +%s`" [pcid] file = pcid.flat -extra_params = -cpu qemu64,+pcid +extra_params = -cpu host arch = x86_64 [rdpru]
The main reason not to use "-cpu host" is that it is not supported by QEMU TCG (binary translation mode). But there is no reason not to use "-cpu max", which works with TCG and is synonym with "-cpu host" on KVM. :)
Paolo
Paolo
Quoted 8 lines · Paolo Bonzini
Quoted 5 lines · Sean Christopherson
Use the host CPU model for the PCID tests to allow testing the various combinations of PCID and INVPCID enabled/disabled without having to manually change the kvm-unit-tests command line. I.e. give users the option of changing the command line *OR* running on a (virtual) CPU with or without PCID and/or INVPCID.
I don't understand. :)
I was trying to test a change in the code that clears INVPCID in guest's CPUID if PCID isn't supported. To do that, I ran the PCID unit test in L1, using L0 Qemu to hide PCID and/or INVPCID from L1 to iterate over the four combinations of PCID and INVPCID being enabled/disabled. But the test in L1 never exercised INVPCID=y because unittest.cfg runs with the test with "-cpu=qemu64,+pcid".
By using qemu64, the only way to test INVPCID=y is to manually run the test a different "-cpu..." command. The idea behind "-cpu=host" is to enable running different combinations of the test in L1 by hiding features from L1 instead of by running the test with different commands.
In other words, if I create an L1 with PCID=y and INVPCID=y, I expect that running the as-configured PCID unit tests would actually test PCID=Y and INVPCID=y.