2013-08-05 19:01:15

by Frederic Weisbecker

[permalink] [raw]
Subject: [GIT PULL] timers/nohz updates for 3.12

Ingo,

Please pull the timers/nohz branch that can be found at:

git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
timers/nohz

It mostly contains fixes and full dynticks off-case optimizations. I believe that
distros want to enable this feature so it seems important to optimize the case
where the "nohz_full=" parameter is empty. ie: I'm trying to remove any performance
regression that comes with NO_HZ_FULL=y when the feature is not used.

This patchset improves the current situation a lot (off-case appears to be around 11% faster
with hackbench, although I guess it may vary depending on the configuration but it should be
significantly faster in any case) now there is still some work to do: I can still observe a
remaining loss of 1.6% throughput seen with hackbench compared to CONFIG_NO_HZ_FULL=n

Thanks,
Frederic
---

Frederic Weisbecker (23):
sched: Consolidate open coded preemptible() checks
context_tracing: Fix guest accounting with native vtime
vtime: Update a few comments
context_tracking: Fix runtime CPU off-case
nohz: Only enable context tracking on full dynticks CPUs
context_tracking: Remove full dynticks' hacky dependency on wide context tracking
context_tracking: Ground setup for static key use
context_tracking: Optimize main APIs off case with static key
context_tracking: Optimize guest APIs off case with static key
context_tracking: Optimize context switch off case with static keys
context_tracking: User/kernel broundary cross trace events
vtime: Remove a few unneeded generic vtime state checks
vtime: Fix racy cputime delta update
context_tracking: Split low level state headers
hardirq: Split preempt count mask definitions
m68k: hardirq_count() only need preempt_mask.h
vtime: Describe overriden functions in dedicated arch headers
vtime: Optimize full dynticks accounting off case with static keys
vtime: Always scale generic vtime accounting results
vtime: Always debug check snapshot source _before_ updating it
nohz: Rename a few state variables
nohz: Optimize full dynticks state checks with static keys
nohz: Optimize full dynticks's sched hooks with static keys


arch/ia64/include/asm/Kbuild | 1 +
arch/m68k/include/asm/irqflags.h | 2 +-
arch/powerpc/include/asm/Kbuild | 1 +
arch/s390/include/asm/cputime.h | 3 -
arch/s390/include/asm/vtime.h | 7 ++
arch/s390/kernel/vtime.c | 1 +
include/linux/context_tracking.h | 120 +++++++++++++++--------------
include/linux/context_tracking_state.h | 39 +++++++++
include/linux/hardirq.h | 117 +----------------------------
include/linux/preempt_mask.h | 122 +++++++++++++++++++++++++++++
include/linux/tick.h | 45 +++++++++--
include/linux/vtime.h | 74 ++++++++++++++++--
include/trace/events/context_tracking.h | 58 ++++++++++++++
init/Kconfig | 28 +++++--
kernel/context_tracking.c | 128 ++++++++++++++++++-------------
kernel/sched/core.c | 4 +-
kernel/sched/cputime.c | 53 ++++---------
kernel/time/Kconfig | 1 -
kernel/time/tick-sched.c | 56 ++++++--------
19 files changed, 534 insertions(+), 326 deletions(-)


2013-08-12 18:44:41

by Ingo Molnar

[permalink] [raw]
Subject: Re: [GIT PULL] timers/nohz updates for 3.12


* Frederic Weisbecker <[email protected]> wrote:

