* Re: GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized
2004-06-03 20:28 GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC Christoph Lameter
@ 2004-06-03 20:51 ` Andreas Schwab
2004-06-03 21:21 ` Christoph Lameter
` (8 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Andreas Schwab @ 2004-06-03 20:51 UTC (permalink / raw)
To: linux-ia64
Christoph Lameter <christoph@lameter.com> writes:
> +ifeq ($(subdir),malloc)
> +libmemusage-routines += hp-timing
> +endif
That needs to be libmemusage-sysdep_routines.
> + int fd = open ("/proc/sal/itc_drift", O_RDONLY);
This is Linux-specific, isn't it? Thus it belongs under
sysdeps/.../linux/ia64.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized
2004-06-03 20:28 GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC Christoph Lameter
2004-06-03 20:51 ` GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized Andreas Schwab
@ 2004-06-03 21:21 ` Christoph Lameter
2004-06-03 21:52 ` Andreas Schwab
` (7 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Christoph Lameter @ 2004-06-03 21:21 UTC (permalink / raw)
To: linux-ia64
On Thu, 3 Jun 2004, Andreas Schwab wrote:
> That needs to be libmemusage-sysdep_routines.
>
> > + int fd = open ("/proc/sal/itc_drift", O_RDONLY);
>
> This is Linux-specific, isn't it? Thus it belongs under
> sysdeps/.../linux/ia64.
Quite a bit of the code is linux specific. Do I leave the generic code
broken?
I could put some hooks in that have to be satisfied by the
operating system specific versions.
That would require the following functins:
int itc_drifting(void) -> OS dependent way of determining if ITC is drifting.
int __get_freq(void) -> Determine ITC frequency that has to be simulated.
Are these to be put into a separate file? itc_drift.c that satisfied those
dependencies in an OS specific way?
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized
2004-06-03 20:28 GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC Christoph Lameter
2004-06-03 20:51 ` GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized Andreas Schwab
2004-06-03 21:21 ` Christoph Lameter
@ 2004-06-03 21:52 ` Andreas Schwab
2004-06-04 6:04 ` GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC David Mosberger
` (6 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Andreas Schwab @ 2004-06-03 21:52 UTC (permalink / raw)
To: linux-ia64
Christoph Lameter <christoph@lameter.com> writes:
> On Thu, 3 Jun 2004, Andreas Schwab wrote:
>
>> That needs to be libmemusage-sysdep_routines.
>
>>
>> > + int fd = open ("/proc/sal/itc_drift", O_RDONLY);
>>
>> This is Linux-specific, isn't it? Thus it belongs under
>> sysdeps/.../linux/ia64.
>
> Quite a bit of the code is linux specific. Do I leave the generic code
> broken?
The generic code has to be adjusted for the specific target anyway, if and
when someone ports it to a non-Linux system.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC
2004-06-03 20:28 GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC Christoph Lameter
` (2 preceding siblings ...)
2004-06-03 21:52 ` Andreas Schwab
@ 2004-06-04 6:04 ` David Mosberger
2004-06-04 6:12 ` GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized Ulrich Drepper
` (5 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: David Mosberger @ 2004-06-04 6:04 UTC (permalink / raw)
To: linux-ia64
>>>>> On Thu, 3 Jun 2004 13:28:35 -0700 (PDT), Christoph Lameter <christoph@lameter.com> said:
Christoph> The following patch checks for drifty ITC clocks based on
Christoph> that file. If ITC is drifty then it generates timestamps
Christoph> based on the gettimeofday system call.
Does anyone else find it annoying that gettimeofday() only provides
micro-second resolution? We can do syscalls significantly faster than
that (especially with a light-weight syscall handler). Time for a
kernel extension?
--daivd
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized
2004-06-03 20:28 GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC Christoph Lameter
` (3 preceding siblings ...)
2004-06-04 6:04 ` GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC David Mosberger
@ 2004-06-04 6:12 ` Ulrich Drepper
2004-06-04 6:58 ` David Mosberger
` (4 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Ulrich Drepper @ 2004-06-04 6:12 UTC (permalink / raw)
To: linux-ia64
David Mosberger wrote:
> Does anyone else find it annoying that gettimeofday() only provides
> micro-second resolution? We can do syscalls significantly faster than
> that (especially with a light-weight syscall handler). Time for a
> kernel extension?
What do you think clock_gettime(CLOCK_REALTIME) is for?
--
➧ Ulrich Drepper ➧ Red Hat, Inc. ➧ 444 Castro St ➧ Mountain View, CA ❖
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized
2004-06-03 20:28 GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC Christoph Lameter
` (4 preceding siblings ...)
2004-06-04 6:12 ` GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized Ulrich Drepper
@ 2004-06-04 6:58 ` David Mosberger
2004-06-04 14:29 ` Christoph Lameter
` (3 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: David Mosberger @ 2004-06-04 6:58 UTC (permalink / raw)
To: linux-ia64
>>>>> On Thu, 03 Jun 2004 23:12:49 -0700, Ulrich Drepper <drepper@redhat.com> said:
Uli> David Mosberger wrote:
>> Does anyone else find it annoying that gettimeofday() only provides
>> micro-second resolution? We can do syscalls significantly faster than
>> that (especially with a light-weight syscall handler). Time for a
>> kernel extension?
Uli> What do you think clock_gettime(CLOCK_REALTIME) is for?
clock_gettime() is fine. I think last time I played with it it was
still implemented in user-level. Probably just a matter of an "old"
libc...
--david
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized
2004-06-03 20:28 GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC Christoph Lameter
` (5 preceding siblings ...)
2004-06-04 6:58 ` David Mosberger
@ 2004-06-04 14:29 ` Christoph Lameter
2004-06-04 15:06 ` Christoph Lameter
` (2 subsequent siblings)
9 siblings, 0 replies; 11+ messages in thread
From: Christoph Lameter @ 2004-06-04 14:29 UTC (permalink / raw)
To: linux-ia64
On Thu, 3 Jun 2004, Ulrich Drepper wrote:
> David Mosberger wrote:
>
> > Does anyone else find it annoying that gettimeofday() only provides
> > micro-second resolution? We can do syscalls significantly faster than
> > that (especially with a light-weight syscall handler). Time for a
> > kernel extension?
>
> What do you think clock_gettime(CLOCK_REALTIME) is for?
clock_gettime(CLOCK_REALTIME) calls gettimeofday internally and then
multiplies with 1000. I have a patch that supports CLOCK_REALTIME_HR and
CLOCK_MONOTONIC_HR to access the full resolution of the clocks.
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized
2004-06-03 20:28 GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC Christoph Lameter
` (6 preceding siblings ...)
2004-06-04 14:29 ` Christoph Lameter
@ 2004-06-04 15:06 ` Christoph Lameter
2004-06-04 22:06 ` GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC Peter Chubb
2004-06-04 22:25 ` Luck, Tony
9 siblings, 0 replies; 11+ messages in thread
From: Christoph Lameter @ 2004-06-04 15:06 UTC (permalink / raw)
To: linux-ia64
On Fri, 4 Jun 2004, Ulrich Drepper wrote:
> Christoph Lameter wrote:
>
> > clock_gettime(CLOCK_REALTIME) calls gettimeofday internally and then
> > multiplies with 1000.
>
> Internally where? clock_gettime is a syscall. And it can use whatever
> functionality the kernel provides. There is absolutely no requirement
> to add additional clocks, just make clock_gettime do the right think if
> this isn't happening already.
Internally in the kernel. Excerpts from kernel/posix-timers.c:
static int do_posix_gettime(struct k_clock *clock, struct timespec *tp)
{
struct timeval tv;
if (clock->clock_get)
return clock->clock_get(tp);
do_gettimeofday(&tv);
tp->tv_sec = tv.tv_sec;
tp->tv_nsec = tv.tv_usec * NSEC_PER_USEC;
return 0;
}
static u64 do_posix_clock_monotonic_gettime_parts(
struct timespec *tp, struct timespec *mo)
{
u64 jiff;
struct timeval tpv;
unsigned int seq;
do {
seq = read_seqbegin(&xtime_lock);
do_gettimeofday(&tpv);
*mo = wall_to_monotonic;
jiff = jiffies_64;
} while(read_seqretry(&xtime_lock, seq));
/*
* Love to get this before it is converted to usec.
* It would save a div AND a mpy.
*/
tp->tv_sec = tpv.tv_sec;
tp->tv_nsec = tpv.tv_usec * NSEC_PER_USEC;
return jiff;
}
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC
2004-06-03 20:28 GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC Christoph Lameter
` (7 preceding siblings ...)
2004-06-04 15:06 ` Christoph Lameter
@ 2004-06-04 22:06 ` Peter Chubb
2004-06-04 22:25 ` Luck, Tony
9 siblings, 0 replies; 11+ messages in thread
From: Peter Chubb @ 2004-06-04 22:06 UTC (permalink / raw)
To: linux-ia64
>>>>> "David" = David Mosberger <davidm@napali.hpl.hp.com> writes:
David> Does anyone else find it annoying that gettimeofday() only
David> provides micro-second resolution? We can do syscalls
David> significantly faster than that (especially with a light-weight
David> syscall handler). Time for a kernel extension?
Only problem is that we can get high precision, but unless we can also
get access to the NTP daemon's parameters, we don't know the accuracy
of the result.
Dunno about your systems, but mine drift around the real time by a
couple of *milliseconds* so nanosecond accuracy in gettimeofday()
won't buy much.
For a lot of things, however, all one needs is a precise monotonic
clock; absolute accuracy isn't required. Making an alternate internal
do_gettimeofday that takes a timespec instead of a timeval, and using
it for the posix monotonic clock might help here. There's the
standard clock_gettime() function for accessing the values. Or the
posix time code that George Anzinger wrote (who's CCed on this thread
now, because he understands the issues better than I) could definitely
use a monotonic high precision clock.
--
Dr Peter Chubb http://www.gelato.unsw.edu.au peterc AT gelato.unsw.edu.au
The technical we do immediately, the political takes *forever*
^ permalink raw reply [flat|nested] 11+ messages in thread* RE: GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC
2004-06-03 20:28 GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC Christoph Lameter
` (8 preceding siblings ...)
2004-06-04 22:06 ` GLIBC IA64 HP_TIMING fixes for SMP systems with unsynchronized ITC Peter Chubb
@ 2004-06-04 22:25 ` Luck, Tony
9 siblings, 0 replies; 11+ messages in thread
From: Luck, Tony @ 2004-06-04 22:25 UTC (permalink / raw)
To: linux-ia64
>Only problem is that we can get high precision, but unless we can also
>get access to the NTP daemon's parameters, we don't know the accuracy
>of the result.
>
>Dunno about your systems, but mine drift around the real time by a
>couple of *milliseconds* so nanosecond accuracy in gettimeofday()
>won't buy much.
It depends what you are trying to do. If you want to time how long
a short event takes ... then asking for the time of day before and
after and subtracting is the obvious solution. If the event only
takes 5 micro-seconds, a one micro-second granularity in gettimeofday()
will give a +/- 20% error. Even if the absolute time you see in the
two calls is off from UTC by a couple of milli-seconds, the rate of
drift is presumably small enough for the subtraction to make sense.
-Tony
^ permalink raw reply [flat|nested] 11+ messages in thread