public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan@infradead.org>
To: Dan Magenheimer <dan.magenheimer@oracle.com>
Cc: Andi Kleen <andi@firstfloor.org>,
	Venkatesh Pallipadi <venki@google.com>,
	Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>,
	chris.mason@oracle.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: Export tsc related information in sysfs
Date: Sat, 15 May 2010 22:43:05 -0700	[thread overview]
Message-ID: <20100515224305.17a04022@infradead.org> (raw)
In-Reply-To: <e07ac2f3-4a82-41d9-aa41-49a94435e7b7@default>

On Sat, 15 May 2010 15:32:51 -0700 (PDT)
Dan Magenheimer <dan.magenheimer@oracle.com> wrote:

> > From: Arjan van de Ven [mailto:arjan@infradead.org]
> (Arjan comments reordered somewhat)
> 
> > But friends don't let friends use rdtsc in application code.
> 
> Um, I realize that many people have been burned by this
> many times over the years so it is a "hot stove".  I also
> realize that there are many environments where using
> rdtsc is risking stepping on landmines.  

> But I (we?) also
> know there are many environments now where using rdtsc is
> NOT risky at all... 

I see a lot of Intel hardware.. (stuff that you likely don't see yet ;-)
and I have not yet seen a system where the kernel would be able to give
the guarantee as you describe it in your email.

If you want a sysfs variable that is always 0... go wild.


> and with the vast majority of new
> systems soon shipping with Invariant TSC and a single socket
> (and even most multiple-socket systems with non-broken
> BIOSes passing a warp test), 

(the warp test is going away)

on multisocket that passes a wrap test you can still get skew over
time.. due to things like SMM, thermal throttling etc etc.


> why should past burns outlaw
> userland use of a very fast, very useful CPU feature?  After
> all, CPU designers at both Intel and AMD have spent
> a great deal of design effort and transistors to FINALLY
> provide an Invariant TSC.

sadly even with all these transistors no system that I know of today
can guarantee the guarantee by the rules you state.


> > oh and.. what notification mechanism do you have to notify the
> > application that the tsc now is no longer reliable? Such conditions
> > can exist... for example due to a CPU being hotplugged, or some SMM
> > screwing around and the kernel detecting that or .. or ...
> 
> The proposal doesn't provide a notification mechanism (though I'm
> not against it)... if the tsc can EVER become unreliable,
> tsc_reliable should be 0.

then it should be 0 always on all of todays hardware.
SMM, thermal overload, etc etc ... you name it.
Things the kernel will get notified about... 

> A CPU-hotplugable system is a good example of a case where
> the kernel should expose that tsc_reliable is 0.  (I've heard
> anecdotally that CPU hotplug into a QPI or Hypertransport system
> will have some other interesting challenges, so may require some
> special kernel parameters anyway.)  

eh no.
hot add works just fine.

(hot remove is a very different ballgame)


> > really. Use the vsyscall. If the vsyscall does not do exactly what
> > you want, make a better vsyscall.
> 
> If this discussion results in a better vsyscall and/or a way
> for applications to easily determine (and report loudly) that
> the system does NOT provide a good way to do a fast timestamp,
> that may be sufficient.  But please propose how that will be done
> as the current software choices are inadequate and the CPU
> designers have finally fixed the problem for the vast majority
> of systems. 

*cough*

> I am already aware of some enterprise software
> that is doing its best to guess whether TSC is reliable by
> looking at CPU families and socket counts, but this is doomed
> to failure in userland and is something that the kernel knows
> and should now expose.

can you name said "enterprise" software by name please? We need a huge
advertisement to let people know not to trust their important data to
it..