> Ingo,
>
> Please pull the timers/nohz branch that can be found at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
> timers/nohz
>
> It mostly contains fixes and full dynticks off-case optimizations. I believe that
> distros want to enable this feature so it seems important to optimize the case
> where the "nohz_full=" parameter is empty. ie: I'm trying to remove any performance
> regression that comes with NO_HZ_FULL=y when the feature is not used.
>
> This patchset improves the current situation a lot (off-case appears to be around 11% faster
> with hackbench, although I guess it may vary depending on the configuration but it should be
> significantly faster in any case) now there is still some work to do: I can still observe a
> remaining loss of 1.6% throughput seen with hackbench compared to CONFIG_NO_HZ_FULL=n
>
> Thanks,
> Frederic
> ---
>
> Frederic Weisbecker (23):
> sched: Consolidate open coded preemptible() checks
> context_tracing: Fix guest accounting with native vtime
> vtime: Update a few comments
> context_tracking: Fix runtime CPU off-case
> nohz: Only enable context tracking on full dynticks CPUs
> context_tracking: Remove full dynticks' hacky dependency on wide context tracking
> context_tracking: Ground setup for static key use
> context_tracking: Optimize main APIs off case with static key
> context_tracking: Optimize guest APIs off case with static key
> context_tracking: Optimize context switch off case with static keys
> context_tracking: User/kernel broundary cross trace events
> vtime: Remove a few unneeded generic vtime state checks
> vtime: Fix racy cputime delta update
> context_tracking: Split low level state headers
> hardirq: Split preempt count mask definitions
> m68k: hardirq_count() only need preempt_mask.h
> vtime: Describe overriden functions in dedicated arch headers
> vtime: Optimize full dynticks accounting off case with static keys
> vtime: Always scale generic vtime accounting results
> vtime: Always debug check snapshot source _before_ updating it
> nohz: Rename a few state variables
> nohz: Optimize full dynticks state checks with static keys
> nohz: Optimize full dynticks's sched hooks with static keys
>
>
> arch/ia64/include/asm/Kbuild | 1 +
> arch/m68k/include/asm/irqflags.h | 2 +-
> arch/powerpc/include/asm/Kbuild | 1 +
> arch/s390/include/asm/cputime.h | 3 -
> arch/s390/include/asm/vtime.h | 7 ++
> arch/s390/kernel/vtime.c | 1 +
> include/linux/context_tracking.h | 120 +++++++++++++++--------------
> include/linux/context_tracking_state.h | 39 +++++++++
> include/linux/hardirq.h | 117 +----------------------------
> include/linux/preempt_mask.h | 122 +++++++++++++++++++++++++++++
> include/linux/tick.h | 45 +++++++++--
> include/linux/vtime.h | 74 ++++++++++++++++--
> include/trace/events/context_tracking.h | 58 ++++++++++++++
> init/Kconfig | 28 +++++--
> kernel/context_tracking.c | 128 ++++++++++++++++++-------------
> kernel/sched/core.c | 4 +-
> kernel/sched/cputime.c | 53 ++++---------
> kernel/time/Kconfig | 1 -
> kernel/time/tick-sched.c | 56 ++++++--------
> 19 files changed, 534 insertions(+), 326 deletions(-)

When merged to -tip it causes this build error:

kernel/time/tick-sched.c:186:3: error: 'have_nohz_full_mask' undeclared (first use in this function)
kernel/time/tick-sched.c:345:2: error: 'cpu' undeclared (first use in this function)

config attached.

I did what looked like to be an obvious conflict resolution to
tick-sched.c (attached), please double check that too.

While at it, mind rebasing your changes to tip:timers/urgent, which has a
few nohz fixes pending as well?

Thanks,

Ingo


Attachments:
(No filename) (4.07 kB)
config (92.19 kB)
tick-sched.c (29.33 kB)
Download all attachments

2013-08-12 21:28:42

by Frederic Weisbecker

[permalink] [raw]
Subject: Re: [GIT PULL] timers/nohz updates for 3.12

