[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210205100317.24174-7-fengzhimin@bytedance.com>
Date: Fri, 5 Feb 2021 18:03:14 +0800
From: Zhimin Feng <fengzhimin@...edance.com>
To: x86@...nel.org, kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: pbonzini@...hat.com, seanjc@...gle.com, vkuznets@...hat.com,
wanpengli@...cent.com, jmattson@...gle.com, joro@...tes.org,
tglx@...utronix.de, mingo@...hat.com, bp@...en8.de, hpa@...or.com,
fweisbec@...il.com, zhouyibo@...edance.com,
zhanghaozhong@...edance.com, Zhimin Feng <fengzhimin@...edance.com>
Subject: [RFC: timer passthrough 6/9] KVM: vmx: check enable_timer_passth strictly
preemption timer is default disabled
timer passthrough is default enabled
Signed-off-by: Zhimin Feng <fengzhimin@...edance.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
Powered by blists - more mailing lists