aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/smp.c64
1 files changed, 32 insertions, 32 deletions
diff --git a/kernel/smp.c b/kernel/smp.c
index 64bb0d48e96f..fa04ab938e52 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -237,6 +237,38 @@ int smp_call_function_single(int cpu, smp_call_func_t func, void *info,
237} 237}
238EXPORT_SYMBOL(smp_call_function_single); 238EXPORT_SYMBOL(smp_call_function_single);
239 239
240/**
241 * __smp_call_function_single(): Run a function on a specific CPU
242 * @cpu: The CPU to run on.
243 * @csd: Pre-allocated and setup data structure
244 * @wait: If true, wait until function has completed on specified CPU.
245 *
246 * Like smp_call_function_single(), but allow caller to pass in a
247 * pre-allocated data structure. Useful for embedding @data inside
248 * other structures, for instance.
249 */
250int __smp_call_function_single(int cpu, struct call_single_data *csd, int wait)
251{
252 int err = 0;
253 int this_cpu;
254
255 this_cpu = get_cpu();
256 /*
257 * Can deadlock when called with interrupts disabled.
258 * We allow cpu's that are not yet online though, as no one else can
259 * send smp call function interrupt to this cpu and as such deadlocks
260 * can't happen.
261 */
262 WARN_ON_ONCE(cpu_online(this_cpu) && wait && irqs_disabled()
263 && !oops_in_progress);
264
265 err = generic_exec_single(cpu, csd, csd->func, csd->info, wait);
266 put_cpu();
267
268 return err;
269}
270EXPORT_SYMBOL_GPL(__smp_call_function_single);
271
240/* 272/*
241 * smp_call_function_any - Run a function on any of the given cpus 273 * smp_call_function_any - Run a function on any of the given cpus
242 * @mask: The mask of cpus it can run on. 274 * @mask: The mask of cpus it can run on.
@@ -281,38 +313,6 @@ call:
281EXPORT_SYMBOL_GPL(smp_call_function_any); 313EXPORT_SYMBOL_GPL(smp_call_function_any);
282 314
283/** 315/**
284 * __smp_call_function_single(): Run a function on a specific CPU
285 * @cpu: The CPU to run on.
286 * @csd: Pre-allocated and setup data structure
287 * @wait: If true, wait until function has completed on specified CPU.
288 *
289 * Like smp_call_function_single(), but allow caller to pass in a
290 * pre-allocated data structure. Useful for embedding @data inside
291 * other structures, for instance.
292 */
293int __smp_call_function_single(int cpu, struct call_single_data *csd, int wait)
294{
295 int err = 0;
296 int this_cpu;
297
298 this_cpu = get_cpu();
299 /*
300 * Can deadlock when called with interrupts disabled.
301 * We allow cpu's that are not yet online though, as no one else can
302 * send smp call function interrupt to this cpu and as such deadlocks
303 * can't happen.
304 */
305 WARN_ON_ONCE(cpu_online(this_cpu) && wait && irqs_disabled()
306 && !oops_in_progress);
307
308 err = generic_exec_single(cpu, csd, csd->func, csd->info, wait);
309 put_cpu();
310
311 return err;
312}
313EXPORT_SYMBOL_GPL(__smp_call_function_single);
314
315/**
316 * smp_call_function_many(): Run a function on a set of other CPUs. 316 * smp_call_function_many(): Run a function on a set of other CPUs.
317 * @mask: The set of cpus to run on (only runs on online subset). 317 * @mask: The set of cpus to run on (only runs on online subset).
318 * @func: The function to run. This must be fast and non-blocking. 318 * @func: The function to run. This must be fast and non-blocking.