On Mon, Aug 12, 2013 at 08:44:28PM +0200, Ingo Molnar wrote:
>
> * Frederic Weisbecker <[email protected]> wrote:
>
> > Ingo,
> >
> > Please pull the timers/nohz branch that can be found at:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
> > timers/nohz
> >
> > It mostly contains fixes and full dynticks off-case optimizations. I believe that
> > distros want to enable this feature so it seems important to optimize the case
> > where the "nohz_full=" parameter is empty. ie: I'm trying to remove any performance
> > regression that comes with NO_HZ_FULL=y when the feature is not used.
> >
> > This patchset improves the current situation a lot (off-case appears to be around 11% faster
> > with hackbench, although I guess it may vary depending on the configuration but it should be
> > significantly faster in any case) now there is still some work to do: I can still observe a
> > remaining loss of 1.6% throughput seen with hackbench compared to CONFIG_NO_HZ_FULL=n
> >
> > Thanks,
> > Frederic
> > ---
> >
> > Frederic Weisbecker (23):
> > sched: Consolidate open coded preemptible() checks
> > context_tracing: Fix guest accounting with native vtime
> > vtime: Update a few comments
> > context_tracking: Fix runtime CPU off-case
> > nohz: Only enable context tracking on full dynticks CPUs
> > context_tracking: Remove full dynticks' hacky dependency on wide context tracking
> > context_tracking: Ground setup for static key use
> > context_tracking: Optimize main APIs off case with static key
> > context_tracking: Optimize guest APIs off case with static key
> > context_tracking: Optimize context switch off case with static keys
> > context_tracking: User/kernel broundary cross trace events
> > vtime: Remove a few unneeded generic vtime state checks
> > vtime: Fix racy cputime delta update
> > context_tracking: Split low level state headers
> > hardirq: Split preempt count mask definitions
> > m68k: hardirq_count() only need preempt_mask.h
> > vtime: Describe overriden functions in dedicated arch headers
> > vtime: Optimize full dynticks accounting off case with static keys
> > vtime: Always scale generic vtime accounting results
> > vtime: Always debug check snapshot source _before_ updating it
> > nohz: Rename a few state variables
> > nohz: Optimize full dynticks state checks with static keys
> > nohz: Optimize full dynticks's sched hooks with static keys
> >
> >
> > arch/ia64/include/asm/Kbuild | 1 +
> > arch/m68k/include/asm/irqflags.h | 2 +-
> > arch/powerpc/include/asm/Kbuild | 1 +
> > arch/s390/include/asm/cputime.h | 3 -
> > arch/s390/include/asm/vtime.h | 7 ++
> > arch/s390/kernel/vtime.c | 1 +
> > include/linux/context_tracking.h | 120 +++++++++++++++--------------
> > include/linux/context_tracking_state.h | 39 +++++++++
> > include/linux/hardirq.h | 117 +----------------------------
> > include/linux/preempt_mask.h | 122 +++++++++++++++++++++++++++++
> > include/linux/tick.h | 45 +++++++++--
> > include/linux/vtime.h | 74 ++++++++++++++++--
> > include/trace/events/context_tracking.h | 58 ++++++++++++++
> > init/Kconfig | 28 +++++--
> > kernel/context_tracking.c | 128 ++++++++++++++++++-------------
> > kernel/sched/core.c | 4 +-
> > kernel/sched/cputime.c | 53 ++++---------
> > kernel/time/Kconfig | 1 -
> > kernel/time/tick-sched.c | 56 ++++++--------
> > 19 files changed, 534 insertions(+), 326 deletions(-)
>
> When merged to -tip it causes this build error:
>
> kernel/time/tick-sched.c:186:3: error: 'have_nohz_full_mask' undeclared (first use in this function)
> kernel/time/tick-sched.c:345:2: error: 'cpu' undeclared (first use in this function)

Ah I see. This probably happened because of the merge against tip:timers/urgent
The conflict is indeed probably not obvious to solve.

>
> config attached.
>
> I did what looked like to be an obvious conflict resolution to
> tick-sched.c (attached), please double check that too.
>
> While at it, mind rebasing your changes to tip:timers/urgent, which has a
> few nohz fixes pending as well?

Ok, this way I can take care of the conflict.

Thanks!

2013-08-13 00:04:05

by Frederic Weisbecker

[permalink] [raw]
Subject: Re: [GIT PULL] timers/nohz updates for 3.12

