All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@suse.cz>
To: Ivan Vecera <ivecera@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	linux-kernel@vger.kernel.org, tglx@linutronix.de,
	mingo@redhat.com, hpa@zytor.com, nhorman@redhat.com,
	jmarchan@redhat.com
Subject: Re: [PATCH] x86: call machine_shutdown and stop all CPUs in native_machine_halt
Date: Mon, 10 Nov 2008 23:49:34 +0100	[thread overview]
Message-ID: <20081110224934.GA2069@ucw.cz> (raw)
In-Reply-To: <491316D9.20206@redhat.com>

On Thu 2008-11-06 17:10:01, Ivan Vecera wrote:
> Any comments?
> 
> Ivan
> 
> ---
> Ivan Vecera wrote:
> > Ingo Molnar wrote:
> >> the code in arch/x86/kernel/smp.c::stop_this_cpu() is very similar to 
> >> this and could be shared. You could move the stop_this_cpu() function to 
> >> arch/x86/kernel/process.c (out of smp.c), so that it can be used by 
> >> reboot.c.
> >>
> > Yes, this make sense. Here is the patch.
> > 
> > Ivan
> > 
> > ---
> >  arch/x86/kernel/process.c |   16 ++++++++++++++++
> >  arch/x86/kernel/reboot.c  |    5 +++++
> >  arch/x86/kernel/smp.c     |   13 -------------
> >  include/asm-x86/system.h  |    2 ++
> >  4 files changed, 23 insertions(+), 13 deletions(-)
> > 
> > diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
> > index c622772..af6904e 100644
> > --- a/arch/x86/kernel/process.c
> > +++ b/arch/x86/kernel/process.c
> > @@ -8,6 +8,7 @@
> >  #include <linux/pm.h>
> >  #include <linux/clockchips.h>
> >  #include <asm/system.h>
> > +#include <asm/apic.h>
> >  
> >  unsigned long idle_halt;
> >  EXPORT_SYMBOL(idle_halt);
> > @@ -122,6 +123,21 @@ void default_idle(void)
> >  EXPORT_SYMBOL(default_idle);
> >  #endif
> >  
> > +void stop_this_cpu(void *dummy)
> > +{
> > +	local_irq_disable();
> > +	/*
> > +	 * Remove this CPU:
> > +	 */
> > +	cpu_clear(smp_processor_id(), cpu_online_map);
> > +#ifdef CONFIG_X86_LOCAL_APIC
> > +	disable_local_APIC();
> > +#endif
> > +	if (hlt_works(smp_processor_id()))
> > +		for (;;) halt();
> > +	for (;;);
> > +}

Why the new ifdef? And while we are at it, why is it neccessary to
disable APIC for stopping CPU? (comment in code would be nice)

> > -static void stop_this_cpu(void *dummy)
> > -{
> > -	local_irq_disable();
> > -	/*
> > -	 * Remove this CPU:
> > -	 */
> > -	cpu_clear(smp_processor_id(), cpu_online_map);
> > -	disable_local_APIC();
> > -	if (hlt_works(smp_processor_id()))
> > -		for (;;) halt();
> > -	for (;;);
> > -}
> > -
> >  /*
> >   * this function calls the 'stop' function on all other CPUs in the system.
> >   */

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

  parent reply	other threads:[~2008-11-10 22:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-20 12:13 [PATCH] x86: call machine_shutdown and stop all CPUs in native_machine_halt Ivan Vecera
2008-10-20 14:39 ` Neil Horman
2008-10-20 16:00 ` Ingo Molnar
2008-10-21 12:36   ` Ivan Vecera
2008-11-06 16:10     ` Ivan Vecera
2008-11-06 16:15       ` Neil Horman
2008-11-10 22:49       ` Pavel Machek [this message]
2008-11-11 12:48         ` Ivan Vecera
2008-11-06 20:43     ` Ingo Molnar
2008-11-11 12:47       ` Ivan Vecera
2008-11-11 13:47         ` Ingo Molnar

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=20081110224934.GA2069@ucw.cz \
    --to=pavel@suse.cz \
    --cc=hpa@zytor.com \
    --cc=ivecera@redhat.com \
    --cc=jmarchan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=nhorman@redhat.com \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.