Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andi Kleen
> They could be huge differences - unbounded, in fact. It would make > printk fairly hard to interpret, I would think. The only benefit to > using sched_clock in printk is that if you're using it to work out the > startup latencies you won't be confused by stolen time. But I think > that's a

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Jeremy Fitzhardinge
Andi Kleen wrote: > Even on real hardware it's also per CPU, although the errors > are usually not big. At least the scheduler deals with that by > only ever comparing time stamps from the same CPU. > Well, it uses sched_clock to measure how long something has been asleep, which is inherently

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Jeremy Fitzhardinge
Andrew Morton wrote: > blktrace. I've seen a couple of trace/debug-style things which use > sched_clock for timestamping event collection. I think lttng does exotic > things with TSCs, performing private skew correction, although that might > have changed now. > I'm not worried about things

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Jeremy Fitzhardinge
Andi Kleen wrote: > They should always just store the cpu too and educate the users that > only (cpu, timestamp) pairs make sense to compare. > > That said at least my new sched_clock should not normally show > large non differences between CPUs, so it can be usually ignored, but they > can >

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andi Kleen
On Thursday 12 April 2007 19:55:59 Andrew Morton wrote: > On Thu, 12 Apr 2007 10:43:03 -0700 > Jeremy Fitzhardinge <[EMAIL PROTECTED]> wrote: > > > Andrew Morton wrote: > > > hm. People (ab)use sched_clock() for all sorts of things nowadays. I > > > wouldn't > > > do anything to degrade it

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andrew Morton
On Thu, 12 Apr 2007 10:43:03 -0700 Jeremy Fitzhardinge <[EMAIL PROTECTED]> wrote: > Andrew Morton wrote: > > hm. People (ab)use sched_clock() for all sorts of things nowadays. I > > wouldn't > > do anything to degrade it just on behalf of printk-timestamping. > > > > printk was the only

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Daniel Walker
On Thu, 2007-04-12 at 10:43 -0700, Jeremy Fitzhardinge wrote: > Andrew Morton wrote: > > hm. People (ab)use sched_clock() for all sorts of things nowadays. I > > wouldn't > > do anything to degrade it just on behalf of printk-timestamping. > > > > printk was the only non-scheduler-ish use I

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andi Kleen
On Thursday 12 April 2007 19:43:03 Jeremy Fitzhardinge wrote: > Andrew Morton wrote: > > hm. People (ab)use sched_clock() for all sorts of things nowadays. I > > wouldn't > > do anything to degrade it just on behalf of printk-timestamping. > > > > printk was the only non-scheduler-ish use I

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andi Kleen
On Thursday 12 April 2007 19:41:51 Jeremy Fitzhardinge wrote: > Andi Kleen wrote: > > Ok. I think it's better to just fix sched_clock() again than to > > add another one. I can probably > > eliminate the ktime_get() and use something based on jiffies. That will > > be inaccurate for the instable

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Jeremy Fitzhardinge
Andrew Morton wrote: > hm. People (ab)use sched_clock() for all sorts of things nowadays. I > wouldn't > do anything to degrade it just on behalf of printk-timestamping. > printk was the only non-scheduler-ish use I could find. Are there others? J - To unsubscribe from this list: send

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Jeremy Fitzhardinge
Andi Kleen wrote: > Ok. I think it's better to just fix sched_clock() again than to > add another one. I can probably > eliminate the ktime_get() and use something based on jiffies. That will > be inaccurate for the instable case of course. > > I will do that later today. sched_clock seems a bit

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andi Kleen
> OK, so I resurrected x86_64-mm-sched-clock-share.patch and > x86_64-mm-sched-clock64.patch. The x86_64 box hangs on boot when using > netconsole and printk timestamps too. Removing "time" from the kernel boot > command line prevents that. It's not worse than before for you CPU. The old code

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andrew Morton
On Thu, 12 Apr 2007 18:45:39 +0200 Andi Kleen <[EMAIL PROTECTED]> wrote: > > > I was proposing that i386 and x86_64 be given a new, lockless, > > high-resolution printk_clock(). Presently x86 uses the default > > printk_clock(), which uses sched_clock(). Presumably copying the > >

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andi Kleen
> I was proposing that i386 and x86_64 be given a new, lockless, > high-resolution printk_clock(). Presently x86 uses the default > printk_clock(), which uses sched_clock(). Presumably copying the > pre-x86_64-mm-sched-clock-share.patch version of sched_clock() into > printk_clock() will

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andrew Morton
On Thu, 12 Apr 2007 11:36:02 +0200 Andi Kleen <[EMAIL PROTECTED]> wrote: > > > OK, so I resurrected x86_64-mm-sched-clock-share.patch and > > x86_64-mm-sched-clock64.patch. The x86_64 box hangs on boot when using > > netconsole and printk timestamps too. Removing "time" from the kernel boot >

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andi Kleen
> OK, so I resurrected x86_64-mm-sched-clock-share.patch and > x86_64-mm-sched-clock64.patch. The x86_64 box hangs on boot when using > netconsole and printk timestamps too. Removing "time" from the kernel boot > command line prevents that. Ah. But ktime_get shouldn't printk. Or did you change

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andi Kleen
OK, so I resurrected x86_64-mm-sched-clock-share.patch and x86_64-mm-sched-clock64.patch. The x86_64 box hangs on boot when using netconsole and printk timestamps too. Removing time from the kernel boot command line prevents that. Ah. But ktime_get shouldn't printk. Or did you change that?

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andrew Morton
On Thu, 12 Apr 2007 11:36:02 +0200 Andi Kleen [EMAIL PROTECTED] wrote: OK, so I resurrected x86_64-mm-sched-clock-share.patch and x86_64-mm-sched-clock64.patch. The x86_64 box hangs on boot when using netconsole and printk timestamps too. Removing time from the kernel boot command

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andi Kleen
I was proposing that i386 and x86_64 be given a new, lockless, high-resolution printk_clock(). Presently x86 uses the default printk_clock(), which uses sched_clock(). Presumably copying the pre-x86_64-mm-sched-clock-share.patch version of sched_clock() into printk_clock() will suffice.

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andrew Morton
On Thu, 12 Apr 2007 18:45:39 +0200 Andi Kleen [EMAIL PROTECTED] wrote: I was proposing that i386 and x86_64 be given a new, lockless, high-resolution printk_clock(). Presently x86 uses the default printk_clock(), which uses sched_clock(). Presumably copying the

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andi Kleen
OK, so I resurrected x86_64-mm-sched-clock-share.patch and x86_64-mm-sched-clock64.patch. The x86_64 box hangs on boot when using netconsole and printk timestamps too. Removing time from the kernel boot command line prevents that. It's not worse than before for you CPU. The old code did

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Jeremy Fitzhardinge
Andi Kleen wrote: Ok. I think it's better to just fix sched_clock() again than to add another one. I can probably eliminate the ktime_get() and use something based on jiffies. That will be inaccurate for the instable case of course. I will do that later today. sched_clock seems a bit weird

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Jeremy Fitzhardinge
Andrew Morton wrote: hm. People (ab)use sched_clock() for all sorts of things nowadays. I wouldn't do anything to degrade it just on behalf of printk-timestamping. printk was the only non-scheduler-ish use I could find. Are there others? J - To unsubscribe from this list: send the

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andi Kleen
On Thursday 12 April 2007 19:41:51 Jeremy Fitzhardinge wrote: Andi Kleen wrote: Ok. I think it's better to just fix sched_clock() again than to add another one. I can probably eliminate the ktime_get() and use something based on jiffies. That will be inaccurate for the instable case of

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andi Kleen
On Thursday 12 April 2007 19:43:03 Jeremy Fitzhardinge wrote: Andrew Morton wrote: hm. People (ab)use sched_clock() for all sorts of things nowadays. I wouldn't do anything to degrade it just on behalf of printk-timestamping. printk was the only non-scheduler-ish use I could

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Daniel Walker
On Thu, 2007-04-12 at 10:43 -0700, Jeremy Fitzhardinge wrote: Andrew Morton wrote: hm. People (ab)use sched_clock() for all sorts of things nowadays. I wouldn't do anything to degrade it just on behalf of printk-timestamping. printk was the only non-scheduler-ish use I could

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andrew Morton
On Thu, 12 Apr 2007 10:43:03 -0700 Jeremy Fitzhardinge [EMAIL PROTECTED] wrote: Andrew Morton wrote: hm. People (ab)use sched_clock() for all sorts of things nowadays. I wouldn't do anything to degrade it just on behalf of printk-timestamping. printk was the only

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andi Kleen
On Thursday 12 April 2007 19:55:59 Andrew Morton wrote: On Thu, 12 Apr 2007 10:43:03 -0700 Jeremy Fitzhardinge [EMAIL PROTECTED] wrote: Andrew Morton wrote: hm. People (ab)use sched_clock() for all sorts of things nowadays. I wouldn't do anything to degrade it just on behalf of

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Jeremy Fitzhardinge
Andi Kleen wrote: They should always just store the cpu too and educate the users that only (cpu, timestamp) pairs make sense to compare. That said at least my new sched_clock should not normally show large non differences between CPUs, so it can be usually ignored, but they can happen.

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Jeremy Fitzhardinge
Andrew Morton wrote: blktrace. I've seen a couple of trace/debug-style things which use sched_clock for timestamping event collection. I think lttng does exotic things with TSCs, performing private skew correction, although that might have changed now. I'm not worried about things using

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Jeremy Fitzhardinge
Andi Kleen wrote: Even on real hardware it's also per CPU, although the errors are usually not big. At least the scheduler deals with that by only ever comparing time stamps from the same CPU. Well, it uses sched_clock to measure how long something has been asleep, which is inherently

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-12 Thread Andi Kleen
They could be huge differences - unbounded, in fact. It would make printk fairly hard to interpret, I would think. The only benefit to using sched_clock in printk is that if you're using it to work out the startup latencies you won't be confused by stolen time. But I think that's a

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-11 Thread Andrew Morton
On Wed, 11 Apr 2007 14:33:57 -0700 Andrew Morton <[EMAIL PROTECTED]> wrote: > > Here is the call ordering , > > > > ktime_get() > > ktime_get_ts() -> read_seqretry(_lock, seq) > > getnstimeofday() > >__get_realtime_clock_ts() -> read_seqretry(_lock, seq) > > > > > > I wonder if there is

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-11 Thread Andrew Morton
On Wed, 11 Apr 2007 13:54:41 -0700 Daniel Walker <[EMAIL PROTECTED]> wrote: > On Wed, 2007-04-11 at 13:31 -0700, Andrew Morton wrote: > > On Wed, 11 Apr 2007 09:29:04 -0700 > > Daniel Walker <[EMAIL PROTECTED]> wrote: > > > > > The locking of the xtime_lock around the cpu notifier is unessesary

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-11 Thread Daniel Walker
On Wed, 2007-04-11 at 13:31 -0700, Andrew Morton wrote: > On Wed, 11 Apr 2007 09:29:04 -0700 > Daniel Walker <[EMAIL PROTECTED]> wrote: > > > The locking of the xtime_lock around the cpu notifier is unessesary now. At > > one > > time the tsc was used after a frequency change for timekeeping,

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-11 Thread Andrew Morton
On Wed, 11 Apr 2007 09:29:04 -0700 Daniel Walker <[EMAIL PROTECTED]> wrote: > The locking of the xtime_lock around the cpu notifier is unessesary now. At > one > time the tsc was used after a frequency change for timekeeping, but the > re-write > of timekeeping no longer uses the TSC unless the

[PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-11 Thread Daniel Walker
The locking of the xtime_lock around the cpu notifier is unessesary now. At one time the tsc was used after a frequency change for timekeeping, but the re-write of timekeeping no longer uses the TSC unless the frequency is constant. The variables that are changed in this section of code had also

[PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-11 Thread Daniel Walker
The locking of the xtime_lock around the cpu notifier is unessesary now. At one time the tsc was used after a frequency change for timekeeping, but the re-write of timekeeping no longer uses the TSC unless the frequency is constant. The variables that are changed in this section of code had also

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-11 Thread Andrew Morton
On Wed, 11 Apr 2007 09:29:04 -0700 Daniel Walker [EMAIL PROTECTED] wrote: The locking of the xtime_lock around the cpu notifier is unessesary now. At one time the tsc was used after a frequency change for timekeeping, but the re-write of timekeeping no longer uses the TSC unless the

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-11 Thread Daniel Walker
On Wed, 2007-04-11 at 13:31 -0700, Andrew Morton wrote: On Wed, 11 Apr 2007 09:29:04 -0700 Daniel Walker [EMAIL PROTECTED] wrote: The locking of the xtime_lock around the cpu notifier is unessesary now. At one time the tsc was used after a frequency change for timekeeping, but the

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-11 Thread Andrew Morton
On Wed, 11 Apr 2007 13:54:41 -0700 Daniel Walker [EMAIL PROTECTED] wrote: On Wed, 2007-04-11 at 13:31 -0700, Andrew Morton wrote: On Wed, 11 Apr 2007 09:29:04 -0700 Daniel Walker [EMAIL PROTECTED] wrote: The locking of the xtime_lock around the cpu notifier is unessesary now. At

Re: [PATCH] i386 tsc: remove xtime_lock'ing around cpufreq notifier

2007-04-11 Thread Andrew Morton
On Wed, 11 Apr 2007 14:33:57 -0700 Andrew Morton [EMAIL PROTECTED] wrote: Here is the call ordering , ktime_get() ktime_get_ts() - read_seqretry(xtime_lock, seq) getnstimeofday() __get_realtime_clock_ts() - read_seqretry(xtime_lock, seq) I wonder if there is a weird