qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] KVM: emulate lapic tsc deadline timer for g


From: Liu, Jinsong
Subject: Re: [Qemu-devel] [PATCH 1/2] KVM: emulate lapic tsc deadline timer for guest
Date: Thu, 15 Sep 2011 16:17:20 +0800

Marcelo Tosatti wrote:
>> +    } else if (apic_lvtt_tscdeadline(apic)) {
>> +            /* lapic timer in tsc deadline mode */
>> +            u64 guest_tsc, guest_tsc_delta, ns = 0;
>> +            struct kvm_vcpu *vcpu = apic->vcpu;
>> +            unsigned long this_tsc_khz = vcpu_tsc_khz(vcpu); +              
>> unsigned long
>> flags; +
>> +            if (unlikely(!apic->lapic_timer.tscdeadline || !this_tsc_khz))
>> +                    return; +
>> +            local_irq_save(flags);
>> +
>> +            now = apic->lapic_timer.timer.base->get_time();
>> +            kvm_get_msr(vcpu, MSR_IA32_TSC, &guest_tsc);
> 
> Use kvm_x86_ops->read_l1_tsc(vcpu) instead of direct MSR read
> (to avoid reading L2 guest TSC in case of nested virt).
> 
>> +            guest_tsc_delta = apic->lapic_timer.tscdeadline - guest_tsc;
> 
> if (guest_tsc <= tscdeadline), the timer should start immediately.
> 

Yes, under such case the timer does start immediately, with ns = 0

Thanks,
Jinsong


reply via email to

[Prev in Thread] Current Thread [Next in Thread]