Message ID | 20200204194809.2077-1-sean.j.christopherson@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [kvm-unit-tests] x86: Use "-cpu host" for PCID tests | expand |
Sean Christopherson <sean.j.christopherson@intel.com> writes: > 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 <sean.j.christopherson@intel.com> > --- > x86/unittests.cfg | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/x86/unittests.cfg b/x86/unittests.cfg > index aae1523..25f4535 100644 > --- a/x86/unittests.cfg > +++ b/x86/unittests.cfg > @@ -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] Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com> Actually, is there any reason for *not* using '-cpu host' in any of the tests?
On Wed, Feb 05, 2020 at 12:37:11PM +0100, Vitaly Kuznetsov wrote: > Sean Christopherson <sean.j.christopherson@intel.com> writes: > > > 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 <sean.j.christopherson@intel.com> > > --- > > x86/unittests.cfg | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/x86/unittests.cfg b/x86/unittests.cfg > > index aae1523..25f4535 100644 > > --- a/x86/unittests.cfg > > +++ b/x86/unittests.cfg > > @@ -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] > > Reviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com> > > 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.
On 04/02/20 20:48, Sean Christopherson wrote: > 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. :) > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> > --- > x86/unittests.cfg | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/x86/unittests.cfg b/x86/unittests.cfg > index aae1523..25f4535 100644 > --- a/x86/unittests.cfg > +++ b/x86/unittests.cfg > @@ -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
On Wed, Feb 05, 2020 at 04:26:40PM +0100, Paolo Bonzini wrote: > On 04/02/20 20:48, Sean Christopherson wrote: > > 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.
diff --git a/x86/unittests.cfg b/x86/unittests.cfg index aae1523..25f4535 100644 --- a/x86/unittests.cfg +++ b/x86/unittests.cfg @@ -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]
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 <sean.j.christopherson@intel.com> --- x86/unittests.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)