public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@elte.hu>
To: Michael Davidson <md@google.com>
Cc: linux-kernel@vger.kernel.org, mbligh@google.com,
	tglx@linutronix.de, Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Arjan van de Ven <arjan@infradead.org>,
	"H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH] x86: TSC resync
Date: Fri, 26 Sep 2008 09:02:17 +0200	[thread overview]
Message-ID: <20080926070217.GA26081@elte.hu> (raw)
In-Reply-To: <20080925220212.45B0029683@localhost>


* Michael Davidson <md@google.com> wrote:

> This patch is a slightly cleaned up version of one which has been in 
> use at for some time now at Google.
> 
> It uses an HPET based time source to resynchronize the TSC on systems 
> where it would otherwise be unsynchronized - eg early AMD Opteron 
> based systems where the TSC rate drifts when going in and out of the 
> C1E halt state.
> 
> While the approach is quite crude it has been effective for systems 
> where user space code relies on the TSC advancing at a constant rate 
> and being reasonably well synchronized between CPUs. The skew between 
> TSC's on different processors as seen from user space is typically 
> less than +/- 1000 clock cycles which has proved to be sufficient for 
> the applications that we care about.

hm, this patch syncs the TSCs every 20 seconds. That is enough to sync 
up AMD CPUs where the TSC slows down _slightly_ (at 10 ppm per second or 
so) when it's in HLT.

How does it behave in face of 'TSC stops' systems - systems with C2/C3 
sleeps? Basically all modern CPUs that save power are affected by that: 
the TSC get brutally cut when idle - almost all modern power saving 
laptop, desktop and server CPUs.

Also, what does it do in face of cpufreq-affected TSCs? That too is a 
large category of systems. (but most currently shipping CPUs fortunately 
have a cpufreq-invariant TSC already.)

> I don't expect this patch to be of much general interest, but if you 
> happen to be unlucky enough to have a system where the TSC is not 
> synchronized across CPUs and user space code which relies on the 
> assumption that it is, then this patch may be useful.
> 
> Signed-off-by: Michael Davidson <md@google.com>

This actually looks pretty interesting IMO, and the code looks simple, 
clean and straightforward enough - but it might not be enough to be a 
generic solution.

	Ingo

  reply	other threads:[~2008-09-26  7:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-25 22:02 [PATCH] x86: TSC resync Michael Davidson
2008-09-26  7:02 ` Ingo Molnar [this message]
     [not found]   ` <6cc912950809261218u5a1bf8b8w216556b50d0e33ab@mail.gmail.com>
2008-09-27 16:51     ` Ingo Molnar

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=20080926070217.GA26081@elte.hu \
    --to=mingo@elte.hu \
    --cc=a.p.zijlstra@chello.nl \
    --cc=arjan@infradead.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbligh@google.com \
    --cc=md@google.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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