On Mon, Aug 12, 2013 at 08:44:28PM +0200, Ingo Molnar wrote:
>
> * Frederic Weisbecker <[email protected]> wrote:
>
> > Ingo,
> >
> > Please pull the timers/nohz branch that can be found at:
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
> > timers/nohz
> >
> > It mostly contains fixes and full dynticks off-case optimizations. I believe that
> > distros want to enable this feature so it seems important to optimize the case
> > where the "nohz_full=" parameter is empty. ie: I'm trying to remove any performance
> > regression that comes with NO_HZ_FULL=y when the feature is not used.
> >
> > This patchset improves the current situation a lot (off-case appears to be around 11% faster
> > with hackbench, although I guess it may vary depending on the configuration but it should be
> > significantly faster in any case) now there is still some work to do: I can still observe a
> > remaining loss of 1.6% throughput seen with hackbench compared to CONFIG_NO_HZ_FULL=n
> >
> > Thanks,
> > Frederic
> > ---
> >
> > Frederic Weisbecker (23):
> > sched: Consolidate open coded preemptible() checks
> > context_tracing: Fix guest accounting with native vtime
> > vtime: Update a few comments
> > context_tracking: Fix runtime CPU off-case
> > nohz: Only enable context tracking on full dynticks CPUs
> > context_tracking: Remove full dynticks' hacky dependency on wide context tracking
> > context_tracking: Ground setup for static key use
> > context_tracking: Optimize main APIs off case with static key
> > context_tracking: Optimize guest APIs off case with static key
> > context_tracking: Optimize context switch off case with static keys
> > context_tracking: User/kernel broundary cross trace events
> > vtime: Remove a few unneeded generic vtime state checks
> > vtime: Fix racy cputime delta update
> > context_tracking: Split low level state headers
> > hardirq: Split preempt count mask definitions
> > m68k: hardirq_count() only need preempt_mask.h
> > vtime: Describe overriden functions in dedicated arch headers
> > vtime: Optimize full dynticks accounting off case with static keys
> > vtime: Always scale generic vtime accounting results
> > vtime: Always debug check snapshot source _before_ updating it
> > nohz: Rename a few state variables
> > nohz: Optimize full dynticks state checks with static keys
> > nohz: Optimize full dynticks's sched hooks with static keys
> >
> >
> > arch/ia64/include/asm/Kbuild | 1 +
> > arch/m68k/include/asm/irqflags.h | 2 +-
> > arch/powerpc/include/asm/Kbuild | 1 +
> > arch/s390/include/asm/cputime.h | 3 -
> > arch/s390/include/asm/vtime.h | 7 ++
> > arch/s390/kernel/vtime.c | 1 +
> > include/linux/context_tracking.h | 120 +++++++++++++++--------------
> > include/linux/context_tracking_state.h | 39 +++++++++
> > include/linux/hardirq.h | 117 +----------------------------
> > include/linux/preempt_mask.h | 122 +++++++++++++++++++++++++++++
> > include/linux/tick.h | 45 +++++++++--
> > include/linux/vtime.h | 74 ++++++++++++++++--
> > include/trace/events/context_tracking.h | 58 ++++++++++++++
> > init/Kconfig | 28 +++++--
> > kernel/context_tracking.c | 128 ++++++++++++++++++-------------
> > kernel/sched/core.c | 4 +-
> > kernel/sched/cputime.c | 53 ++++---------
> > kernel/time/Kconfig | 1 -
> > kernel/time/tick-sched.c | 56 ++++++--------
> > 19 files changed, 534 insertions(+), 326 deletions(-)
>
> When merged to -tip it causes this build error:
>
> kernel/time/tick-sched.c:186:3: error: 'have_nohz_full_mask' undeclared (first use in this function)
> kernel/time/tick-sched.c:345:2: error: 'cpu' undeclared (first use in this function)
>
> config attached.
>
> I did what looked like to be an obvious conflict resolution to
> tick-sched.c (attached), please double check that too.
>
> While at it, mind rebasing your changes to tip:timers/urgent, which has a
> few nohz fixes pending as well?

Ok I did the rebase on top of tip:timers/urgent and handled the conflicts along.
The new branch is "timers/nohz-v2".

Tell me if anything goes wrong with it.

Thanks.

2013-08-13 14:57:38

by Ingo Molnar

[permalink] [raw]
Subject: Re: [GIT PULL] timers/nohz updates for 3.12


* Frederic Weisbecker <[email protected]> wrote:

> > > 19 files changed, 534 insertions(+), 326 deletions(-)
> >
> > When merged to -tip it causes this build error:
> >
> > kernel/time/tick-sched.c:186:3: error: 'have_nohz_full_mask' undeclared (first use in this function)
> > kernel/time/tick-sched.c:345:2: error: 'cpu' undeclared (first use in this function)
> >
> > config attached.
> >
> > I did what looked like to be an obvious conflict resolution to
> > tick-sched.c (attached), please double check that too.
> >
> > While at it, mind rebasing your changes to tip:timers/urgent, which has a
> > few nohz fixes pending as well?
>
> Ok I did the rebase on top of tip:timers/urgent and handled the
> conflicts along. The new branch is "timers/nohz-v2".
>
> Tell me if anything goes wrong with it.

