lkml.org 
[lkml]   [2021]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC: timer passthrough 7/9] KVM: vmx: save the initial value of host tscd
Date
Record the host tscd value.

Signed-off-by: Zhimin Feng <fengzhimin@bytedance.com>
---
arch/x86/kvm/vmx/vmx.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index a12da3cef86d..98eca70d4251 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -251,8 +251,11 @@ static void vmx_host_timer_passth_init(void *junk)
{
struct timer_passth_info *local_timer_info;
int cpu = smp_processor_id();
+ u64 tscd;

local_timer_info = &per_cpu(passth_info, cpu);
+ rdmsrl(MSR_IA32_TSC_DEADLINE, tscd);
+ local_timer_info->host_tscd = tscd;
local_timer_info->curr_dev = per_cpu(tick_cpu_device, cpu).evtdev;
local_timer_info->orig_set_next_event =
local_timer_info->curr_dev->set_next_event;
@@ -266,6 +269,7 @@ static void vmx_host_timer_restore(void *junk)
local_timer_info = &per_cpu(passth_info, smp_processor_id());
local_timer_info->curr_dev->set_next_event =
local_timer_info->orig_set_next_event;
+ local_timer_info->host_tscd = 0;
}

#define L1D_CACHE_ORDER 4
--
2.11.0
\
 
 \ /
  Last update: 2021-02-05 11:09    [W:0.739 / U:0.276 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site