-- 
Arjan van de Ven 	Intel Open Source Technology Centre
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org

  reply	other threads:[~2010-05-16  5:40 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-15  1:40 [PATCH] x86: Export tsc related information in sysfs Venkatesh Pallipadi
2010-05-15  9:57 ` Andi Kleen
2010-05-15 13:29   ` Dan Magenheimer
2010-05-15 16:48     ` Venkatesh Pallipadi
2010-05-15 19:14     ` Arjan van de Ven
2010-05-15 22:32       ` Dan Magenheimer
2010-05-16  5:43         ` Arjan van de Ven [this message]
2010-05-16  9:20           ` Thomas Gleixner
2010-05-16 16:42             ` Dan Magenheimer
2010-05-16 19:14               ` Thomas Gleixner
2010-05-17  1:31                 ` Dan Magenheimer
2010-05-17  5:06                   ` Arjan van de Ven
2010-05-18  9:58                     ` Peter Zijlstra
2010-05-18 10:03                       ` Peter Zijlstra
2010-05-18 11:25                       ` Andi Kleen
2010-05-18 11:58                         ` Peter Zijlstra
2010-05-18 15:13                           ` Dan Magenheimer
2010-05-18 16:40                           ` H. Peter Anvin
2010-05-18 16:52                             ` Peter Zijlstra
2010-05-18 17:04                               ` H. Peter Anvin
2010-05-18 17:49                                 ` Dan Magenheimer
2010-05-18 18:46                                   ` H. Peter Anvin
2010-05-18 19:00                                     ` Dan Magenheimer
2010-05-18 19:16                                       ` Dan Magenheimer
2010-05-18 19:26                                         ` H. Peter Anvin
2010-05-18 20:29                                           ` Dan Magenheimer
2010-05-18 20:34                                             ` H. Peter Anvin
2010-05-18 21:02                                               ` Dan Magenheimer
2010-05-18 21:13                                               ` Andi Kleen
2010-05-19  6:26                                                 ` Peter Zijlstra
2010-05-17 10:20                   ` Thomas Gleixner
2010-05-16 20:29               ` Arjan van de Ven
2010-05-17 10:26         ` Andi Kleen
2010-06-04 14:24           ` Pavel Machek
2010-05-15 22:45     ` Thomas Gleixner
2010-05-17 10:22     ` Andi Kleen
2010-05-17 15:23       ` Dan Magenheimer
2010-05-17 16:56         ` Andi Kleen
2010-05-17 22:36         ` Thomas Gleixner
2010-05-17 23:33           ` Dan Magenheimer
2010-05-18  0:00             ` Ingo Molnar
2010-05-18  0:02             ` Ingo Molnar
2010-05-15 12:35 ` Jaswinder Singh Rajput
2010-05-15 14:37   ` Venkatesh Pallipadi
  -- strict thread matches above, loose matches on Subject: below --
2010-05-20 19:19 Brian Bloniarz
2010-05-22  2:03 ` john stultz
2010-05-22  3:33   ` H. Peter Anvin
2010-05-24 18:13   ` Dan Magenheimer
2010-05-24 18:19     ` H. Peter Anvin
2010-05-24 18:51     ` john stultz
2010-05-24 20:20       ` H. Peter Anvin
2010-05-24 20:39         ` john stultz
2010-05-24 21:26           ` H. Peter Anvin
2010-05-24 22:04           ` Dan Magenheimer
2010-05-24 22:30             ` H. Peter Anvin
2010-05-24 22:49               ` john stultz
2010-05-24 23:16                 ` Dan Magenheimer
2010-05-24 23:19                   ` H. Peter Anvin
2010-05-24 23:30                   ` john stultz
2010-05-24 23:42                     ` Andi Kleen
2010-05-25  0:01                     ` Dan Magenheimer
2010-05-25  0:07                       ` H. Peter Anvin
2010-05-25  1:33               ` Brian Bloniarz
2010-05-26  0:16                 ` Brian Bloniarz
2010-05-26  0:48                   ` john stultz
2010-05-26  2:50                     ` Brian Bloniarz
2010-05-26 12:35                       ` Thomas Gleixner
2010-05-26 14:26                         ` Dan Magenheimer
2010-05-26 14:41                           ` Thomas Gleixner
2010-05-26 15:04                       ` john stultz
2010-05-26 16:02                         ` Brian Bloniarz
2010-05-26 16:25                           ` john stultz
2010-05-26 18:24                             ` H. Peter Anvin
2010-05-26 18:44                             ` Brian Bloniarz
2010-05-26 18:51                               ` H. Peter Anvin
2010-05-26 20:19                                 ` john stultz
2010-05-26 21:06                                   ` H. Peter Anvin
2010-05-26 19:49                               ` john stultz
2010-05-26 20:22                                 ` Brian Bloniarz
2010-05-26 12:30                   ` Thomas Gleixner

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=20100515224305.17a04022@infradead.org \
    --to=arjan@infradead.org \
    --cc=andi@firstfloor.org \
    --cc=chris.mason@oracle.com \
    --cc=dan.magenheimer@oracle.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tglx@linutronix.de \
    --cc=venki@google.com \
    /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