Re: [patch] timer: Fix timers_update_migration(), and call it in tmigr_init()

From: Paul E. McKenney
Date: Sat Apr 29 2017 - 14:12:21 EST


On Sat, Apr 29, 2017 at 06:06:40PM +0200, Mike Galbraith wrote:
> Note: there is more. With this applied, my desktop box will no longer
> reproduce when booted to init 3 with nowatchdog on the command line.
> My 8 socket DL980 OTOH still will, though it takes longer, and is
> seemingly no longer interested in following up with a permanent RCU
> stall after the tsc clocksource is killed, as it does in virgin source.
>
> ---
>
> timers_update_migration() is called by tick_nohz_activate() before
> the late initcall tmigr_init() sets tmigr_enabled to true, resulting
> in it updating neither timer_base.nohz_active nor .migration_enabled,
> meaning we'll not kick an idling cpu in add_timer_on().
>
> Remove redundant loop avoidance such that tick_nohz_activate() updates
> timer_bases[].nohz_active as intended, and call it in tmigr_init() to
> update timer_bases[].migration_enabled.
>
> Signed-off-by: Mike Galbraith <efault@xxxxxx>
> Fixes: ec2206b91d43 timer: Implement the hierarchical pull model

If someone will either repost a fresh series or point me at exactly
the set of patches to use, I will run it through rcutorture again.

Thanx, Paul

> ---
> kernel/time/timer.c | 4 ----
> kernel/time/timer_migration.c | 1 +
> 2 files changed, 1 insertion(+), 4 deletions(-)
>
> --- a/kernel/time/timer.c
> +++ b/kernel/time/timer.c
> @@ -224,10 +224,6 @@ void timers_update_migration(bool update
> bool on = sysctl_timer_migration && tick_nohz_active && tmigr_enabled;
> unsigned int cpu;
>
> - /* Avoid the loop, if nothing to update */
> - if (this_cpu_read(timer_bases[BASE_GLOBAL].migration_enabled) == on)
> - return;
> -
> for_each_possible_cpu(cpu) {
> per_cpu(timer_bases[BASE_LOCAL].migration_enabled, cpu) = on;
> per_cpu(timer_bases[BASE_GLOBAL].migration_enabled, cpu) = on;
> --- a/kernel/time/timer_migration.c
> +++ b/kernel/time/timer_migration.c
> @@ -649,6 +649,7 @@ static int __init tmigr_init(void)
> goto hp_err;
>
> tmigr_enabled = true;
> + timers_update_migration(false);
> pr_info("Timer migration: %d hierarchy levels\n", tmigr_hierarchy_levels);
> return 0;
>
>