it produces this splat on bootup with the attached config, on a dual-core
Athlon64 box:

calling context_tracking_init+0x0/0x3a @ 1
initcall context_tracking_init+0x0/0x3a returned 0 after 0 usecs
calling dynamic_debug_init+0x0/0x239 @ 1
------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at kernel/sched/cputime.c:639 get_vtime_delta+0x49/0x5f()
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.11.0-rc5-01689-g7830cba-dirty #226899
Hardware name: System manufacturer System Product Name/A8N-E, BIOS ASUS A8N-E ACPI BIOS Revision 1008 08/22/2005
0000000000000009 ffff88003fa03ea8 ffffffff81f83f30 0000000000000b63
0000000000000000 ffff88003fa03ee8 ffffffff810996a4 0000000000000000
ffffffff810bcfb5 ffff88003e33a000 0000000015752a00 0000000000000000
Call Trace:
<IRQ> [<ffffffff81f83f30>] dump_stack+0x46/0x58
[<ffffffff810996a4>] warn_slowpath_common+0x72/0x8c
[<ffffffff810bcfb5>] ? get_vtime_delta+0x49/0x5f
[<ffffffff8109976c>] warn_slowpath_null+0x15/0x19
[<ffffffff810bcfb5>] get_vtime_delta+0x49/0x5f
[<ffffffff810bd213>] __vtime_account_system+0xf/0x37
[<ffffffff810bd426>] vtime_account_system+0x21/0x2e
[<ffffffff810bd5bf>] vtime_common_account_irq_enter+0x41/0x43
[<ffffffff8109ce4a>] irq_enter+0x65/0x7c
[<ffffffff810434e2>] smp_apic_timer_interrupt+0x23/0x40
[<ffffffff81f9435d>] apic_timer_interrupt+0x6d/0x80
<EOI> [<ffffffff810c42d5>] ? arch_local_irq_restore+0x12/0x19
[<ffffffff810c5acb>] vprintk_emit+0x3e2/0x40a
[<ffffffff81099995>] ? cpu_maps_update_begin+0x12/0x14
[<ffffffff832e9244>] ? ddebug_setup_query+0x4d/0x4d
[<ffffffff81f80ddd>] printk+0x5c/0x5e
[<ffffffff8135caff>] __dynamic_pr_debug+0x79/0x7b
[<ffffffff810c764d>] ? timekeeping_get_ns.constprop.10+0x12/0x38
[<ffffffff832db12b>] ? init_hw_breakpoint+0xf7/0xf7
[<ffffffff810c7bbb>] ? ktime_get+0x65/0x74
[<ffffffff832db12b>] ? init_hw_breakpoint+0xf7/0xf7
[<ffffffff832e9244>] ? ddebug_setup_query+0x4d/0x4d
[<ffffffff832c4d9d>] do_one_initcall+0x5b/0x12a
[<ffffffff832d09a5>] ? native_smp_prepare_cpus+0x300/0x341
[<ffffffff832c4ed6>] kernel_init_freeable+0x6a/0x195
[<ffffffff81f7c075>] ? rest_init+0xb9/0xb9
[<ffffffff81f7c07e>] kernel_init+0x9/0xd1
[<ffffffff81f9357c>] ret_from_fork+0x7c/0xb0
[<ffffffff81f7c075>] ? rest_init+0xb9/0xb9
---[ end trace 268f4433da36e82f ]---
initcall dynamic_debug_init+0x0/0x239 returned 0 after 0 usecs

Thanks,

Ingo


Attachments:
(No filename) (3.13 kB)
config (92.76 kB)
Download all attachments

2013-08-14 15:56:53

by Frederic Weisbecker

[permalink] [raw]
Subject: Re: [GIT PULL] timers/nohz updates for 3.12

