Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Manali Shukla <manali.shukla@amd.com>
To: <kvm@vger.kernel.org>, <linux-kselftest@vger.kernel.org>
Cc: <pbonzini@redhat.com>, <seanjc@google.com>, <shuah@kernel.org>,
	<nikunj@amd.com>, <thomas.lendacky@amd.com>,
	<manali.shukla@amd.com>
Subject: [PATCH v1 0/3] Add a test case for KVM_X86_DISABLE_EXIT
Date: Wed, 27 Mar 2024 05:42:52 +0000	[thread overview]
Message-ID: <20240327054255.24626-1-manali.shukla@amd.com> (raw)

By default, HLT instruction executed by guest is intercepted by hypervisor.
However, KVM_CAP_X86_DISABLE_EXITS capability can be used to not intercept
HLT by setting KVM_X86_DISABLE_EXITS_HLT.

By default, vms are created with in-kernel APIC support in KVM selftests.
VM needs to be created without in-kernel APIC support for this test, so
that HLT will exit to userspace. To do so, __vm_create() is modified to not
call KVM_CREATE_IRQCHIP ioctl while creating vm.

Add a test case to test KVM_X86_DISABLE_EXITS_HLT functionality.

Patch 1, 2 -> Preparatory patches to add the KVM_X86_DISABLE_EXITS_HLT test
              case 
Patch 3 -> Adds a test case for KVM_X86_DISABLE_EXITS_HLT

Testing done:
Tested KVM_X86_DISABLE_EXITS_HLT test case on AMD and Intel machines.

Manali Shukla (3):
  KVM: selftests: Add safe_halt() and cli() helpers to common code
  KVM: selftests: Change __vm_create() to create a vm without in-kernel
    APIC
  KVM: selftests: Add a test case for KVM_X86_DISABLE_EXITS_HLT

 tools/testing/selftests/kvm/Makefile          |   1 +
 tools/testing/selftests/kvm/dirty_log_test.c  |   2 +-
 .../selftests/kvm/include/kvm_util_base.h     |   4 +-
 .../selftests/kvm/include/x86_64/processor.h  |  17 +++
 tools/testing/selftests/kvm/lib/kvm_util.c    |  11 +-
 .../kvm/x86_64/halt_disable_exit_test.c       | 113 ++++++++++++++++++
 .../kvm/x86_64/ucna_injection_test.c          |   2 +-
 7 files changed, 143 insertions(+), 7 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/x86_64/halt_disable_exit_test.c


base-commit: e9da6f08edb0bd4c621165496778d77a222e1174
-- 
2.34.1


             reply	other threads:[~2024-03-27  5:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-27  5:42 Manali Shukla [this message]
2024-03-27  5:42 ` [PATCH v1 1/3] KVM: selftests: Add safe_halt() and cli() helpers to common code Manali Shukla
2024-03-27  5:42 ` [PATCH v1 2/3] KVM: selftests: Change __vm_create() to create a vm without in-kernel APIC Manali Shukla
2024-03-27 11:27   ` Andrew Jones
2024-03-28 11:12     ` Manali Shukla
2024-03-27  5:42 ` [PATCH v1 3/3] KVM: selftests: Add a test case for KVM_X86_DISABLE_EXITS_HLT Manali Shukla
2024-03-29 20:13   ` Muhammad Usama Anjum
2024-04-01  5:28     ` Manali Shukla
2024-04-01  6:27       ` Manali Shukla
2024-04-01  9:41       ` Muhammad Usama Anjum
2024-04-01 12:31         ` Manali Shukla

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=20240327054255.24626-1-manali.shukla@amd.com \
    --to=manali.shukla@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=nikunj@amd.com \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.com \
    --cc=shuah@kernel.org \
    --cc=thomas.lendacky@amd.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