From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>
Cc: kvm@vger.kernel.org
Subject: Re: [kvm-unit-tests PATCH 28/39] nVMX: Remove "v1" version of INVVPID test
Date: Fri, 26 Nov 2021 19:28:34 +0100 [thread overview]
Message-ID: <b3307d95-a36f-51f1-7ee7-37c32131a4af@redhat.com> (raw)
In-Reply-To: <20211125012857.508243-29-seanjc@google.com>
On 11/25/21 02:28, Sean Christopherson wrote:
> Yank out the old INVVPID and drop the version info from the new test,
> which is a complete superset. That, and the old test was apparently
> trying to win an obfuscated C contest.
All of the "version 1" tests are...
Paolo
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
> x86/vmx_tests.c | 91 ++-----------------------------------------------
> 1 file changed, 2 insertions(+), 89 deletions(-)
>
> diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
> index 78a53e1..507e485 100644
> --- a/x86/vmx_tests.c
> +++ b/x86/vmx_tests.c
> @@ -1545,92 +1545,6 @@ static int eptad_exit_handler(union exit_reason exit_reason)
> return ept_exit_handler_common(exit_reason, true);
> }
>
> -static bool invvpid_test(int type, u16 vpid)
> -{
> - bool ret, supported;
> -
> - supported = ept_vpid.val &
> - (VPID_CAP_INVVPID_ADDR >> INVVPID_ADDR << type);
> - ret = __invvpid(type, vpid, 0);
> -
> - if (ret == !supported)
> - return false;
> -
> - if (!supported)
> - printf("WARNING: unsupported invvpid passed!\n");
> - else
> - printf("WARNING: invvpid failed!\n");
> -
> - return true;
> -}
> -
> -static int vpid_init(struct vmcs *vmcs)
> -{
> - u32 ctrl_cpu1;
> -
> - if (!(ctrl_cpu_rev[0].clr & CPU_SECONDARY) ||
> - !(ctrl_cpu_rev[1].clr & CPU_VPID)) {
> - printf("\tVPID is not supported");
> - return VMX_TEST_EXIT;
> - }
> -
> - ctrl_cpu1 = vmcs_read(CPU_EXEC_CTRL1);
> - ctrl_cpu1 |= CPU_VPID;
> - vmcs_write(CPU_EXEC_CTRL1, ctrl_cpu1);
> - return VMX_TEST_START;
> -}
> -
> -static void vpid_main(void)
> -{
> - vmx_set_test_stage(0);
> - vmcall();
> - report(vmx_get_test_stage() == 1, "INVVPID SINGLE ADDRESS");
> - vmx_set_test_stage(2);
> - vmcall();
> - report(vmx_get_test_stage() == 3, "INVVPID SINGLE");
> - vmx_set_test_stage(4);
> - vmcall();
> - report(vmx_get_test_stage() == 5, "INVVPID ALL");
> -}
> -
> -static int vpid_exit_handler(union exit_reason exit_reason)
> -{
> - u64 guest_rip;
> - u32 insn_len;
> -
> - guest_rip = vmcs_read(GUEST_RIP);
> - insn_len = vmcs_read(EXI_INST_LEN);
> -
> - switch (exit_reason.basic) {
> - case VMX_VMCALL:
> - switch(vmx_get_test_stage()) {
> - case 0:
> - if (!invvpid_test(INVVPID_ADDR, 1))
> - vmx_inc_test_stage();
> - break;
> - case 2:
> - if (!invvpid_test(INVVPID_CONTEXT_GLOBAL, 1))
> - vmx_inc_test_stage();
> - break;
> - case 4:
> - if (!invvpid_test(INVVPID_ALL, 1))
> - vmx_inc_test_stage();
> - break;
> - default:
> - report_fail("ERROR: unexpected stage, %d",
> - vmx_get_test_stage());
> - print_vmexit_info(exit_reason);
> - return VMX_TEST_VMEXIT;
> - }
> - vmcs_write(GUEST_RIP, guest_rip + insn_len);
> - return VMX_TEST_RESUME;
> - default:
> - report_fail("Unknown exit reason, 0x%x", exit_reason.full);
> - print_vmexit_info(exit_reason);
> - }
> - return VMX_TEST_VMEXIT;
> -}
> -
> #define TIMER_VECTOR 222
>
> static volatile bool timer_fired;
> @@ -3391,7 +3305,7 @@ static void invvpid_test_not_in_vmx_operation(void)
> * This does not test real-address mode, virtual-8086 mode, protected mode,
> * or CPL > 0.
> */
> -static void invvpid_test_v2(void)
> +static void invvpid_test(void)
> {
> u64 msr;
> int i;
> @@ -10770,7 +10684,6 @@ struct vmx_test vmx_tests[] = {
> { "EPT A/D disabled", ept_init, ept_main, ept_exit_handler, NULL, {0} },
> { "EPT A/D enabled", eptad_init, eptad_main, eptad_exit_handler, NULL, {0} },
> { "PML", pml_init, pml_main, pml_exit_handler, NULL, {0} },
> - { "VPID", vpid_init, vpid_main, vpid_exit_handler, NULL, {0} },
> { "interrupt", interrupt_init, interrupt_main,
> interrupt_exit_handler, NULL, {0} },
> { "nmi_hlt", nmi_hlt_init, nmi_hlt_main,
> @@ -10794,7 +10707,7 @@ struct vmx_test vmx_tests[] = {
> TEST(fixture_test_case1),
> TEST(fixture_test_case2),
> /* Opcode tests. */
> - TEST(invvpid_test_v2),
> + TEST(invvpid_test),
> /* VM-entry tests */
> TEST(vmx_controls_test),
> TEST(vmx_host_state_area_test),
>
next prev parent reply other threads:[~2021-11-26 19:05 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-25 1:28 [kvm-unit-tests PATCH 00/39] x86/access: nVMX: Big overhaul Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 01/39] x86/access: Add proper defines for hardcoded addresses Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 02/39] x86/access: Cache CR3 to improve performance Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 03/39] x86/access: Use do-while loop for what is obviously a do-while loop Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 04/39] x86/access: Stop pretending the test is SMP friendly Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 05/39] x86/access: Refactor so called "page table pool" logic Sean Christopherson
2021-11-26 18:03 ` Paolo Bonzini
2021-11-25 1:28 ` [kvm-unit-tests PATCH 06/39] x86/access: Stash root page table level in test environment Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 07/39] x86/access: Hoist page table allocator helpers above "init" helper Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 08/39] x86/access: Rename variables in page table walkers Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 09/39] x86/access: Abort if page table insertion hits an unexpected level Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 10/39] x86/access: Make SMEP place nice with 5-level paging Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 11/39] x86/access: Use upper half of virtual address space Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 12/39] x86/access: Print the index when dumping PTEs Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 13/39] x86/access: Pre-allocate all page tables at (sub)test init Sean Christopherson
2021-11-26 18:15 ` Paolo Bonzini
2021-11-25 1:28 ` [kvm-unit-tests PATCH 14/39] x86/access: Don't write page tables if desired PTE is same as current PTE Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 15/39] x86/access: Preserve A/D bits when writing paging structure entries Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 16/39] x86/access: Make toggling of PRESENT bit a "higher order" action Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 17/39] x86/access: Manually override PMD in effective permissions sub-test Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 18/39] x86/access: Remove manual override of PUD/PMD in prefetch sub-test Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 19/39] x86/access: Remove PMD/PT target overrides Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 20/39] x86/access: Remove timeout overrides now that performance doesn't suck Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 21/39] nVMX: Skip EPT tests if INVEPT(SINGLE_CONTEXT) is unsupported Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 22/39] nVMX: Hoist assert macros to the top of vmx.h Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 23/39] nVMX: Add a non-reporting assertion macro Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 24/39] nVMX: Assert success in unchecked INVEPT/INVVPID helpers Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 25/39] nVMX: Drop less-than-useless ept_sync() wrapper Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 26/39] nVMX: Move EPT capability check helpers to vmx.h Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 27/39] nVMX: Drop unused and useless vpid_sync() helper Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 28/39] nVMX: Remove "v1" version of INVVPID test Sean Christopherson
2021-11-26 18:28 ` Paolo Bonzini [this message]
2021-11-25 1:28 ` [kvm-unit-tests PATCH 29/39] nVMX: Add helper to check if INVVPID type is supported Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 30/39] nVMX: Add helper to check if INVVPID " Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 31/39] nVMX: Add helper to get first supported INVVPID type Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 32/39] nVMX: Use helper to check for EPT A/D support Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 33/39] nVMX: Add helpers to check for 4/5-level EPT support Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 34/39] nVMX: Fix name of macro defining EPT execute only capability Sean Christopherson
2021-11-26 18:31 ` Paolo Bonzini
2021-11-25 1:28 ` [kvm-unit-tests PATCH 35/39] nVMX: Add helper to check if a memtype is supported for EPT structures Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 36/39] nVMX: Get rid of horribly named "ctrl" boolean in test_ept_eptp() Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 37/39] nVMX: Rename awful "ctrl" booleans to "is_ctrl_valid" Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 38/39] nVMX: Add helper to check if VPID is supported Sean Christopherson
2021-11-25 1:28 ` [kvm-unit-tests PATCH 39/39] x86/access: nVMX: Add "access" test variants to invalidate via (INV)VPID Sean Christopherson
2021-11-26 18:43 ` [kvm-unit-tests PATCH 00/39] x86/access: nVMX: Big overhaul Paolo Bonzini
2021-11-29 19:04 ` Sean Christopherson
2021-11-29 19:15 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b3307d95-a36f-51f1-7ee7-37c32131a4af@redhat.com \
--to=pbonzini@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=seanjc@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).