aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/cpu-hotplug.txt
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/cpu-hotplug.txt')
-rw-r--r--Documentation/cpu-hotplug.txt55
1 files changed, 23 insertions, 32 deletions
diff --git a/Documentation/cpu-hotplug.txt b/Documentation/cpu-hotplug.txt
index 9d620c153b04..a99d7031cdf9 100644
--- a/Documentation/cpu-hotplug.txt
+++ b/Documentation/cpu-hotplug.txt
@@ -49,6 +49,12 @@ maxcpus=n Restrict boot time cpus to n. Say if you have 4 cpus, using
49additional_cpus=n (*) Use this to limit hotpluggable cpus. This option sets 49additional_cpus=n (*) Use this to limit hotpluggable cpus. This option sets
50 cpu_possible_map = cpu_present_map + additional_cpus 50 cpu_possible_map = cpu_present_map + additional_cpus
51 51
52cede_offline={"off","on"} Use this option to disable/enable putting offlined
53 processors to an extended H_CEDE state on
54 supported pseries platforms.
55 If nothing is specified,
56 cede_offline is set to "on".
57
52(*) Option valid only for following architectures 58(*) Option valid only for following architectures
53- ia64 59- ia64
54 60
@@ -309,41 +315,26 @@ A: The following are what is required for CPU hotplug infrastructure to work
309 315
310Q: I need to ensure that a particular cpu is not removed when there is some 316Q: I need to ensure that a particular cpu is not removed when there is some
311 work specific to this cpu is in progress. 317 work specific to this cpu is in progress.
312A: First switch the current thread context to preferred cpu 318A: There are two ways. If your code can be run in interrupt context, use
319 smp_call_function_single(), otherwise use work_on_cpu(). Note that
320 work_on_cpu() is slow, and can fail due to out of memory:
313 321
314 int my_func_on_cpu(int cpu) 322 int my_func_on_cpu(int cpu)
315 { 323 {
316 cpumask_t saved_mask, new_mask = CPU_MASK_NONE; 324 int err;
317 int curr_cpu, err = 0; 325 get_online_cpus();
318 326 if (!cpu_online(cpu))
319 saved_mask = current->cpus_allowed; 327 err = -EINVAL;
320 cpu_set(cpu, new_mask); 328 else
321 err = set_cpus_allowed(current, new_mask); 329#if NEEDS_BLOCKING
322 330 err = work_on_cpu(cpu, __my_func_on_cpu, NULL);
323 if (err) 331#else
324 return err; 332 smp_call_function_single(cpu, __my_func_on_cpu, &err,
325 333 true);
326 /* 334#endif
327 * If we got scheduled out just after the return from 335 put_online_cpus();
328 * set_cpus_allowed() before running the work, this ensures 336 return err;
329 * we stay locked. 337 }
330 */
331 curr_cpu = get_cpu();
332
333 if (curr_cpu != cpu) {
334 err = -EAGAIN;
335 goto ret;
336 } else {
337 /*
338 * Do work : But cant sleep, since get_cpu() disables preempt
339 */
340 }
341 ret:
342 put_cpu();
343 set_cpus_allowed(current, saved_mask);
344 return err;
345 }
346
347 338
348Q: How do we determine how many CPUs are available for hotplug. 339Q: How do we determine how many CPUs are available for hotplug.
349A: There is no clear spec defined way from ACPI that can give us that 340A: There is no clear spec defined way from ACPI that can give us that