Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339125
b: refs/heads/master
c: 209efae
h: refs/heads/master
i:
  339123: 75bbff3
v: v3
  • Loading branch information
Fenghua Yu authored and H. Peter Anvin committed Nov 14, 2012
1 parent 8465575 commit 154f551
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 30106c174311b8cfaaa3186c7f6f9c36c62d17da
refs/heads/master: 209efae12981f3d2d694499b761def10895c078c
44 changes: 44 additions & 0 deletions trunk/arch/x86/power/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,47 @@ void restore_processor_state(void)
#ifdef CONFIG_X86_32
EXPORT_SYMBOL(restore_processor_state);
#endif

/*
* When bsp_check() is called in hibernate and suspend, cpu hotplug
* is disabled already. So it's unnessary to handle race condition between
* cpumask query and cpu hotplug.
*/
static int bsp_check(void)
{
if (cpumask_first(cpu_online_mask) != 0) {
pr_warn("CPU0 is offline.\n");
return -ENODEV;
}

return 0;
}

static int bsp_pm_callback(struct notifier_block *nb, unsigned long action,
void *ptr)
{
int ret = 0;

switch (action) {
case PM_SUSPEND_PREPARE:
case PM_HIBERNATION_PREPARE:
ret = bsp_check();
break;
default:
break;
}
return notifier_from_errno(ret);
}

static int __init bsp_pm_check_init(void)
{
/*
* Set this bsp_pm_callback as lower priority than
* cpu_hotplug_pm_callback. So cpu_hotplug_pm_callback will be called
* earlier to disable cpu hotplug before bsp online check.
*/
pm_notifier(bsp_pm_callback, -INT_MAX);
return 0;
}

core_initcall(bsp_pm_check_init);

0 comments on commit 154f551

Please sign in to comment.