Skip to contentSkip to conversation

last_kernel_ns ?

DISCUSSION Glauber Costa 2 participants 2 messages Oct 4, 2010 KVM

lore
Share & tools
lore
#0 lore raw

Zach,

        vcpu->hv_clock.tsc_timestamp = tsc_timestamp;
        vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset;
        vcpu->last_kernel_ns = kernel_ns; <===== (1)
        vcpu->last_guest_tsc = tsc_timestamp;
        vcpu->hv_clock.flags = 0;

If I understand your intention corretly, you should add kvmclock_offset to (1). Am I misinterpreting something?

#1 lore raw
Quoted 11 lines · Glauber Costa

Zach,

         vcpu->hv_clock.tsc_timestamp = tsc_timestamp;
         vcpu->hv_clock.system_time = kernel_ns + v->kvm->arch.kvmclock_offset;
         vcpu->last_kernel_ns = kernel_ns;<===== (1)
         vcpu->last_guest_tsc = tsc_timestamp;
         vcpu->hv_clock.flags = 0;

If I understand your intention corretly, you should add kvmclock_offset to (1). Am I misinterpreting something?

No, last_kernel_ns is the last observed value of kernel_ns, not system time. The kvmclock_offset may be modified since observation (unlikely, yet possible), and should not be considered in this computation.