public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gautham R Shenoy <ego@in.ibm.com>
To: Oleg Nesterov <oleg@tv-sign.ru>
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	rui.zhang@intel.com, harbour@sfinx.od.ua, pavel@ucw.cz,
	rjw@sisk.pl
Subject: Re: + pm-introduce-new-interfaces-schedule_work_on-and-queue_work_on.patch added to -mm tree
Date: Tue, 22 Jul 2008 12:19:00 -0400	[thread overview]
Message-ID: <20080722161900.GA17601@in.ibm.com> (raw)
In-Reply-To: <20080712162149.GD603@tv-sign.ru>

On Sat, Jul 12, 2008 at 08:21:49PM +0400, Oleg Nesterov wrote:
> (Gautham cc'ed)
> 

Sorry for the delay... I'm a bit tied down to other things until aug
20th :(

> On 07/11, Andrew Morton wrote:
> >
> > Subject: pm: introduce new interfaces schedule_work_on() and queue_work_on()
> > From: Zhang Rui <rui.zhang@intel.com>
> >
> > This interface allows adding a job on a specific cpu.
> >
> > Although a work struct on a cpu will be scheduled to other cpu if the cpu
> > dies, there is a recursion if a work task tries to offline the cpu it's
> > running on.  we need to schedule the task to a specific cpu in this case.
> > http://bugzilla.kernel.org/show_bug.cgi?id=10897
> 
> So, this is used in http://bugzilla.kernel.org/attachment.cgi?id=16707
> 
> 	--- linux-2.6.orig/kernel/power/poweroff.c	2008-06-30 16:01:35.000000000 +0800
> 	+++ linux-2.6/kernel/power/poweroff.c	2008-07-03 10:50:05.000000000 +0800
> 	@@ -25,7 +25,8 @@
> 	 
> 	 static void handle_poweroff(int key, struct tty_struct *tty)
> 	 {
> 	-	schedule_work(&poweroff_work);
> 	+	/* run sysrq poweroff on boot cpu */
> 	+	schedule_work_on(first_cpu(cpu_online_map), &poweroff_work);
> 	 }
> 	 
> 	 static struct sysrq_key_op	sysrq_poweroff_op = {
> 
> A couple of silly questions, I don't understand the low-level details.
> 
> This patch (and kernel_power_off() afaics) assumes that the boot cpu
> can't be cpu_down()'ed. Is it true in general? For example, grep shows
> that arch/s390/kernel/smp.c:topology_init()->smp_add_present_cpu()
> sets ->hotpluggable = 1 for all present CPUs?

I tried this on a Power system sometime back and I was able to
offline CPU0. What I am not sure however, is
if that was the boot-cpu.

On x86, I do remember reading somewhere why we cannot offline
CPU0.

/me searches.

Yes, in arch/x86/kernel/topology.c

int __ref arch_register_cpu(int num)
{
	/*
	 * CPU0 cannot be offlined due to several
	 * restrictions and assumptions in kernel. This basically
	 * doesnt add a control file, one cannot attempt to offline
	 * BSP.
	 *
	 * Also certain PCI quirks require not to enable hotplug control
	 * for all CPU's.
	 */
	if (num)
		per_cpu(cpu_devices, num).cpu.hotpluggable = 1;
	return register_cpu(&per_cpu(cpu_devices, num).cpu, num);
}

> 
> Another question. I can't understand why first_cpu(cpu_online_map) is
> always the boot CPU on every arch. IOW, shouldn't boot_cpu_init() set
> some "boot_cpu = smp_processor_id()" which should be use instead of
> first_cpu(cpu_online_map) ?
>

Not very sure about this one.
> Thanks,
> 
> Oleg.
> 

-- 
Thanks and Regards
gautham

  reply	other threads:[~2008-07-22 16:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200807111846.m6BIkeTj031024@imap1.linux-foundation.org>
2008-07-12 15:32 ` [PATCH] pm-introduce-new-interfaces-schedule_work_on-and-queue_work_on-cleanup Oleg Nesterov
2008-07-12 15:35   ` [PATCH] workqueues: queue_work() can use queue_work_on() Oleg Nesterov
2008-07-12 15:45   ` [PATCH] workqueues: schedule_on_each_cpu() can use schedule_work_on() Oleg Nesterov
2008-07-12 16:21 ` + pm-introduce-new-interfaces-schedule_work_on-and-queue_work_on.patch added to -mm tree Oleg Nesterov
2008-07-22 16:19   ` Gautham R Shenoy [this message]
2008-07-24 12:43     ` Oleg Nesterov
2008-07-25  1:17       ` Zhang Rui
2008-07-25  9:42         ` Oleg Nesterov
2008-08-05 19:57           ` Pavel Machek
2008-08-06 12:45             ` Oleg Nesterov

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=20080722161900.GA17601@in.ibm.com \
    --to=ego@in.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=harbour@sfinx.od.ua \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@tv-sign.ru \
    --cc=pavel@ucw.cz \
    --cc=rjw@sisk.pl \
    --cc=rui.zhang@intel.com \
    /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