On Tue, Aug 13, 2013 at 04:57:30PM +0200, Ingo Molnar wrote:
>
> * Frederic Weisbecker <[email protected]> wrote:
>
> > > > 19 files changed, 534 insertions(+), 326 deletions(-)
> > >
> > > When merged to -tip it causes this build error:
> > >
> > > kernel/time/tick-sched.c:186:3: error: 'have_nohz_full_mask' undeclared (first use in this function)
> > > kernel/time/tick-sched.c:345:2: error: 'cpu' undeclared (first use in this function)
> > >
> > > config attached.
> > >
> > > I did what looked like to be an obvious conflict resolution to
> > > tick-sched.c (attached), please double check that too.
> > >
> > > While at it, mind rebasing your changes to tip:timers/urgent, which has a
> > > few nohz fixes pending as well?
> >
> > Ok I did the rebase on top of tip:timers/urgent and handled the
> > conflicts along. The new branch is "timers/nohz-v2".
> >
> > Tell me if anything goes wrong with it.
>
> it produces this splat on bootup with the attached config, on a dual-core
> Athlon64 box:
>
> calling context_tracking_init+0x0/0x3a @ 1
> initcall context_tracking_init+0x0/0x3a returned 0 after 0 usecs
> calling dynamic_debug_init+0x0/0x239 @ 1
> ------------[ cut here ]------------
> WARNING: CPU: 0 PID: 1 at kernel/sched/cputime.c:639 get_vtime_delta+0x49/0x5f()
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.11.0-rc5-01689-g7830cba-dirty #226899
> Hardware name: System manufacturer System Product Name/A8N-E, BIOS ASUS A8N-E ACPI BIOS Revision 1008 08/22/2005
> 0000000000000009 ffff88003fa03ea8 ffffffff81f83f30 0000000000000b63
> 0000000000000000 ffff88003fa03ee8 ffffffff810996a4 0000000000000000
> ffffffff810bcfb5 ffff88003e33a000 0000000015752a00 0000000000000000
> Call Trace:
> <IRQ> [<ffffffff81f83f30>] dump_stack+0x46/0x58
> [<ffffffff810996a4>] warn_slowpath_common+0x72/0x8c
> [<ffffffff810bcfb5>] ? get_vtime_delta+0x49/0x5f
> [<ffffffff8109976c>] warn_slowpath_null+0x15/0x19
> [<ffffffff810bcfb5>] get_vtime_delta+0x49/0x5f
> [<ffffffff810bd213>] __vtime_account_system+0xf/0x37
> [<ffffffff810bd426>] vtime_account_system+0x21/0x2e
> [<ffffffff810bd5bf>] vtime_common_account_irq_enter+0x41/0x43
> [<ffffffff8109ce4a>] irq_enter+0x65/0x7c
> [<ffffffff810434e2>] smp_apic_timer_interrupt+0x23/0x40
> [<ffffffff81f9435d>] apic_timer_interrupt+0x6d/0x80
> <EOI> [<ffffffff810c42d5>] ? arch_local_irq_restore+0x12/0x19
> [<ffffffff810c5acb>] vprintk_emit+0x3e2/0x40a
> [<ffffffff81099995>] ? cpu_maps_update_begin+0x12/0x14
> [<ffffffff832e9244>] ? ddebug_setup_query+0x4d/0x4d
> [<ffffffff81f80ddd>] printk+0x5c/0x5e
> [<ffffffff8135caff>] __dynamic_pr_debug+0x79/0x7b
> [<ffffffff810c764d>] ? timekeeping_get_ns.constprop.10+0x12/0x38
> [<ffffffff832db12b>] ? init_hw_breakpoint+0xf7/0xf7
> [<ffffffff810c7bbb>] ? ktime_get+0x65/0x74
> [<ffffffff832db12b>] ? init_hw_breakpoint+0xf7/0xf7
> [<ffffffff832e9244>] ? ddebug_setup_query+0x4d/0x4d
> [<ffffffff832c4d9d>] do_one_initcall+0x5b/0x12a
> [<ffffffff832d09a5>] ? native_smp_prepare_cpus+0x300/0x341
> [<ffffffff832c4ed6>] kernel_init_freeable+0x6a/0x195
> [<ffffffff81f7c075>] ? rest_init+0xb9/0xb9
> [<ffffffff81f7c07e>] kernel_init+0x9/0xd1
> [<ffffffff81f9357c>] ret_from_fork+0x7c/0xb0
> [<ffffffff81f7c075>] ? rest_init+0xb9/0xb9
> ---[ end trace 268f4433da36e82f ]---
> initcall dynamic_debug_init+0x0/0x239 returned 0 after 0 usecs
>
> Thanks,
>
> Ingo

