|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v7 06/36] KVM: x86: Drop CPU pinning in get_kvmclock()
From: David Woodhouse <dwmw@xxxxxxxxxxxx>
The master clock branch of get_kvmclock() pinned the task to a CPU so
that the rdtsc() and the __this_cpu_read(cpu_tsc_khz) would agree. But
ka->use_master_clock can only be true when the host clocksource is TSC
based, which in turn requires a stable, constant and synchronised TSC
across all CPUs.
Given that, the open-coded CONSTANT_TSC || cpu_tsc_khz check is
redundant (with CONSTANT_TSC, cpu_tsc_khz is tsc_khz on every CPU and
KVM does not even register the cpufreq notifier), and both the TSC read
and get_cpu_tsc_khz() are CPU-independent. Drop the condition and the
get_cpu()/put_cpu() pinning.
Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
---
arch/x86/kvm/x86.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 1a598e99852c..590a7ba723f7 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -1659,12 +1659,8 @@ static void get_kvmclock(struct kvm *kvm, struct
kvm_clock_data *data)
do {
seq = read_seqcount_begin(&ka->pvclock_sc);
- /* both __this_cpu_read() and rdtsc() should be on the same cpu
*/
- get_cpu();
-
data->flags = 0;
- if (ka->use_master_clock &&
- (static_cpu_has(X86_FEATURE_CONSTANT_TSC) ||
__this_cpu_read(cpu_tsc_khz))) {
+ if (ka->use_master_clock) {
#ifdef CONFIG_X86_64
struct timespec64 ts;
@@ -1685,8 +1681,6 @@ static void get_kvmclock(struct kvm *kvm, struct
kvm_clock_data *data)
} else {
data->clock = get_kvmclock_base_ns() +
ka->kvmclock_offset;
}
-
- put_cpu();
} while (read_seqcount_retry(&ka->pvclock_sc, seq));
}
--
2.55.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |