mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Feng Tang <feng.tang@intel.com>
Cc: Pavel Tatashin <pasha.tatashin@oracle.com>,
	steven.sistare@oracle.com, daniel.m.jordan@oracle.com,
	linux@armlinux.org.uk, schwidefsky@de.ibm.com,
	heiko.carstens@de.ibm.com, john.stultz@linaro.org,
	sboyd@codeaurora.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, mingo@redhat.com, hpa@zytor.com,
	douly.fnst@cn.fujitsu.com, peterz@infradead.org,
	prarit@redhat.com, pmladek@suse.com, gnomes@lxorguk.ukuu.org.uk
Subject: Re: [PATCH v10 7/7] x86/tsc: use tsc early
Date: Wed, 20 Jun 2018 12:16:36 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1806201214310.10546@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20180620101241.5vhmyvdjbenldp4r@shbuild888>

On Wed, 20 Jun 2018, Feng Tang wrote:
> On Wed, Jun 20, 2018 at 01:52:10AM +0200, Thomas Gleixner wrote:
> >  
> >  static DEFINE_STATIC_KEY_FALSE(__use_tsc);
> > +static DEFINE_STATIC_KEY_TRUE(tsc_early_enabled);
> 
> One potential problem may be the several static_keys used here,
> the "__use_tsc", the "__sched_clock_stable", it may not be used
> very early in boot phase. As the the static_branch_enable() will
> use pageing related code while the paging is not setup ready yet.

I know how static keys work and thats the reason for having the extra
conditional. The key is disabled at a point where paging is available.

> >  /*
> >   * Scheduler clock - returns current time in nanosec units.
> >   */
> >  u64 native_sched_clock(void)
> >  {
> > -	if (static_branch_likely(&__use_tsc)) {
> > -		u64 tsc_now = rdtsc();
> > +	if (static_branch_likely(&__use_tsc))
> > +		return cycles_2_ns(rdtsc());
> >  
> > -		/* return the value in ns */
> > -		return cycles_2_ns(tsc_now);
> > +	if (static_branch_unlikely(&tsc_early_enabled)) {
> > +		if (tsc_early_sched_clock)
> > +			return cycles_2_ns(rdtsc());
> >  	}

Thanks,

	tglx

  reply	other threads:[~2018-06-20 10:16 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-15 17:41 [PATCH v10 0/7] Early boot time stamps for x86 Pavel Tatashin
2018-06-15 17:41 ` [PATCH v10 1/7] x86/tsc: remove tsc_disabled flag Pavel Tatashin
2018-06-19 17:32   ` Thomas Gleixner
2018-06-19 17:50     ` Pavel Tatashin
2018-06-19 18:46     ` Peter Zijlstra
2018-06-19 19:12       ` Thomas Gleixner
2018-06-19 20:01         ` Peter Zijlstra
2018-06-19 20:57           ` Thomas Gleixner
2018-06-19 21:00             ` Peter Zijlstra
2018-06-15 17:41 ` [PATCH v10 2/7] time: sync read_boot_clock64() with persistent clock Pavel Tatashin
2018-06-19 21:14   ` Thomas Gleixner
2018-06-19 21:25     ` Pavel Tatashin
2018-06-15 17:42 ` [PATCH v10 3/7] x86/time: read_boot_clock64() implementation Pavel Tatashin
2018-06-18  8:42   ` Andy Shevchenko
2018-06-18  8:44     ` Andy Shevchenko
2018-06-19 14:23       ` Pavel Tatashin
2018-06-19 20:39         ` Andy Shevchenko
2018-06-15 17:42 ` [PATCH v10 4/7] sched: early boot clock Pavel Tatashin
2018-06-15 17:42 ` [PATCH v10 5/7] kvm/x86: remove kvm memblock dependency Pavel Tatashin
2018-06-15 17:42 ` [PATCH v10 6/7] x86/paravirt: add active_sched_clock to pv_time_ops Pavel Tatashin
2018-06-19 23:13   ` Thomas Gleixner
2018-06-15 17:42 ` [PATCH v10 7/7] x86/tsc: use tsc early Pavel Tatashin
2018-06-19 22:51   ` Thomas Gleixner
2018-06-19 23:20   ` Thomas Gleixner
2018-06-19 23:52   ` Thomas Gleixner
2018-06-20  0:00     ` Pavel Tatashin
2018-06-20  9:15     ` Peter Zijlstra
2018-06-20 10:42       ` Thomas Gleixner
2018-06-20 12:32         ` Peter Zijlstra
2018-06-20 13:29           ` Thomas Gleixner
2018-06-20 21:30           ` Pavel Tatashin
2018-06-20 10:12     ` Feng Tang
2018-06-20 10:16       ` Thomas Gleixner [this message]
2018-06-20 10:29         ` Feng Tang
2018-06-20 10:30           ` Thomas Gleixner
2018-06-20 10:39             ` Feng Tang

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=alpine.DEB.2.21.1806201214310.10546@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=daniel.m.jordan@oracle.com \
    --cc=douly.fnst@cn.fujitsu.com \
    --cc=feng.tang@intel.com \
    --cc=gnomes@lxorguk.ukuu.org.uk \
    --cc=heiko.carstens@de.ibm.com \
    --cc=hpa@zytor.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mingo@redhat.com \
    --cc=pasha.tatashin@oracle.com \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=prarit@redhat.com \
    --cc=sboyd@codeaurora.org \
    --cc=schwidefsky@de.ibm.com \
    --cc=steven.sistare@oracle.com \
    --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

all inboxes | Powered by JetHome®