mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: "Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Ming Lei <tom.leiming@gmail.com>,
	Djalal Harouni <tixxdz@opendz.org>,
	Borislav Petkov <borislav.petkov@amd.com>,
	Tony Luck <tony.luck@intel.com>,
	Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
	Ingo Molnar <mingo@elte.hu>, Andi Kleen <ak@linux.intel.com>,
	linux-kernel@vger.kernel.org, Greg Kroah-Hartman <gregkh@suse.de>,
	Kay Sievers <kay.sievers@vrfy.org>,
	gouders@et.bocholt.fh-gelsenkirchen.de,
	Marcos Souza <marcos.mage@gmail.com>,
	Linux PM mailing list <linux-pm@vger.kernel.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	prasad@linux.vnet.ibm.com, justinmattock@gmail.com,
	Jeff Chua <jeff.chua.linux@gmail.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Mel Gorman <mgorman@suse.de>,
	Gilad Ben-Yossef <gilad@benyossef.com>
Subject: Re: x86/mce: machine check warning during poweroff
Date: Thu, 19 Jan 2012 10:50:40 +0300	[thread overview]
Message-ID: <20120119075039.GA3517@swordfish.minsk.epam.com> (raw)
In-Reply-To: <1326924509.13915.29.camel@sbsiddha-mobl2>

On (01/18/12 14:08), Suresh Siddha wrote:
> On Wed, 2012-01-18 at 16:32 +0300, Sergey Senozhatsky wrote:
> > Just a small note, since you're talking about removing CPU from nohz.idle_cpus_mask, 
> > that I'm able to reproduce this problem not only when offlining CPU, but during
> > onlininig as well (kernel 3.3):
> 
> yes, if the nohz state is not cleared properly during offline, then the
> issue can happen any time including cpu online etc.
>

Oh, sure. Good point.

Works for me, here is my:

Tested-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com> 

	Sergey

