public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Shaohua Li <shaohua.li@intel.com>
To: vatsa@in.ibm.com
Cc: Nigel Cunningham <ncunningham@cyclades.com>,
	Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>,
	Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Ingo Molnar <mingo@elte.hu>
Subject: Re: PATCH: Fix race in cpu_down (hotplug cpu)
Date: Mon, 19 Sep 2005 14:37:09 +0800	[thread overview]
Message-ID: <1127111830.4087.3.camel@linux-hp.sh.intel.com> (raw)
In-Reply-To: <20050919062336.GA9466@in.ibm.com>

On Mon, 2005-09-19 at 11:53 +0530, Srivatsa Vaddagiri wrote:
> On Mon, Sep 19, 2005 at 04:11:11PM +1000, Nigel Cunningham wrote:
> > > Ok, that makes sense. Nigel, could you confirm which idle routine you are 
> > > using?
> > 
> > >From dmesg:
> > 
> > monitor/mwait feature present.
> > using mwait in idle threads.
> 
> Ok, that may explain why __cpu_die is timing out for you! Can you try a 
> (untested, I am afraid) patch on these lines: 
> 
> --- process.c.org	2005-09-19 11:44:57.000000000 +0530
> +++ process.c	2005-09-19 11:48:28.000000000 +0530
> @@ -245,16 +245,18 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);
>   */
>  static void mwait_idle(void)
>  {
> +	int cpu = raw_smp_processor_id();
> +
>  	local_irq_enable();
>  
>  	if (!need_resched()) {
>  		set_thread_flag(TIF_POLLING_NRFLAG);
>  		do {
>  			__monitor((void *)&current_thread_info()->flags, 0, 0);
> -			if (need_resched())
> +			if (need_resched() || cpu_is_offline(cpu))
>  				break;
if the breakpoint is here, you will still have trouble.

>  			__mwait(0, 0);
> -		} while (!need_resched());
> +		} while (!need_resched() || !cpu_is_offline(cpu));
>  		clear_thread_flag(TIF_POLLING_NRFLAG);
>  	}
>  }
> 
> 
> Other idle routines will need similar fix.
> 
> > Ok, but what about default_idle?
> 
> default_idle should be fine as it is. IOW it should not cause __cpu_die to 
> timeout.
Why default_idle should be fine? it can be preempted before the
'local_irq_disable' check. Even with Nigel's patch, there is a very
small window at safe_halt (after 'sti' but before 'hlt').

Thanks,
Shaohua


  parent reply	other threads:[~2005-09-19  6:31 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-19  4:48 PATCH: Fix race in cpu_down (hotplug cpu) Li, Shaohua
2005-09-19  5:10 ` Srivatsa Vaddagiri
2005-09-19  5:31   ` Shaohua Li
2005-09-19  5:57     ` Srivatsa Vaddagiri
2005-09-19  6:11       ` Nigel Cunningham
2005-09-19  6:23         ` Srivatsa Vaddagiri
2005-09-19  6:29           ` Nick Piggin
2005-09-19  7:00             ` Srivatsa Vaddagiri
2005-09-19  6:31           ` Nigel Cunningham
2005-09-19  7:09             ` Srivatsa Vaddagiri
2005-09-19  6:37           ` Shaohua Li [this message]
2005-09-19  6:36             ` Nick Piggin
2005-09-19  6:54               ` Nigel Cunningham
2005-09-19  7:12               ` Shaohua Li
2005-09-19  7:22                 ` Nick Piggin
2005-09-19  7:28                   ` Ingo Molnar
2005-09-19  7:37                     ` Nick Piggin
2005-09-19 22:55                       ` Nigel Cunningham
2005-09-20  4:41                         ` Srivatsa Vaddagiri
2005-09-19  7:07             ` Srivatsa Vaddagiri
2005-09-19  5:23 ` Nigel Cunningham
2005-09-19  5:28   ` Srivatsa Vaddagiri
2005-09-19  5:35     ` Nigel Cunningham
2005-09-19  7:43       ` Where do packets sent to 255.255.255.255 go? Wei-Che, Hsu
  -- strict thread matches above, loose matches on Subject: below --
2005-09-19  3:28 PATCH: Fix race in cpu_down (hotplug cpu) Nigel Cunningham
2005-09-19  4:22 ` Srivatsa Vaddagiri
2005-09-19  3:15 Nigel Cunningham

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=1127111830.4087.3.camel@linux-hp.sh.intel.com \
    --to=shaohua.li@intel.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=ncunningham@cyclades.com \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@osdl.org \
    --cc=vatsa@in.ibm.com \
    --cc=zwane@arm.linux.org.uk \
    /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