On 20/05/2016 03:45, Yunhong Jiang wrote: > +static void start_sw_tscdeadline(struct kvm_lapic *apic) Please rename to start_tscdeadline_hrtimer. Paolo > +{ > + u64 guest_tsc, tscdeadline = apic->lapic_timer.tscdeadline; > + u64 ns = 0; > + ktime_t expire; > + struct kvm_vcpu *vcpu = apic->vcpu; > + unsigned long this_tsc_khz = vcpu->arch.virtual_tsc_khz; > + unsigned long flags; > + ktime_t now; > + > + if (unlikely(!tscdeadline || !this_tsc_khz)) > + return; > + > + local_irq_save(flags); > + > + now = apic->lapic_timer.timer.base->get_time(); > + guest_tsc = kvm_read_l1_tsc(vcpu, rdtsc()); > + if (likely(tscdeadline > guest_tsc)) { > + ns = (tscdeadline - guest_tsc) * 1000000ULL; > + do_div(ns, this_tsc_khz); > + expire = ktime_add_ns(now, ns); > + expire = ktime_sub_ns(expire, lapic_timer_advance_ns); > + hrtimer_start(&apic->lapic_timer.timer, > + expire, HRTIMER_MODE_ABS_PINNED); > + } else > + apic_timer_expired(apic); -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html