From: Manali Shukla <manali.shukla@amd.com>
To: Dongli Zhang <dongli.zhang@oracle.com>
Cc: pbonzini@redhat.com, seanjc@google.com, shuah@kernel.org,
nikunj@amd.com, thomas.lendacky@amd.com, ajones@ventanamicro.com,
kvm@vger.kernel.org, linux-kselftest@vger.kernel.org
Subject: Re: [PATCH v2 3/3] KVM: selftests: Add a test case for KVM_X86_DISABLE_EXITS_HLT
Date: Mon, 15 Apr 2024 15:19:03 +0530 [thread overview]
Message-ID: <418692ff-0b66-fe43-7236-a6657bb33ec2@amd.com> (raw)
In-Reply-To: <59714cae-4b69-9a3f-87c9-b934f8b7cc3e@oracle.com>
On 4/1/2024 10:29 PM, Dongli Zhang wrote:
>
>
> On 4/1/24 08:20, Manali Shukla wrote:
>> 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.
>>
>> Add a test case to test KVM_X86_DISABLE_EXITS_HLT functionality.
>>
>> Suggested-by: Sean Christopherson <seanjc@google.com>
>> Signed-off-by: Manali Shukla <manali.shukla@amd.com>
>> ---
>> tools/testing/selftests/kvm/Makefile | 1 +
>> .../kvm/x86_64/halt_disable_exit_test.c | 119 ++++++++++++++++++
>> 2 files changed, 120 insertions(+)
>> create mode 100644 tools/testing/selftests/kvm/x86_64/halt_disable_exit_test.c
>>
>> diff --git a/tools/testing/selftests/kvm/Makefile b/tools/testing/selftests/kvm/Makefile
>> index c75251d5c97c..9f72abb95d2e 100644
>> --- a/tools/testing/selftests/kvm/Makefile
>> +++ b/tools/testing/selftests/kvm/Makefile
>> @@ -89,6 +89,7 @@ TEST_GEN_PROGS_x86_64 += x86_64/set_sregs_test
>> TEST_GEN_PROGS_x86_64 += x86_64/smaller_maxphyaddr_emulation_test
>> TEST_GEN_PROGS_x86_64 += x86_64/smm_test
>> TEST_GEN_PROGS_x86_64 += x86_64/state_test
>> +TEST_GEN_PROGS_x86_64 += x86_64/halt_disable_exit_test
>> TEST_GEN_PROGS_x86_64 += x86_64/vmx_preemption_timer_test
>> TEST_GEN_PROGS_x86_64 += x86_64/svm_vmcall_test
>> TEST_GEN_PROGS_x86_64 += x86_64/svm_int_ctl_test
>> diff --git a/tools/testing/selftests/kvm/x86_64/halt_disable_exit_test.c b/tools/testing/selftests/kvm/x86_64/halt_disable_exit_test.c
>> new file mode 100644
>> index 000000000000..4cc6a09906a2
>> --- /dev/null
>> +++ b/tools/testing/selftests/kvm/x86_64/halt_disable_exit_test.c
>> @@ -0,0 +1,119 @@
>> +// SPDX-License-Identifier: GPL-2.0-only
>> +/*
>> + * KVM disable halt exit test
>> + *
>> + * Copyright (C) 2024 Advanced Micro Devices, Inc.
>> + */
>> +#include <pthread.h>
>> +#include <signal.h>
>> +#include "kvm_util.h"
>> +#include "processor.h"
>> +#include "test_util.h"
>> +
>> +#define SIG_IPI SIGUSR1
>> +static pthread_t task_thread, vcpu_thread;
>> +
>> +static void guest_code(uint64_t *is_hlt_exec)
>> +{
>> + while (!READ_ONCE(*is_hlt_exec))
>> + ;
>> +
>> + safe_halt();
>
> May I confirm if this selftest works on nested L1 VM as a hypervisor?
Yes, this selftest works on nested L1 VM.
>
> Thank you very much!
>
> Dongli Zhang
prev parent reply other threads:[~2024-04-15 9:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-01 15:20 [PATCH v2 0/3] Add a test case for KVM_X86_DISABLE_EXIT Manali Shukla
2024-04-01 15:20 ` [PATCH v2 1/3] KVM: selftests: Add safe_halt() and cli() helpers to common code Manali Shukla
2024-04-01 15:20 ` [PATCH v2 2/3] KVM: selftests: Extend @shape to allow creation of VM without in-kernel APIC Manali Shukla
2024-04-01 17:15 ` Sean Christopherson
2024-04-04 10:38 ` Manali Shukla
2024-04-01 15:20 ` [PATCH v2 3/3] KVM: selftests: Add a test case for KVM_X86_DISABLE_EXITS_HLT Manali Shukla
2024-04-01 16:59 ` Dongli Zhang
2024-04-15 9:49 ` Manali Shukla [this message]
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=418692ff-0b66-fe43-7236-a6657bb33ec2@amd.com \
--to=manali.shukla@amd.com \
--cc=ajones@ventanamicro.com \
--cc=dongli.zhang@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.