Skip to content

Commit 2f15fc4

Browse files
zhang-ruitorvalds
authored andcommitted
pm: schedule sysrq poweroff on boot cpu
schedule sysrq poweroff on boot cpu. sysrq poweroff needs to disable nonboot cpus, and we need to run this on boot cpu to avoid any recursion. http://bugzilla.kernel.org/show_bug.cgi?id=10897 [kosaki.motohiro@jp.fujitsu.com: build fix] Signed-off-by: Zhang Rui <rui.zhang@intel.com> Tested-by: Rus <harbour@sfinx.od.ua> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent c1a220e commit 2f15fc4

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎kernel/power/poweroff.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/pm.h>
1111
#include <linux/workqueue.h>
1212
#include <linux/reboot.h>
13+
#include <linux/cpumask.h>
1314

1415
/*
1516
* When the user hits Sys-Rq o to power down the machine this is the
@@ -25,7 +26,8 @@ static DECLARE_WORK(poweroff_work, do_poweroff);
2526

2627
static void handle_poweroff(int key, struct tty_struct *tty)
2728
{
28-
schedule_work(&poweroff_work);
29+
/* run sysrq poweroff on boot cpu */
30+
schedule_work_on(first_cpu(cpu_online_map), &poweroff_work);
2931
}
3032

3133
static struct sysrq_key_op sysrq_poweroff_op = {

0 commit comments

Comments
 (0)