From: Chao Gao <chao.gao@intel.com>
To: Kechen Lu <kechenl@nvidia.com>
Cc: <kvm@vger.kernel.org>, <seanjc@google.com>, <pbonzini@redhat.com>,
<zhi.wang.linux@gmail.com>, <shaoqin.huang@intel.com>,
<vkuznets@redhat.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH v6 5/6] KVM: x86: add vCPU scoped toggling for disabled exits
Date: Mon, 30 Jan 2023 14:42:09 +0800 [thread overview]
Message-ID: <Y9dmwQNS1qufVwYZ@gao-cwp> (raw)
In-Reply-To: <20230121020738.2973-6-kechenl@nvidia.com>
On Sat, Jan 21, 2023 at 02:07:37AM +0000, Kechen Lu wrote:
>+static void svm_update_disabled_exits(struct kvm_vcpu *vcpu)
Is it possible to call this function on vCPU creation, i.e., consolidate
initialization and runtime toggling?
>+{
>+ struct vcpu_svm *svm = to_svm(vcpu);
>+ struct vmcb_control_area *control = &svm->vmcb->control;
>+
>+ if (kvm_hlt_in_guest(vcpu))
>+ svm_clr_intercept(svm, INTERCEPT_HLT);
>+ else
>+ svm_set_intercept(svm, INTERCEPT_HLT);
>+
>+ if (kvm_mwait_in_guest(vcpu)) {
>+ svm_clr_intercept(svm, INTERCEPT_MONITOR);
>+ svm_clr_intercept(svm, INTERCEPT_MWAIT);
>+ } else {
>+ svm_set_intercept(svm, INTERCEPT_MONITOR);
>+ svm_set_intercept(svm, INTERCEPT_MWAIT);
>+ }
>+
>+ if (kvm_pause_in_guest(vcpu)) {
>+ svm_clr_intercept(svm, INTERCEPT_PAUSE);
>+ } else {
>+ control->pause_filter_count = pause_filter_count;
>+ if (pause_filter_thresh)
>+ control->pause_filter_thresh = pause_filter_thresh;
>+ }
>+}
>+
> static void svm_vm_destroy(struct kvm *kvm)
> {
> avic_vm_destroy(kvm);
>@@ -4825,7 +4852,10 @@ static struct kvm_x86_ops svm_x86_ops __initdata = {
> .complete_emulated_msr = svm_complete_emulated_msr,
>
> .vcpu_deliver_sipi_vector = svm_vcpu_deliver_sipi_vector,
>+
> .vcpu_get_apicv_inhibit_reasons = avic_vcpu_get_apicv_inhibit_reasons,
>+
>+ .update_disabled_exits = svm_update_disabled_exits,
> };
>
> /*
>diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
>index 019a20029878..f5137afdd424 100644
>--- a/arch/x86/kvm/vmx/vmx.c
>+++ b/arch/x86/kvm/vmx/vmx.c
>@@ -8070,6 +8070,41 @@ static void vmx_vm_destroy(struct kvm *kvm)
> free_pages((unsigned long)kvm_vmx->pid_table, vmx_get_pid_table_order(kvm));
> }
>
>+static void vmx_update_disabled_exits(struct kvm_vcpu *vcpu)
ditto.
next prev parent reply other threads:[~2023-01-30 6:42 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-21 2:07 [RFC PATCH v6 0/6] KVM: x86: add per-vCPU exits disable capability Kechen Lu
2023-01-21 2:07 ` [RFC PATCH v6 1/6] KVM: x86: only allow exits disable before vCPUs created Kechen Lu
2023-01-21 7:28 ` Greg KH
2023-01-22 1:48 ` Kechen Lu
2023-01-21 2:07 ` [RFC PATCH v6 2/6] KVM: x86: Move *_in_guest power management flags to vCPU scope Kechen Lu
2023-02-02 14:56 ` Zhi Wang
2023-02-02 19:42 ` Kechen Lu
2023-01-21 2:07 ` [RFC PATCH v6 3/6] KVM: x86: Reject disabling of MWAIT interception when not allowed Kechen Lu
2023-01-31 12:11 ` Zhao Liu
2023-02-01 0:43 ` Kechen Lu
2023-01-21 2:07 ` [RFC PATCH v6 4/6] KVM: x86: Let userspace re-enable previously disabled exits Kechen Lu
2023-01-30 6:19 ` Chao Gao
2023-01-30 20:25 ` Kechen Lu
2023-01-21 2:07 ` [RFC PATCH v6 5/6] KVM: x86: add vCPU scoped toggling for " Kechen Lu
2023-01-30 6:42 ` Chao Gao [this message]
2023-01-30 20:57 ` Kechen Lu
2023-01-31 2:23 ` Chao Gao
2023-01-21 2:07 ` [RFC PATCH v6 6/6] KVM: selftests: Add tests for VM and vCPU cap KVM_CAP_X86_DISABLE_EXITS Kechen Lu
2023-02-02 15:08 ` Zhi Wang
2023-02-02 20:17 ` Kechen Lu
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=Y9dmwQNS1qufVwYZ@gao-cwp \
--to=chao.gao@intel.com \
--cc=kechenl@nvidia.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=shaoqin.huang@intel.com \
--cc=vkuznets@redhat.com \
--cc=zhi.wang.linux@gmail.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