Sorry about that, I missed it. This is because context tracking initialization
when CONFIG_CONTEXT_TRACKING_FORCE=y is done too late. As a result, the user init
task can run with context tracking disabled when it is scheduled for the first
time and then later run with context tracking enabled due to the late initialization.
And this finally messes up the state of context tracking internal on CPU 0.

Anyway I fixed this by moving the context tracking initialization earlier, before
irqs are enabled and the user init task is created.

Please check out the branch "timers/nohz-v3".

Only commit "context_tracking: Ground setup for static key use"
which is now 65f382fd0c8fa483713c0971de9f1dfb4cf1ad9c has changed to integrate the
fix.

And following is the diff against the previous branch.

Thanks!

diff --git a/include/linux/context_tracking.h b/include/linux/context_tracking.h
index 655356a..1581587 100644
--- a/include/linux/context_tracking.h
+++ b/include/linux/context_tracking.h
@@ -63,6 +63,14 @@ static inline void context_tracking_task_switch(struct task_struct *prev,
struct task_struct *next) { }
#endif /* !CONFIG_CONTEXT_TRACKING */

+
+#ifdef CONFIG_CONTEXT_TRACKING_FORCE
+extern void context_tracking_init(void);
+#else
+static inline void context_tracking_init(void) { }
+#endif /* CONFIG_CONTEXT_TRACKING_FORCE */
+
+
#ifdef CONFIG_VIRT_CPU_ACCOUNTING_GEN
static inline void guest_enter(void)
{
diff --git a/init/main.c b/init/main.c
index d03d2ec..af310af 100644
--- a/init/main.c
+++ b/init/main.c
@@ -75,6 +75,7 @@
#include <linux/blkdev.h>
#include <linux/elevator.h>
#include <linux/sched_clock.h>
+#include <linux/context_tracking.h>

#include <asm/io.h>
#include <asm/bugs.h>
@@ -545,6 +546,7 @@ asmlinkage void __init start_kernel(void)
idr_init_cache();
rcu_init();
tick_nohz_init();
+ context_tracking_init();
radix_tree_init();
/* init some links before init_ISA_irqs() */
early_irq_init();
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c
index 688efe4..247091b 100644
--- a/kernel/context_tracking.c
+++ b/kernel/context_tracking.c
@@ -191,14 +191,11 @@ void __context_tracking_task_switch(struct task_struct *prev,
}

#ifdef CONFIG_CONTEXT_TRACKING_FORCE
-static int __init context_tracking_init(void)
+void __init context_tracking_init(void)
{
int cpu;

for_each_possible_cpu(cpu)
context_tracking_cpu_set(cpu);
-
- return 0;
}
-early_initcall(context_tracking_init);
#endif

2013-08-14 17:31:10

by Ingo Molnar

[permalink] [raw]
Subject: Re: [GIT PULL] timers/nohz updates for 3.12


* Frederic Weisbecker <[email protected]> wrote:

> On Tue, Aug 13, 2013 at 04:57:30PM +0200, Ingo Molnar wrote:
> >
> > * Frederic Weisbecker <[email protected]> wrote:
> >
> > > > > 19 files changed, 534 insertions(+), 326 deletions(-)
> > > >
> > > > When merged to -tip it causes this build error:
> > > >
> > > > kernel/time/tick-sched.c:186:3: error: 'have_nohz_full_mask' undeclared (first use in this function)
> > > > kernel/time/tick-sched.c:345:2: error: 'cpu' undeclared (first use in this function)
> > > >
> > > > config attached.
> > > >
> > > > I did what looked like to be an obvious conflict resolution to
> > > > tick-sched.c (attached), please double check that too.
> > > >
> > > > While at it, mind rebasing your changes to tip:timers/urgent, which has a
> > > > few nohz fixes pending as well?
> > >
> > > Ok I did the rebase on top of tip:timers/urgent and handled the
> > > conflicts along. The new branch is "timers/nohz-v2".
> > >
> > > Tell me if anything goes wrong with it.
> >
> > it produces this splat on bootup with the attached config, on a dual-core
> > Athlon64 box:
> >
> > calling context_tracking_init+0x0/0x3a @ 1
> > initcall context_tracking_init+0x0/0x3a returned 0 after 0 usecs
> > calling dynamic_debug_init+0x0/0x239 @ 1
> > ------------[ cut here ]------------
> > WARNING: CPU: 0 PID: 1 at kernel/sched/cputime.c:639 get_vtime_delta+0x49/0x5f()
> > CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.11.0-rc5-01689-g7830cba-dirty #226899
> > Hardware name: System manufacturer System Product Name/A8N-E, BIOS ASUS A8N-E ACPI BIOS Revision 1008 08/22/2005
> > 0000000000000009 ffff88003fa03ea8 ffffffff81f83f30 0000000000000b63
> > 0000000000000000 ffff88003fa03ee8 ffffffff810996a4 0000000000000000
> > ffffffff810bcfb5 ffff88003e33a000 0000000015752a00 0000000000000000
> > Call Trace:
> > <IRQ> [<ffffffff81f83f30>] dump_stack+0x46/0x58
> > [<ffffffff810996a4>] warn_slowpath_common+0x72/0x8c
> > [<ffffffff810bcfb5>] ? get_vtime_delta+0x49/0x5f
> > [<ffffffff8109976c>] warn_slowpath_null+0x15/0x19
> > [<ffffffff810bcfb5>] get_vtime_delta+0x49/0x5f
> > [<ffffffff810bd213>] __vtime_account_system+0xf/0x37
> > [<ffffffff810bd426>] vtime_account_system+0x21/0x2e
> > [<ffffffff810bd5bf>] vtime_common_account_irq_enter+0x41/0x43
> > [<ffffffff8109ce4a>] irq_enter+0x65/0x7c
> > [<ffffffff810434e2>] smp_apic_timer_interrupt+0x23/0x40
> > [<ffffffff81f9435d>] apic_timer_interrupt+0x6d/0x80
> > <EOI> [<ffffffff810c42d5>] ? arch_local_irq_restore+0x12/0x19
> > [<ffffffff810c5acb>] vprintk_emit+0x3e2/0x40a
> > [<ffffffff81099995>] ? cpu_maps_update_begin+0x12/0x14
> > [<ffffffff832e9244>] ? ddebug_setup_query+0x4d/0x4d
> > [<ffffffff81f80ddd>] printk+0x5c/0x5e
> > [<ffffffff8135caff>] __dynamic_pr_debug+0x79/0x7b
> > [<ffffffff810c764d>] ? timekeeping_get_ns.constprop.10+0x12/0x38
> > [<ffffffff832db12b>] ? init_hw_breakpoint+0xf7/0xf7
> > [<ffffffff810c7bbb>] ? ktime_get+0x65/0x74
> > [<ffffffff832db12b>] ? init_hw_breakpoint+0xf7/0xf7
> > [<ffffffff832e9244>] ? ddebug_setup_query+0x4d/0x4d
> > [<ffffffff832c4d9d>] do_one_initcall+0x5b/0x12a
> > [<ffffffff832d09a5>] ? native_smp_prepare_cpus+0x300/0x341
> > [<ffffffff832c4ed6>] kernel_init_freeable+0x6a/0x195
> > [<ffffffff81f7c075>] ? rest_init+0xb9/0xb9
> > [<ffffffff81f7c07e>] kernel_init+0x9/0xd1
> > [<ffffffff81f9357c>] ret_from_fork+0x7c/0xb0
> > [<ffffffff81f7c075>] ? rest_init+0xb9/0xb9
> > ---[ end trace 268f4433da36e82f ]---
> > initcall dynamic_debug_init+0x0/0x239 returned 0 after 0 usecs
> >
> > Thanks,
> >
> > Ingo
>
> Sorry about that, I missed it. This is because context tracking
> initialization when CONFIG_CONTEXT_TRACKING_FORCE=y is done too late. As
> a result, the user init task can run with context tracking disabled when
> it is scheduled for the first time and then later run with context
> tracking enabled due to the late initialization. And this finally messes
> up the state of context tracking internal on CPU 0.
>
> Anyway I fixed this by moving the context tracking initialization
> earlier, before irqs are enabled and the user init task is created.
>
> Please check out the branch "timers/nohz-v3".
>
> Only commit "context_tracking: Ground setup for static key use" which is
> now 65f382fd0c8fa483713c0971de9f1dfb4cf1ad9c has changed to integrate
> the fix.
>
> And following is the diff against the previous branch.

Pulled, thanks Frederic! Seems to be working better now.

Thanks,

Ingo