From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Nicolas Pitre <nico@cam.org>
Cc: Andi Kleen <ak@suse.de>, linux-kernel@vger.kernel.org
Subject: Re: sched_clock() uses are broken
Date: Tue, 2 May 2006 20:08:14 +0100 [thread overview]
Message-ID: <20060502190814.GC4223@flint.arm.linux.org.uk> (raw)
In-Reply-To: <Pine.LNX.4.64.0605021503230.28543@localhost.localdomain>
On Tue, May 02, 2006 at 03:05:22PM -0400, Nicolas Pitre wrote:
> On Tue, 2 May 2006, Russell King wrote:
> > On Tue, May 02, 2006 at 01:18:25PM -0400, Nicolas Pitre wrote:
> > > On Tue, 2 May 2006, Andi Kleen wrote:
> > >
> > > > On Tuesday 02 May 2006 18:50, Russell King wrote:
> > > >
> > > > > You're right assuming you have a 64-bit TSC, but ARM has at best a
> > > > > 32-bit cycle counter which rolls over about every 179 seconds - with
> > > > > gives a range of values from sched_clock from 0 to 178956970625 or
> > > > > 0x29AAAAAA81.
> > > > >
> > > > > That's rather more of a problem than having it happen every 208 days.
> > > >
> > > > Ok but you know it's always 32bit right? You can fix it up then
> > > > with your proposal of a sched_diff()
> > > >
> > > > The problem would be fixing it up with a unknown number of bits.
> > >
> > > Just shift it left so you know you always have the most significant bits
> > > valid. The sched_diff() would take care of scaling it back to nanosecs.
> >
> > sched_clock is currently defined to return nanoseconds so this isn't
> > a possibility.
>
> If we're discussing the addition of a sched_clock_diff(), why whouldn't
> shed_clock() return anything it wants in that context? It could be
> redefined to have a return value meaningful only to shed_clock_diff()?
If we're talking about doing that, we need to replace sched_clock()
to ensure that we all users are aware that it has changed.
I did think about that for my original fix proposal, but stepped back
because that's a bigger change - and is something for post-2.6.17.
The smallest fix (suitable for -rc kernels) is as I detailed.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
next prev parent reply other threads:[~2006-05-02 19:08 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-02 13:29 sched_clock() uses are broken Russell King
2006-05-02 14:21 ` Nick Piggin
2006-05-02 16:43 ` Andi Kleen
2006-05-02 16:50 ` Russell King
2006-05-02 17:01 ` Andi Kleen
2006-05-02 17:18 ` Nicolas Pitre
2006-05-02 18:55 ` Russell King
2006-05-02 19:05 ` Nicolas Pitre
2006-05-02 19:08 ` Russell King [this message]
2006-05-02 19:23 ` Nicolas Pitre
2006-05-02 21:35 ` Russell King
2006-05-02 17:15 ` Nicolas Pitre
2006-05-04 3:50 ` George Anzinger
2006-05-04 14:18 ` Nicolas Pitre
2006-05-02 16:54 ` Christopher Friesen
2006-05-02 16:59 ` Andi Kleen
2006-05-02 17:07 ` Nick Piggin
2006-05-03 7:09 ` Mike Galbraith
2006-05-03 7:40 ` Andi Kleen
2006-05-03 9:11 ` Mike Galbraith
2006-05-03 9:16 ` Andi Kleen
2006-05-03 9:31 ` Mike Galbraith
2006-05-07 12:33 ` Nick Piggin
2006-05-07 12:43 ` Russell King
2006-05-07 12:56 ` Nick Piggin
2006-05-07 13:00 ` Nick Piggin
2006-05-07 13:18 ` Russell King
2006-05-07 13:30 ` Nick Piggin
2006-05-07 13:55 ` Russell King
2006-05-07 14:04 ` Nick Piggin
2006-05-07 16:03 ` Andi Kleen
2006-05-07 16:53 ` Russell King
2006-05-07 17:52 ` Mike Galbraith
2006-05-07 17:37 ` Mike Galbraith
2006-05-07 17:32 ` Mike Galbraith
2006-05-08 4:14 ` Mike Galbraith
2006-05-08 4:37 ` Mike Galbraith
2006-05-08 4:46 ` Nick Piggin
2006-05-08 5:24 ` Mike Galbraith
2006-05-08 5:30 ` Nick Piggin
2006-05-04 20:02 ` Florian Paul Schmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060502190814.GC4223@flint.arm.linux.org.uk \
--to=rmk+lkml@arm.linux.org.uk \
--cc=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=nico@cam.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox