Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Pavel Tatashin
Hi Peter, > That said; flipping static keys early isn't hard. We should call > jump_label_init() early, because we want the entries sorted and the > key->entries link set. It will also replace the GENERIC_NOP5_ATOMIC > thing, which means we need to also do arch_init_ideal_nop() early, but > since

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Pavel Tatashin
Hi Peter, > That said; flipping static keys early isn't hard. We should call > jump_label_init() early, because we want the entries sorted and the > key->entries link set. It will also replace the GENERIC_NOP5_ATOMIC > thing, which means we need to also do arch_init_ideal_nop() early, but > since

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Thomas Gleixner
On Wed, 20 Jun 2018, Peter Zijlstra wrote: > On Wed, Jun 20, 2018 at 12:42:40PM +0200, Thomas Gleixner wrote: > > On Wed, 20 Jun 2018, Peter Zijlstra wrote: > > > > I'm still puzzled by the entire need for tsc_early_enabled and all that. > > > Esp. since both branches do the exact same thing: > >

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Thomas Gleixner
On Wed, 20 Jun 2018, Peter Zijlstra wrote: > On Wed, Jun 20, 2018 at 12:42:40PM +0200, Thomas Gleixner wrote: > > On Wed, 20 Jun 2018, Peter Zijlstra wrote: > > > > I'm still puzzled by the entire need for tsc_early_enabled and all that. > > > Esp. since both branches do the exact same thing: > >

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Peter Zijlstra
On Wed, Jun 20, 2018 at 12:42:40PM +0200, Thomas Gleixner wrote: > On Wed, 20 Jun 2018, Peter Zijlstra wrote: > > I'm still puzzled by the entire need for tsc_early_enabled and all that. > > Esp. since both branches do the exact same thing: > > > > return cycles_2_ns(rdtsc()); > > Right.

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Peter Zijlstra
On Wed, Jun 20, 2018 at 12:42:40PM +0200, Thomas Gleixner wrote: > On Wed, 20 Jun 2018, Peter Zijlstra wrote: > > I'm still puzzled by the entire need for tsc_early_enabled and all that. > > Esp. since both branches do the exact same thing: > > > > return cycles_2_ns(rdtsc()); > > Right.

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Thomas Gleixner
On Wed, 20 Jun 2018, Peter Zijlstra wrote: > On Wed, Jun 20, 2018 at 01:52:10AM +0200, Thomas Gleixner wrote: > > u64 native_sched_clock(void) > > { > > + if (static_branch_likely(&__use_tsc)) > > + return cycles_2_ns(rdtsc()); > > > > + if

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Thomas Gleixner
On Wed, 20 Jun 2018, Peter Zijlstra wrote: > On Wed, Jun 20, 2018 at 01:52:10AM +0200, Thomas Gleixner wrote: > > u64 native_sched_clock(void) > > { > > + if (static_branch_likely(&__use_tsc)) > > + return cycles_2_ns(rdtsc()); > > > > + if

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Feng Tang
On Wed, Jun 20, 2018 at 12:30:58PM +0200, Thomas Gleixner wrote: > On Wed, 20 Jun 2018, Feng Tang wrote: > > > On Wed, Jun 20, 2018 at 12:16:36PM +0200, Thomas Gleixner wrote: > > > On Wed, 20 Jun 2018, Feng Tang wrote: > > > > On Wed, Jun 20, 2018 at 01:52:10AM +0200, Thomas Gleixner wrote: > >

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Feng Tang
On Wed, Jun 20, 2018 at 12:30:58PM +0200, Thomas Gleixner wrote: > On Wed, 20 Jun 2018, Feng Tang wrote: > > > On Wed, Jun 20, 2018 at 12:16:36PM +0200, Thomas Gleixner wrote: > > > On Wed, 20 Jun 2018, Feng Tang wrote: > > > > On Wed, Jun 20, 2018 at 01:52:10AM +0200, Thomas Gleixner wrote: > >

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Thomas Gleixner
On Wed, 20 Jun 2018, Feng Tang wrote: > On Wed, Jun 20, 2018 at 12:16:36PM +0200, Thomas Gleixner wrote: > > 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

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Thomas Gleixner
On Wed, 20 Jun 2018, Feng Tang wrote: > On Wed, Jun 20, 2018 at 12:16:36PM +0200, Thomas Gleixner wrote: > > 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

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Feng Tang
On Wed, Jun 20, 2018 at 12:16:36PM +0200, Thomas Gleixner wrote: > 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); > > > >

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Feng Tang
On Wed, Jun 20, 2018 at 12:16:36PM +0200, Thomas Gleixner wrote: > 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); > > > >

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Thomas Gleixner
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

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Thomas Gleixner
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

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Feng Tang
Hi Thomas, On Wed, Jun 20, 2018 at 01:52:10AM +0200, Thomas Gleixner wrote: > On Fri, 15 Jun 2018, Pavel Tatashin wrote: > > > tsc_early_init(): > > Determines offset, shift and multiplier for the early clock based on the > > TSC frequency. > > > > tsc_early_fini() > > Implement the finish part

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Feng Tang
Hi Thomas, On Wed, Jun 20, 2018 at 01:52:10AM +0200, Thomas Gleixner wrote: > On Fri, 15 Jun 2018, Pavel Tatashin wrote: > > > tsc_early_init(): > > Determines offset, shift and multiplier for the early clock based on the > > TSC frequency. > > > > tsc_early_fini() > > Implement the finish part

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Peter Zijlstra
On Wed, Jun 20, 2018 at 01:52:10AM +0200, Thomas Gleixner wrote: > u64 native_sched_clock(void) > { > + if (static_branch_likely(&__use_tsc)) > + return cycles_2_ns(rdtsc()); > > + if (static_branch_unlikely(_early_enabled)) { > + if (tsc_early_sched_clock) > +

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-20 Thread Peter Zijlstra
On Wed, Jun 20, 2018 at 01:52:10AM +0200, Thomas Gleixner wrote: > u64 native_sched_clock(void) > { > + if (static_branch_likely(&__use_tsc)) > + return cycles_2_ns(rdtsc()); > > + if (static_branch_unlikely(_early_enabled)) { > + if (tsc_early_sched_clock) > +

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-19 Thread Pavel Tatashin
On 06/19/2018 07:52 PM, Thomas Gleixner wrote: > On Fri, 15 Jun 2018, Pavel Tatashin wrote: > >> tsc_early_init(): >> Determines offset, shift and multiplier for the early clock based on the >> TSC frequency. >> >> tsc_early_fini() >> Implement the finish part of early tsc feature, prints

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-19 Thread Pavel Tatashin
On 06/19/2018 07:52 PM, Thomas Gleixner wrote: > On Fri, 15 Jun 2018, Pavel Tatashin wrote: > >> tsc_early_init(): >> Determines offset, shift and multiplier for the early clock based on the >> TSC frequency. >> >> tsc_early_fini() >> Implement the finish part of early tsc feature, prints

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-19 Thread Thomas Gleixner
On Fri, 15 Jun 2018, Pavel Tatashin wrote: > tsc_early_init(): > Determines offset, shift and multiplier for the early clock based on the > TSC frequency. > > tsc_early_fini() > Implement the finish part of early tsc feature, prints message about the > offset, which can be useful to find out how

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-19 Thread Thomas Gleixner
On Fri, 15 Jun 2018, Pavel Tatashin wrote: > tsc_early_init(): > Determines offset, shift and multiplier for the early clock based on the > TSC frequency. > > tsc_early_fini() > Implement the finish part of early tsc feature, prints message about the > offset, which can be useful to find out how

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-19 Thread Thomas Gleixner
On Fri, 15 Jun 2018, Pavel Tatashin wrote: > cpu_khz = x86_platform.calibrate_cpu(); > @@ -1380,7 +1466,7 @@ void __init tsc_init(void) > if (!tsc_khz) { > mark_tsc_unstable("could not calculate TSC khz"); >

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-19 Thread Thomas Gleixner
On Fri, 15 Jun 2018, Pavel Tatashin wrote: > cpu_khz = x86_platform.calibrate_cpu(); > @@ -1380,7 +1466,7 @@ void __init tsc_init(void) > if (!tsc_khz) { > mark_tsc_unstable("could not calculate TSC khz"); >

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-19 Thread Thomas Gleixner
On Fri, 15 Jun 2018, Pavel Tatashin wrote: > This patch adds early clock feature to x86 platforms. See Documentation about 'This patch' We already know that this is a patch otherwise it would not be marked as such ... > +/* > + * Finish clock for early time stamps, and hand over to

Re: [PATCH v10 7/7] x86/tsc: use tsc early

2018-06-19 Thread Thomas Gleixner
On Fri, 15 Jun 2018, Pavel Tatashin wrote: > This patch adds early clock feature to x86 platforms. See Documentation about 'This patch' We already know that this is a patch otherwise it would not be marked as such ... > +/* > + * Finish clock for early time stamps, and hand over to

[PATCH v10 7/7] x86/tsc: use tsc early

2018-06-15 Thread Pavel Tatashin
This patch adds early clock feature to x86 platforms. tsc_early_init(): Determines offset, shift and multiplier for the early clock based on the TSC frequency. tsc_early_fini() Implement the finish part of early tsc feature, prints message about the offset, which can be useful to find out how

[PATCH v10 7/7] x86/tsc: use tsc early

2018-06-15 Thread Pavel Tatashin
This patch adds early clock feature to x86 platforms. tsc_early_init(): Determines offset, shift and multiplier for the early clock based on the TSC frequency. tsc_early_fini() Implement the finish part of early tsc feature, prints message about the offset, which can be useful to find out how