From: Zhimin Feng <fengzhimin@bytedance.com>
To: x86@kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: pbonzini@redhat.com, seanjc@google.com, vkuznets@redhat.com,
wanpengli@tencent.com, jmattson@google.com, joro@8bytes.org,
tglx@linutronix.de, mingo@redhat.com, bp@alien8.de,
hpa@zytor.com, fweisbec@gmail.com, zhouyibo@bytedance.com,
zhanghaozhong@bytedance.com,
Zhimin Feng <fengzhimin@bytedance.com>
Subject: [RFC: timer passthrough 6/9] KVM: vmx: check enable_timer_passth strictly
Date: Fri, 5 Feb 2021 18:03:14 +0800 [thread overview]
Message-ID: <20210205100317.24174-7-fengzhimin@bytedance.com> (raw)
In-Reply-To: <20210205100317.24174-1-fengzhimin@bytedance.com>
preemption timer is default disabled
timer passthrough is default enabled
Signed-off-by: Zhimin Feng <fengzhimin@bytedance.com>
---
arch/x86/kvm/vmx/vmx.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index 44b2fd59587e..a12da3cef86d 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -126,12 +126,12 @@ module_param(dump_invalid_vmcs, bool, 0644);
/* Guest_tsc -> host_tsc conversion requires 64-bit division. */
static int __read_mostly cpu_preemption_timer_multi;
-static bool __read_mostly enable_preemption_timer = 1;
+static bool __read_mostly enable_preemption_timer;
#ifdef CONFIG_X86_64
module_param_named(preemption_timer, enable_preemption_timer, bool, S_IRUGO);
#endif
-static bool __read_mostly enable_timer_passth;
+static bool __read_mostly enable_timer_passth = 1;
#ifdef CONFIG_X86_64
module_param_named(timer_passth, enable_timer_passth, bool, 0444);
#endif
@@ -8108,12 +8108,17 @@ static __init int hardware_setup(void)
enable_preemption_timer = false;
}
- if (!enable_preemption_timer) {
+ if (!enable_preemption_timer || enable_timer_passth) {
vmx_x86_ops.set_hv_timer = NULL;
vmx_x86_ops.cancel_hv_timer = NULL;
vmx_x86_ops.request_immediate_exit = __kvm_request_immediate_exit;
}
+ if (enable_preemption_timer && enable_timer_passth) {
+ pr_err("cannot enable timer passthrough and preemption timer same timer\n");
+ return -EINVAL;
+ }
+
kvm_set_posted_intr_wakeup_handler(pi_wakeup_handler);
kvm_mce_cap_supported |= MCG_LMCE_P;
--
2.11.0
next prev parent reply other threads:[~2021-02-06 0:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-05 10:03 [RESEND RFC: timer passthrough 0/9] Support timer passthrough for VM Zhimin Feng
2021-02-05 10:03 ` [RFC: timer passthrough 1/9] KVM: vmx: hook set_next_event for getting the host tscd Zhimin Feng
2021-02-05 12:28 ` Peter Zijlstra
2021-02-05 18:11 ` Thomas Gleixner
2021-02-23 13:07 ` [External] " Zhimin Feng
2021-02-05 10:03 ` [RFC: timer passthrough 2/9] KVM: vmx: enable host lapic timer offload preemtion timer Zhimin Feng
2021-02-05 10:03 ` [RFC: timer passthrough 3/9] KVM: vmx: enable passthrough timer to guest Zhimin Feng
2021-02-05 10:03 ` [RFC: timer passthrough 4/9] KVM: vmx: enable passth timer switch to sw timer Zhimin Feng
2021-02-05 10:03 ` [RFC: timer passthrough 5/9] KVM: vmx: use tsc_adjust to enable tsc_offset timer passthrough Zhimin Feng
2021-02-05 12:43 ` Peter Zijlstra
2021-02-05 18:22 ` Thomas Gleixner
2021-02-05 10:03 ` Zhimin Feng [this message]
2021-02-05 10:03 ` [RFC: timer passthrough 7/9] KVM: vmx: save the initial value of host tscd Zhimin Feng
2021-02-05 10:03 ` [RFC: timer passthrough 8/9] KVM: vmx: Dynamically open or close the timer-passthrough for pre-vm Zhimin Feng
2021-02-05 10:03 ` [RFC: timer passthrough 9/9] KVM: vmx: query the state of timer-passth for vm Zhimin Feng
2021-02-05 13:34 ` [RESEND RFC: timer passthrough 0/9] Support timer passthrough for VM Paolo Bonzini
2021-02-08 18:13 ` Konrad Rzeszutek Wilk
2021-02-23 13:31 ` [External] " Zhimin Feng
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=20210205100317.24174-7-fengzhimin@bytedance.com \
--to=fengzhimin@bytedance.com \
--cc=bp@alien8.de \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
--cc=x86@kernel.org \
--cc=zhanghaozhong@bytedance.com \
--cc=zhouyibo@bytedance.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).