Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-08 Thread Chris J Arges
On 09/05/2014 04:00 PM, Paolo Bonzini wrote: > Il 05/09/2014 22:41, Thomas Gleixner ha scritto: >> No, it needs to be above update_vsyscall(). Here is the patch again >> which I sent before. [https://lkml.org/lkml/2014/9/5/395] > > Ah, I missed it after your signature. Thanks, I'll test yours the

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-05 Thread Paolo Bonzini
Il 05/09/2014 22:41, Thomas Gleixner ha scritto: > No, it needs to be above update_vsyscall(). Here is the patch again > which I sent before. [https://lkml.org/lkml/2014/9/5/395] Ah, I missed it after your signature. Thanks, I'll test yours then next week. Paolo -- To unsubscribe from this list:

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-05 Thread Thomas Gleixner
On Fri, 5 Sep 2014, Paolo Bonzini wrote: > Il 05/09/2014 20:33, Thomas Gleixner ha scritto: > >> > update_vsyscall(tk); > >> > -update_pvclock_gtod(tk, action & TK_CLOCK_WAS_SET); > >> > > >> > tk_update_ktime_data(tk); > >> > +update_pvclock_gtod(tk, action & TK

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-05 Thread Paolo Bonzini
Il 05/09/2014 20:33, Thomas Gleixner ha scritto: >> >update_vsyscall(tk); >> > - update_pvclock_gtod(tk, action & TK_CLOCK_WAS_SET); >> > >> >tk_update_ktime_data(tk); >> > + update_pvclock_gtod(tk, action & TK_CLOCK_WAS_SET); > Why are you moving the update between vsycall and pvclock u

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-05 Thread Thomas Gleixner
On Fri, 5 Sep 2014, Paolo Bonzini wrote: > Il 05/09/2014 17:14, Thomas Gleixner ha scritto: > > So that means the code is correct. Now where is the bug? > > In kernel/time/timekeeping.c? > > We know that we should have > > base_mono = wall_to_monotonic + xtime_sec > > Instead

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-05 Thread Paolo Bonzini
Il 05/09/2014 17:14, Thomas Gleixner ha scritto: > So that means the code is correct. Now where is the bug? In kernel/time/timekeeping.c? We know that we should have base_mono = wall_to_monotonic + xtime_sec Instead it is base_mono = wall_to_monotonic + xtime_se

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-05 Thread Thomas Gleixner
On Thu, 4 Sep 2014, Paolo Bonzini wrote: > Il 04/09/2014 22:58, Thomas Gleixner ha scritto: > > This is simply wrong. > > It is. > > > Now I have no idea why you think it needs to add xtime_sec. If the > > result is wrong, then we need to figure out which one of the supplied > > values is wrong

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Thomas Gleixner
On Thu, 4 Sep 2014, Paolo Bonzini wrote: > Il 04/09/2014 22:58, Thomas Gleixner ha scritto: > > This is simply wrong. > > It is. > > > Now I have no idea why you think it needs to add xtime_sec. If the > > result is wrong, then we need to figure out which one of the supplied > > values is wrong a

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Thomas Gleixner
On Thu, 4 Sep 2014, Paolo Bonzini wrote: > Commit cbcf2dd3b3d4 (x86: kvm: Make kvm_get_time_and_clockread() nanoseconds > based, 2014-07-16) used the wrong formula for boot_ns, thus breaking kvmclock > on > hosts that have a reliable TSC. > > To find the right formula, let's first backport the s

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Paolo Bonzini
Il 04/09/2014 22:58, Thomas Gleixner ha scritto: > This is simply wrong. It is. > Now I have no idea why you think it needs to add xtime_sec. If the > result is wrong, then we need to figure out which one of the supplied > values is wrong and not blindly add xtime_sec just because that makes > it

[PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Paolo Bonzini
Commit cbcf2dd3b3d4 (x86: kvm: Make kvm_get_time_and_clockread() nanoseconds based, 2014-07-16) used the wrong formula for boot_ns, thus breaking kvmclock on hosts that have a reliable TSC. To find the right formula, let's first backport the switch to nanoseconds to 3.16-era timekeeping logic. Th

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Thomas Gleixner
On Thu, 4 Sep 2014, Paolo Bonzini wrote: > Commit cbcf2dd3b3d4 (x86: kvm: Make kvm_get_time_and_clockread() nanoseconds > based, 2014-07-16) forgot to add tk->xtime_sec, thus breaking kvmclock on Errm. How is boottime related to xtime_sec? > hosts that have a reliable TSC. Add it back; and sinc

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Chris J Arges
On 09/04/2014 03:40 PM, Paolo Bonzini wrote: > Il 04/09/2014 22:37, Chris J Arges ha scritto: - boot_ns = ktime_to_ns(ktime_add(tk->tkr.base_mono, tk->offs_boot)); + boot_ns = ktime_to_ns(ktime_sub(tk->offs_real, tk->offs_boot)); write_seqcount_begin(&vdata->seq);

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Paolo Bonzini
Il 04/09/2014 22:37, Chris J Arges ha scritto: >> > - boot_ns = ktime_to_ns(ktime_add(tk->tkr.base_mono, tk->offs_boot)); >> > + boot_ns = ktime_to_ns(ktime_sub(tk->offs_real, tk->offs_boot)); >> > >> >write_seqcount_begin(&vdata->seq); >> > >> > If it doesn't work, then commit 02cba1598a2

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Chris J Arges
On 09/04/2014 02:42 PM, Paolo Bonzini wrote: > Il 04/09/2014 21:15, Paolo Bonzini ha scritto: >> Il 04/09/2014 20:16, Chris J Arges ha scritto: + boot_ns = timespec_to_ns(&tk->total_sleep_time) + + tk->wall_to_monotonic.tv_sec * (u64)NSEC_PER_SEC + + tk->wall_to_

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Paolo Bonzini
Il 04/09/2014 21:15, Paolo Bonzini ha scritto: > Il 04/09/2014 20:16, Chris J Arges ha scritto: >>> + boot_ns = timespec_to_ns(&tk->total_sleep_time) >>> + + tk->wall_to_monotonic.tv_sec * (u64)NSEC_PER_SEC >>> + + tk->wall_to_monotonic.tv_nsec >>> + + tk->xtime_sec

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Paolo Bonzini
Il 04/09/2014 20:16, Chris J Arges ha scritto: >> +boot_ns = timespec_to_ns(&tk->total_sleep_time) >> ++ tk->wall_to_monotonic.tv_sec * (u64)NSEC_PER_SEC >> ++ tk->wall_to_monotonic.tv_nsec >> ++ tk->xtime_sec * (u64)NSEC_PER_SEC; So this means that the abov

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Paolo Bonzini
Il 04/09/2014 21:00, John Stultz ha scritto: > > Hey, thanks for reporting the issue and sending an initial patch (even > if its not quite all sorted yet). > > Is the test you're using here available somewhere? Are there any > special requirements to run it? You need KVM on a machine with clocks

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread John Stultz
On Thu, Sep 4, 2014 at 9:00 AM, Chris J Arges wrote: > > > On 09/04/2014 07:58 AM, Paolo Bonzini wrote: >> Commit cbcf2dd3b3d4 (x86: kvm: Make kvm_get_time_and_clockread() nanoseconds >> based, 2014-07-16) forgot to add tk->xtime_sec, thus breaking kvmclock on >> hosts that have a reliable TSC. A

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Chris J Arges
On 09/04/2014 12:14 PM, Paolo Bonzini wrote: > Il 04/09/2014 18:00, Chris J Arges ha scritto: >> Uptime: >> 15:58:02 up 1:00, 1 user, load average: 0.59, 0.60, 0.31 >> >> Here is the output: >> >> ./x86-run x86/kvmclock_test.flat -smp 2 --append "1000 `date +%s`" >> qemu-system-x86_64 -en

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Paolo Bonzini
Il 04/09/2014 14:58, Paolo Bonzini ha scritto: > Commit cbcf2dd3b3d4 (x86: kvm: Make kvm_get_time_and_clockread() nanoseconds > based, 2014-07-16) forgot to add tk->xtime_sec, thus breaking kvmclock on > hosts that have a reliable TSC. Add it back; and since the field boot_ns > is not anymore rela

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Paolo Bonzini
Il 04/09/2014 18:00, Chris J Arges ha scritto: > Uptime: > 15:58:02 up 1:00, 1 user, load average: 0.59, 0.60, 0.31 > > Here is the output: > > ./x86-run x86/kvmclock_test.flat -smp 2 --append "1000 `date +%s`" > qemu-system-x86_64 -enable-kvm -device pc-testdev -device > isa-debug-exit,i

Re: [PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Chris J Arges
On 09/04/2014 07:58 AM, Paolo Bonzini wrote: > Commit cbcf2dd3b3d4 (x86: kvm: Make kvm_get_time_and_clockread() nanoseconds > based, 2014-07-16) forgot to add tk->xtime_sec, thus breaking kvmclock on > hosts that have a reliable TSC. Add it back; and since the field boot_ns > is not anymore rela

[PATCH] KVM: x86: fix kvmclock breakage from timers branch merge

2014-09-04 Thread Paolo Bonzini
Commit cbcf2dd3b3d4 (x86: kvm: Make kvm_get_time_and_clockread() nanoseconds based, 2014-07-16) forgot to add tk->xtime_sec, thus breaking kvmclock on hosts that have a reliable TSC. Add it back; and since the field boot_ns is not anymore related to the host boot-based clock, rename boot_ns->nsec_