> Srivatsa, I thought CPU_PRI_SCHED_INACTIVE as INT_MAX for some reason
> and was expecting sched_ilb_notifier() will be called after setting that
> cpu as inactive. I am now using CPU_DYING which will be called from the
> cpu going down.
> 
> Here is the v2 version of the fix. Can you folks please give it another
> try?
> 
> Thanks.
> ---
> 
> From: Suresh Siddha <suresh.b.siddha@intel.com>
> Subject: sched, nohz: fix nohz cpu idle load balancing state with cpu hotplug
> 
> With the recent nohz scheduler changes, rq's nohz flag 'NOHZ_TICK_STOPPED'
> and its associated state doesn't get cleared immediately after the
> cpu exits idle. This gets cleared as part of the next tick seen on that cpu.
> 
> With the cpu offline, we need to clear this state manually. Fix it by
> registering a cpu notifier which clears the nohz idle load balance
> state for this rq explicitly.
> 
> Reported-by: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
> Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
> ---
>  kernel/sched/fair.c |   34 +++++++++++++++++++++++++++++-----
>  1 files changed, 29 insertions(+), 5 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 2237ffe..f605e1d 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -4843,6 +4843,15 @@ static void nohz_balancer_kick(int cpu)
>  	return;
>  }
>  
> +static inline void clear_nohz_tick_stopped(int cpu)
> +{
> +	if (unlikely(test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))) {
> +		cpumask_clear_cpu(cpu, nohz.idle_cpus_mask);
> +		atomic_dec(&nohz.nr_cpus);
> +		clear_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu));
> +	}
> +}
> +
>  static inline void set_cpu_sd_state_busy(void)
>  {
>  	struct sched_domain *sd;
> @@ -4881,6 +4890,12 @@ void select_nohz_load_balancer(int stop_tick)
>  {
>  	int cpu = smp_processor_id();
>  
> +	/*
> +	 * If this cpu is going down, then nothing needs to be done.
> +	 */
> +	if (!cpu_active(cpu))
> +		return;
> +
>  	if (stop_tick) {
>  		if (test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))
>  			return;
> @@ -4891,6 +4906,18 @@ void select_nohz_load_balancer(int stop_tick)
>  	}
>  	return;
>  }
> +
> +static int __cpuinit sched_ilb_notifier(struct notifier_block *nfb,
> +					unsigned long action, void *hcpu)
> +{
> +	switch (action & ~CPU_TASKS_FROZEN) {
> +	case CPU_DYING:
> +		clear_nohz_tick_stopped(smp_processor_id());
> +		return NOTIFY_OK;
> +	default:
> +		return NOTIFY_DONE;
> +	}
> +}
>  #endif
>  
>  static DEFINE_SPINLOCK(balancing);
> @@ -5047,11 +5074,7 @@ static inline int nohz_kick_needed(struct rq *rq, int cpu)
>  	* busy tick after returning from idle, we will update the busy stats.
>  	*/
>  	set_cpu_sd_state_busy();
> -	if (unlikely(test_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu)))) {
> -		clear_bit(NOHZ_TICK_STOPPED, nohz_flags(cpu));
> -		cpumask_clear_cpu(cpu, nohz.idle_cpus_mask);
> -		atomic_dec(&nohz.nr_cpus);
> -	}
> +	clear_nohz_tick_stopped(cpu);
>  
>  	/*
>  	 * None are in tickless mode and hence no need for NOHZ idle load
> @@ -5549,6 +5572,7 @@ __init void init_sched_fair_class(void)
>  
>  #ifdef CONFIG_NO_HZ
>  	zalloc_cpumask_var(&nohz.idle_cpus_mask, GFP_NOWAIT);
> +	cpu_notifier(sched_ilb_notifier, 0);
>  #endif
>  #endif /* SMP */
>  
> 
> 

  reply	other threads:[~2012-01-19  7:54 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11  0:00 Djalal Harouni
2012-01-12 14:22 ` Ming Lei
2012-01-13 20:22   ` Srivatsa S. Bhat
2012-01-13 20:34     ` Justin P. Mattock
2012-01-13 20:37     ` Linus Torvalds
2012-01-13 20:53       ` Srivatsa S. Bhat
2012-01-13 21:08         ` Linus Torvalds
2012-01-13 21:24           ` Andi Kleen
2012-01-13 21:38             ` Justin P. Mattock
2012-01-13 22:06               ` Srivatsa S. Bhat
2012-01-13 22:17                 ` Alan Stern
2012-01-13 22:18                 ` Srivatsa S. Bhat
2012-01-13 23:13             ` Andi Kleen
2012-01-14  0:44       ` Dirk Gouders
2012-01-13 23:02     ` Linus Torvalds
2012-01-13 23:27       ` Srivatsa S. Bhat
2012-01-14  0:05         ` Linus Torvalds
2012-01-14  2:41           ` Srivatsa S. Bhat
2012-01-14  2:53             ` Linus Torvalds
2012-01-14  3:05               ` Srivatsa S. Bhat
2012-01-14  3:10                 ` Linus Torvalds
2012-01-14  3:18                   ` Srivatsa S. Bhat
2012-01-14  3:41                     ` Linus Torvalds
2012-01-14  5:15                   ` Tony Luck
2012-01-14 14:49               ` Greg KH
2012-01-14 16:30                 ` Alan Stern
2012-01-14 20:45                   ` Jeff Chua
2012-01-15  2:05                   ` Tony Luck
2012-01-15  2:34                     ` Greg KH
2012-01-15  3:36                       ` Alan Stern
2012-01-16 18:15                         ` Greg KH
2012-01-16 18:11                 ` Greg KH
2012-01-16 18:27                   ` Luck, Tony
2012-01-16 18:34                     ` Greg KH
2012-01-16 18:42                   ` Kay Sievers
2012-01-17  2:21             ` Suresh Siddha
2012-01-17  9:52               ` Srivatsa S. Bhat
2012-01-17 16:15                 ` Jeff Chua
2012-01-17 16:36                   ` Srivatsa S. Bhat
2012-01-18  3:17                 ` Suresh Siddha
2012-01-18 10:19                   ` Srivatsa S. Bhat
2012-01-18 13:15                   ` Srivatsa S. Bhat
2012-01-18 13:32                     ` Sergey Senozhatsky
2012-01-18 22:08                       ` Suresh Siddha
2012-01-19  7:50                         ` Sergey Senozhatsky [this message]
2012-01-19 12:02                         ` Srivatsa S. Bhat
2012-01-20  2:28                           ` Suresh Siddha
2012-01-23  8:43                             ` Peter Zijlstra
2012-01-26 20:27                             ` [tip:sched/urgent] sched/nohz: Fix nohz cpu idle load balancing state with cpu hotplug tip-bot for Suresh Siddha

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=20120119075039.GA3517@swordfish.minsk.epam.com \
    --to=sergey.senozhatsky@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=ak@linux.intel.com \
    --cc=borislav.petkov@amd.com \
    --cc=gilad@benyossef.com \
    --cc=gouders@et.bocholt.fh-gelsenkirchen.de \
    --cc=gregkh@suse.de \
    --cc=jeff.chua.linux@gmail.com \
    --cc=justinmattock@gmail.com \
    --cc=kay.sievers@vrfy.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=marcos.mage@gmail.com \
    --cc=mgorman@suse.de \
    --cc=mingo@elte.hu \
    --cc=prasad@linux.vnet.ibm.com \
    --cc=rjw@sisk.pl \
    --cc=seto.hidetoshi@jp.fujitsu.com \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tixxdz@opendz.org \
    --cc=tom.leiming@gmail.com \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.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®