linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Fwd: sched_clock() has poor resolution]
@ 2005-09-22  7:28 Pierre Ossman
  2005-09-22 20:59 ` Dominik Brodowski
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre Ossman @ 2005-09-22  7:28 UTC (permalink / raw)
  To: LKML; +Cc: Jesper Juhl, Dominik Brodowski

cc:ing some timer hackers.

-------- Original Message --------
Subject: sched_clock() has poor resolution
Date: Tue, 20 Sep 2005 12:02:34 +0200
From: Pierre Ossman <drzeus-list@drzeus.cx>
To: LKML <linux-kernel@vger.kernel.org>

I've been trying to hunt down a HZ bug and as part of that I thought
having printk timestamps would be nice. But too much dismay I noticed
that I couldn't get very good resolution out of these.

The problem turned out to be that sched_clock() uses jiffies as a time
source. It will only use the TSC if that's the primary time source of
the system. But since I have a PM timer that is given priority.

So I see two solutions here:

 * Let sched_clock() follow the time source. Don't have it coupled to
the TSC.

 * Init the TSC even though it isn't used for anything but sched_clock().

The first solution might have problems if one of the "better" timers are
slow as hell to read and the second if there is some assumed dependency
between sched_clock() and the primary timer. I'm blisfully ignorant of
this area so input is welcome.

Rgds
Pierre
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Fwd: sched_clock() has poor resolution]
  2005-09-22  7:28 [Fwd: sched_clock() has poor resolution] Pierre Ossman
@ 2005-09-22 20:59 ` Dominik Brodowski
  0 siblings, 0 replies; 2+ messages in thread
From: Dominik Brodowski @ 2005-09-22 20:59 UTC (permalink / raw)
  To: Pierre Ossman; +Cc: LKML, Jesper Juhl, john stultz

Hi,

On Thu, Sep 22, 2005 at 09:28:49AM +0200, Pierre Ossman wrote:
>  * Let sched_clock() follow the time source. Don't have it coupled to
> the TSC.
> 
>  * Init the TSC even though it isn't used for anything but sched_clock().

As pmtmr requires somewhat working TSCs, you can even use TSC if pmtmr is
used as a time source:

static int init_pmtmr(char* override)
...
        /* we use the TSC for delay_pmtmr, so make sure it exists */
        if (!cpu_has_tsc)
                return -ENODEV;
...

So at least for this case, sched_clock() can and should use TSC, not
jiffies, AFAICS.

Thanks,
	Dominik

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-09-22 20:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-22  7:28 [Fwd: sched_clock() has poor resolution] Pierre Ossman
2005-09-22 20:59 ` Dominik Brodowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).