int cpu_up(unsigned int cpu);
-#define lock_cpu_hotplug() down(&cpucontrol)
-#define unlock_cpu_hotplug() up(&cpucontrol)
-
#else
static inline int register_cpu_notifier(struct notifier_block *nb)
{
}
-#define lock_cpu_hotplug() do { } while (0)
-#define unlock_cpu_hotplug() do { } while (0)
-
#endif /* CONFIG_SMP */
extern struct sysdev_class cpu_sysdev_class;
+#ifdef CONFIG_HOTPLUG_CPU
/* Stop CPUs going up and down. */
extern struct semaphore cpucontrol;
+#define lock_cpu_hotplug() down(&cpucontrol)
+#define unlock_cpu_hotplug() up(&cpucontrol)
+#else
+#define lock_cpu_hotplug() do { } while (0)
+#define unlock_cpu_hotplug() do { } while (0)
+#endif
+
#endif /* _LINUX_CPU_H_ */
stopref_state = STOPREF_WAIT;
/* No CPUs can come up or down during this. */
- down(&cpucontrol);
+ lock_cpu_hotplug();
for (i = 0; i < NR_CPUS; i++) {
if (i == cpu || !cpu_online(i))
/* If some failed, kill them all. */
if (ret < 0) {
stopref_set_state(STOPREF_EXIT, 1);
- up(&cpucontrol);
+ unlock_cpu_hotplug();
return ret;
}
stopref_set_state(STOPREF_EXIT, 0);
local_irq_enable();
preempt_enable();
- up(&cpucontrol);
+ unlock_cpu_hotplug();
}
#else /* ...!SMP */
static inline int stop_refcounts(void)
void flow_cache_flush(void)
{
struct flow_flush_info info;
+ static DECLARE_MUTEX(flow_flush_sem);
- /* Don't want cpus going down or up during this, also protects
- * against multiple callers. */
+ /* Don't want cpus going down or up during this. */
lock_cpu_hotplug();
+ down(&flow_flush_sem);
atomic_set(&info.cpuleft, num_online_cpus());
init_completion(&info.completion);
local_bh_enable();
wait_for_completion(&info.completion);
+ up(&flow_flush_sem);
unlock_cpu_hotplug();
}