Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 274734
b: refs/heads/master
c: 189c3fd
h: refs/heads/master
v: v3
  • Loading branch information
Jeremy Fitzhardinge committed Oct 25, 2011
1 parent 4197778 commit 8830a8d
Show file tree
Hide file tree
Showing 2 changed files with 23 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: d5d9a3b12adf339b851c8e595d2ca71c3d211363
refs/heads/master: 189c3fd68c7016e37c1ffd7a00009e2c944a9d06
22 changes: 22 additions & 0 deletions trunk/kernel/stop_machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ struct cpu_stopper {
};

static DEFINE_PER_CPU(struct cpu_stopper, cpu_stopper);
static bool stop_machine_initialized = false;

static void cpu_stop_init_done(struct cpu_stop_done *done, unsigned int nr_todo)
{
Expand Down Expand Up @@ -386,6 +387,8 @@ static int __init cpu_stop_init(void)
cpu_stop_cpu_callback(&cpu_stop_cpu_notifier, CPU_ONLINE, bcpu);
register_cpu_notifier(&cpu_stop_cpu_notifier);

stop_machine_initialized = true;

return 0;
}
early_initcall(cpu_stop_init);
Expand Down Expand Up @@ -485,6 +488,25 @@ int __stop_machine(int (*fn)(void *), void *data, const struct cpumask *cpus)
.num_threads = num_online_cpus(),
.active_cpus = cpus };

if (!stop_machine_initialized) {
/*
* Handle the case where stop_machine() is called
* early in boot before stop_machine() has been
* initialized.
*/
unsigned long flags;
int ret;

WARN_ON_ONCE(smdata.num_threads != 1);

local_irq_save(flags);
hard_irq_disable();
ret = (*fn)(data);
local_irq_restore(flags);

return ret;
}

/* Set the initial state and stop all online cpus. */
set_state(&smdata, STOPMACHINE_PREPARE);
return stop_cpus(cpu_online_mask, stop_machine_cpu_stop, &smdata);
Expand Down

0 comments on commit 8830a8d

Please sign in to comment.