Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 140565
b: refs/heads/master
c: c38da56
h: refs/heads/master
i:
  140563: d2f9657
v: v3
  • Loading branch information
Rusty Russell authored and Ingo Molnar committed Mar 18, 2009
1 parent a145b61 commit cfb5a86
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 89bd55d1855f8e9a4e9add8e93f3144d049c469e
refs/heads/master: c38da5692e3a4d5d303c04cbf7e526f1eb761076
19 changes: 13 additions & 6 deletions trunk/arch/x86/mm/mmio-mod.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,27 +378,34 @@ static void clear_trace_list(void)
}

#ifdef CONFIG_HOTPLUG_CPU
static cpumask_t downed_cpus;
static cpumask_var_t downed_cpus;

static void enter_uniprocessor(void)
{
int cpu;
int err;

if (downed_cpus == NULL &&
!alloc_cpumask_var(&downed_cpus, GFP_KERNEL)) {
pr_notice(NAME "Failed to allocate mask\n");
goto out;
}

get_online_cpus();
downed_cpus = cpu_online_map;
cpu_clear(first_cpu(cpu_online_map), downed_cpus);
cpumask_copy(downed_cpus, cpu_online_mask);
cpumask_clear_cpu(cpumask_first(cpu_online_mask), downed_cpus);
if (num_online_cpus() > 1)
pr_notice(NAME "Disabling non-boot CPUs...\n");
put_online_cpus();

for_each_cpu_mask(cpu, downed_cpus) {
for_each_cpu(cpu, downed_cpus) {
err = cpu_down(cpu);
if (!err)
pr_info(NAME "CPU%d is down.\n", cpu);
else
pr_err(NAME "Error taking CPU%d down: %d\n", cpu, err);
}
out:
if (num_online_cpus() > 1)
pr_warning(NAME "multiple CPUs still online, "
"may miss events.\n");
Expand All @@ -411,10 +418,10 @@ static void __ref leave_uniprocessor(void)
int cpu;
int err;

if (cpus_weight(downed_cpus) == 0)
if (downed_cpus == NULL || cpumask_weight(downed_cpus) == 0)
return;
pr_notice(NAME "Re-enabling CPUs...\n");
for_each_cpu_mask(cpu, downed_cpus) {
for_each_cpu(cpu, downed_cpus) {
err = cpu_up(cpu);
if (!err)
pr_info(NAME "enabled CPU%d.\n", cpu);
Expand Down

0 comments on commit cfb5a86

Please sign in to comment.