Skip to content

Commit 5587859

Browse files
committed
KVM: x86: use ktime_get instead of seeking the hrtimer_clock_base
The base clock for the LAPIC timer is always CLOCK_MONOTONIC. Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 8003c9a commit 5587859

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arch/x86/kvm/lapic.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,7 +1101,7 @@ static u32 apic_get_tmcct(struct kvm_lapic *apic)
11011101
apic->lapic_timer.period == 0)
11021102
return 0;
11031103

1104-
now = apic->lapic_timer.timer.base->get_time();
1104+
now = ktime_get();
11051105
remaining = ktime_sub(apic->lapic_timer.target_expiration, now);
11061106
if (ktime_to_ns(remaining) < 0)
11071107
remaining = ktime_set(0, 0);
@@ -1333,7 +1333,7 @@ static void start_sw_tscdeadline(struct kvm_lapic *apic)
13331333

13341334
local_irq_save(flags);
13351335

1336-
now = apic->lapic_timer.timer.base->get_time();
1336+
now = ktime_get();
13371337
guest_tsc = kvm_read_l1_tsc(vcpu, rdtsc());
13381338
if (likely(tscdeadline > guest_tsc)) {
13391339
ns = (tscdeadline - guest_tsc) * 1000000ULL;
@@ -1354,7 +1354,7 @@ static void start_sw_period(struct kvm_lapic *apic)
13541354
return;
13551355

13561356
if (apic_lvtt_oneshot(apic) &&
1357-
ktime_after(apic->lapic_timer.timer.base->get_time(),
1357+
ktime_after(ktime_get(),
13581358
apic->lapic_timer.target_expiration)) {
13591359
apic_timer_expired(apic);
13601360
return;
@@ -1370,7 +1370,7 @@ static bool set_target_expiration(struct kvm_lapic *apic)
13701370
ktime_t now;
13711371
u64 tscl = rdtsc();
13721372

1373-
now = apic->lapic_timer.timer.base->get_time();
1373+
now = ktime_get();
13741374
apic->lapic_timer.period = (u64)kvm_lapic_get_reg(apic, APIC_TMICT)
13751375
* APIC_BUS_CYCLE_NS * apic->divide_count;
13761376

0 commit comments

Comments
 (0)