public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>, x86-ml <x86@kernel.org>,
	lkml <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH] x86, TSC: Add a software TSC offset
Date: Tue, 22 Jul 2014 00:30:09 +0200	[thread overview]
Message-ID: <20140721223009.GF11555@pd.tnic> (raw)
In-Reply-To: <CALCETrXOpcegDp+eUTWqDkO0jWqgJNYhKJW=HbzvT1ga4Ekxog@mail.gmail.com>

On Mon, Jul 21, 2014 at 03:13:33PM -0700, Andy Lutomirski wrote:
> Ha.  Ha ha.  Muahaha.  Because IIRC this box is synced until the first
> time it suspends.

Sweet, TSCs get fumbled in some S-state or maybe SMI... Who TF knows.

Well, I'm thinking upon resume, we run through smpboot which should do
the tsc sync check again. Will have to test to see.

> > diff --git a/arch/x86/include/asm/tsc.h b/arch/x86/include/asm/tsc.h
> > index 94605c0e9cee..ad7d5e449c0b 100644
> > --- a/arch/x86/include/asm/tsc.h
> > +++ b/arch/x86/include/asm/tsc.h
> > @@ -27,7 +27,9 @@ static inline cycles_t get_cycles(void)
> >         if (!cpu_has_tsc)
> >                 return 0;
> >  #endif
> > +       rdtsc_barrier();
> >         rdtscll(ret);
> > +       rdtsc_barrier();
> >
> 
> Only the first of these is necessary.  There was a long thread on this
> a couple of years ago, and the conclusion was that the code in
> vread_tsc in vclock_gettime.c is correct.

	 * The various CPU manuals are unclear
         * as to whether rdtsc can be reordered with later loads,
         * but no one has ever seen it happen.

until some future uarch proves you wrong. :-)

I guess we can try with one pre-fence only first although if we're doing
one already, I can't imagine the post-one to be all that expensive since
we've retired the whole inflight crap already anyway.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

  reply	other threads:[~2014-07-21 22:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-19 13:06 [PATCH] x86, TSC: Add a software TSC offset Borislav Petkov
2014-07-19 13:28 ` Borislav Petkov
2014-07-21 19:34 ` Andy Lutomirski
2014-07-21 21:35   ` Borislav Petkov
2014-07-21 21:41     ` Andy Lutomirski
2014-07-21 21:52       ` Borislav Petkov
2014-07-21 21:56         ` Andy Lutomirski
2014-07-21 22:06           ` Thomas Gleixner
2014-07-21 22:11             ` Thomas Gleixner
2014-07-21 22:14               ` Andy Lutomirski
2014-07-21 22:08           ` Borislav Petkov
2014-07-21 22:13             ` Andy Lutomirski
2014-07-21 22:30               ` Borislav Petkov [this message]
2014-07-21 22:43                 ` Andy Lutomirski
2014-07-21 23:01                   ` Borislav Petkov
2014-07-22  8:00               ` Peter Zijlstra
2014-07-22  7:57           ` Peter Zijlstra
2014-07-22  2:40 ` Steven Rostedt
2014-07-22  8:59   ` Borislav Petkov
2014-07-22 12:05 ` Borislav Petkov

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=20140721223009.GF11555@pd.tnic \
    --to=bp@alien8.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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