blob: 7a0ce25829dccc226b4ae27178ac025b0b2ea8d2 [file] [log] [blame]
Jens Axboe3d442232008-06-26 11:21:34 +02001/*
2 * Generic helpers for smp ipi calls
3 *
4 * (C) Jens Axboe <jens.axboe@oracle.com> 2008
5 *
6 */
7#include <linux/init.h>
8#include <linux/module.h>
9#include <linux/percpu.h>
10#include <linux/rcupdate.h>
Linus Torvalds59190f4212008-07-15 14:02:33 -070011#include <linux/rculist.h>
Jens Axboe3d442232008-06-26 11:21:34 +020012#include <linux/smp.h>
Peter Zijlstra8969a5e2009-02-25 13:59:47 +010013#include <linux/cpu.h>
Jens Axboe3d442232008-06-26 11:21:34 +020014
15static DEFINE_PER_CPU(struct call_single_queue, call_single_queue);
Peter Zijlstra8969a5e2009-02-25 13:59:47 +010016
17static struct {
18 struct list_head queue;
19 spinlock_t lock;
20} call_function __cacheline_aligned_in_smp = {
21 .queue = LIST_HEAD_INIT(call_function.queue),
22 .lock = __SPIN_LOCK_UNLOCKED(call_function.lock),
23};
Jens Axboe3d442232008-06-26 11:21:34 +020024
25enum {
26 CSD_FLAG_WAIT = 0x01,
Peter Zijlstra8969a5e2009-02-25 13:59:47 +010027 CSD_FLAG_LOCK = 0x02,
Jens Axboe3d442232008-06-26 11:21:34 +020028};
29
30struct call_function_data {
31 struct call_single_data csd;
32 spinlock_t lock;
33 unsigned int refs;
Peter Zijlstra8969a5e2009-02-25 13:59:47 +010034 cpumask_var_t cpumask;
Jens Axboe3d442232008-06-26 11:21:34 +020035};
36
37struct call_single_queue {
38 struct list_head list;
39 spinlock_t lock;
40};
41
Peter Zijlstra8969a5e2009-02-25 13:59:47 +010042static DEFINE_PER_CPU(struct call_function_data, cfd_data) = {
43 .lock = __SPIN_LOCK_UNLOCKED(cfd_data.lock),
44};
45
46static int
47hotplug_cfd(struct notifier_block *nfb, unsigned long action, void *hcpu)
48{
49 long cpu = (long)hcpu;
50 struct call_function_data *cfd = &per_cpu(cfd_data, cpu);
51
52 switch (action) {
53 case CPU_UP_PREPARE:
54 case CPU_UP_PREPARE_FROZEN:
55 if (!alloc_cpumask_var_node(&cfd->cpumask, GFP_KERNEL,
56 cpu_to_node(cpu)))
57 return NOTIFY_BAD;
58 break;
59
60#ifdef CONFIG_CPU_HOTPLUG
61 case CPU_UP_CANCELED:
62 case CPU_UP_CANCELED_FROZEN:
63
64 case CPU_DEAD:
65 case CPU_DEAD_FROZEN:
66 free_cpumask_var(cfd->cpumask);
67 break;
68#endif
69 };
70
71 return NOTIFY_OK;
72}
73
74static struct notifier_block __cpuinitdata hotplug_cfd_notifier = {
75 .notifier_call = hotplug_cfd,
76};
77
Eduard - Gabriel Munteanu7babe8d2008-07-25 19:45:11 -070078static int __cpuinit init_call_single_data(void)
Jens Axboe3d442232008-06-26 11:21:34 +020079{
Peter Zijlstra8969a5e2009-02-25 13:59:47 +010080 void *cpu = (void *)(long)smp_processor_id();
Jens Axboe3d442232008-06-26 11:21:34 +020081 int i;
82
83 for_each_possible_cpu(i) {
84 struct call_single_queue *q = &per_cpu(call_single_queue, i);
85
86 spin_lock_init(&q->lock);
87 INIT_LIST_HEAD(&q->list);
88 }
Peter Zijlstra8969a5e2009-02-25 13:59:47 +010089
90 hotplug_cfd(&hotplug_cfd_notifier, CPU_UP_PREPARE, cpu);
91 register_cpu_notifier(&hotplug_cfd_notifier);
92
Eduard - Gabriel Munteanu7babe8d2008-07-25 19:45:11 -070093 return 0;
Jens Axboe3d442232008-06-26 11:21:34 +020094}
Eduard - Gabriel Munteanu7babe8d2008-07-25 19:45:11 -070095early_initcall(init_call_single_data);
Jens Axboe3d442232008-06-26 11:21:34 +020096
Peter Zijlstra8969a5e2009-02-25 13:59:47 +010097/*
98 * csd_wait/csd_complete are used for synchronous ipi calls
99 */
100static void csd_wait_prepare(struct call_single_data *data)
Jens Axboe3d442232008-06-26 11:21:34 +0200101{
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100102 data->flags |= CSD_FLAG_WAIT;
103}
104
105static void csd_complete(struct call_single_data *data)
106{
107 if (data->flags & CSD_FLAG_WAIT) {
108 /*
109 * ensure we're all done before saying we are
110 */
111 smp_mb();
112 data->flags &= ~CSD_FLAG_WAIT;
113 }
114}
115
116static void csd_wait(struct call_single_data *data)
117{
118 while (data->flags & CSD_FLAG_WAIT)
Jens Axboe3d442232008-06-26 11:21:34 +0200119 cpu_relax();
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100120}
121
122/*
123 * csd_lock/csd_unlock used to serialize access to per-cpu csd resources
124 *
125 * For non-synchronous ipi calls the csd can still be in use by the previous
126 * function call. For multi-cpu calls its even more interesting as we'll have
127 * to ensure no other cpu is observing our csd.
128 */
129static void csd_lock(struct call_single_data *data)
130{
131 while (data->flags & CSD_FLAG_LOCK)
132 cpu_relax();
133 data->flags = CSD_FLAG_LOCK;
134
135 /*
136 * prevent CPU from reordering the above assignment to ->flags
137 * with any subsequent assignments to other fields of the
138 * specified call_single_data structure.
139 */
140
141 smp_mb();
142}
143
144static void csd_unlock(struct call_single_data *data)
145{
146 WARN_ON(!(data->flags & CSD_FLAG_LOCK));
147 /*
148 * ensure we're all done before releasing data
149 */
150 smp_mb();
151 data->flags &= ~CSD_FLAG_LOCK;
Jens Axboe3d442232008-06-26 11:21:34 +0200152}
153
154/*
155 * Insert a previously allocated call_single_data element for execution
156 * on the given CPU. data must already have ->func, ->info, and ->flags set.
157 */
158static void generic_exec_single(int cpu, struct call_single_data *data)
159{
160 struct call_single_queue *dst = &per_cpu(call_single_queue, cpu);
161 int wait = data->flags & CSD_FLAG_WAIT, ipi;
162 unsigned long flags;
163
164 spin_lock_irqsave(&dst->lock, flags);
165 ipi = list_empty(&dst->list);
166 list_add_tail(&data->list, &dst->list);
167 spin_unlock_irqrestore(&dst->lock, flags);
168
Suresh Siddha561920a02008-10-30 18:28:41 +0100169 /*
Nick Piggin15d0d3b2009-02-25 06:22:45 +0100170 * The list addition should be visible before sending the IPI
171 * handler locks the list to pull the entry off it because of
172 * normal cache coherency rules implied by spinlocks.
173 *
174 * If IPIs can go out of order to the cache coherency protocol
175 * in an architecture, sufficient synchronisation should be added
176 * to arch code to make it appear to obey cache coherency WRT
177 * locking and barrier primitives. Generic code isn't really equipped
178 * to do the right thing...
Suresh Siddha561920a02008-10-30 18:28:41 +0100179 */
Suresh Siddha561920a02008-10-30 18:28:41 +0100180
Jens Axboe3d442232008-06-26 11:21:34 +0200181 if (ipi)
182 arch_send_call_function_single_ipi(cpu);
183
184 if (wait)
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100185 csd_wait(data);
Jens Axboe3d442232008-06-26 11:21:34 +0200186}
187
188/*
189 * Invoked by arch to handle an IPI for call function. Must be called with
190 * interrupts disabled.
191 */
192void generic_smp_call_function_interrupt(void)
193{
194 struct call_function_data *data;
195 int cpu = get_cpu();
196
197 /*
Nick Piggin15d0d3b2009-02-25 06:22:45 +0100198 * Ensure entry is visible on call_function_queue after we have
199 * entered the IPI. See comment in smp_call_function_many.
200 * If we don't have this, then we may miss an entry on the list
201 * and never get another IPI to process it.
202 */
203 smp_mb();
204
205 /*
Jens Axboe3d442232008-06-26 11:21:34 +0200206 * It's ok to use list_for_each_rcu() here even though we may delete
207 * 'pos', since list_del_rcu() doesn't clear ->next
208 */
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100209 list_for_each_entry_rcu(data, &call_function.queue, csd.list) {
Jens Axboe3d442232008-06-26 11:21:34 +0200210 int refs;
211
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100212 spin_lock(&data->lock);
213 if (!cpumask_test_cpu(cpu, data->cpumask)) {
214 spin_unlock(&data->lock);
Jens Axboe3d442232008-06-26 11:21:34 +0200215 continue;
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100216 }
217 cpumask_clear_cpu(cpu, data->cpumask);
218 spin_unlock(&data->lock);
Jens Axboe3d442232008-06-26 11:21:34 +0200219
220 data->csd.func(data->csd.info);
221
222 spin_lock(&data->lock);
Jens Axboe3d442232008-06-26 11:21:34 +0200223 WARN_ON(data->refs == 0);
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100224 refs = --data->refs;
225 if (!refs) {
226 spin_lock(&call_function.lock);
227 list_del_rcu(&data->csd.list);
228 spin_unlock(&call_function.lock);
229 }
Jens Axboe3d442232008-06-26 11:21:34 +0200230 spin_unlock(&data->lock);
231
232 if (refs)
233 continue;
234
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100235 csd_complete(&data->csd);
236 csd_unlock(&data->csd);
Jens Axboe3d442232008-06-26 11:21:34 +0200237 }
Jens Axboe3d442232008-06-26 11:21:34 +0200238
239 put_cpu();
240}
241
242/*
243 * Invoked by arch to handle an IPI for call function single. Must be called
244 * from the arch with interrupts disabled.
245 */
246void generic_smp_call_function_single_interrupt(void)
247{
248 struct call_single_queue *q = &__get_cpu_var(call_single_queue);
249 LIST_HEAD(list);
Nick Piggin15d0d3b2009-02-25 06:22:45 +0100250 unsigned int data_flags;
Jens Axboe3d442232008-06-26 11:21:34 +0200251
Nick Piggin15d0d3b2009-02-25 06:22:45 +0100252 spin_lock(&q->lock);
253 list_replace_init(&q->list, &list);
254 spin_unlock(&q->lock);
Jens Axboe3d442232008-06-26 11:21:34 +0200255
Nick Piggin15d0d3b2009-02-25 06:22:45 +0100256 while (!list_empty(&list)) {
257 struct call_single_data *data;
Jens Axboe3d442232008-06-26 11:21:34 +0200258
Nick Piggin15d0d3b2009-02-25 06:22:45 +0100259 data = list_entry(list.next, struct call_single_data,
260 list);
261 list_del(&data->list);
Jens Axboe3d442232008-06-26 11:21:34 +0200262
Jens Axboe3d442232008-06-26 11:21:34 +0200263 /*
Nick Piggin15d0d3b2009-02-25 06:22:45 +0100264 * 'data' can be invalid after this call if
265 * flags == 0 (when called through
266 * generic_exec_single(), so save them away before
267 * making the call.
Jens Axboe3d442232008-06-26 11:21:34 +0200268 */
Nick Piggin15d0d3b2009-02-25 06:22:45 +0100269 data_flags = data->flags;
270
271 data->func(data->info);
272
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100273 if (data_flags & CSD_FLAG_WAIT)
274 csd_complete(data);
275
276 /*
277 * Unlocked CSDs are valid through generic_exec_single()
278 */
279 if (data_flags & CSD_FLAG_LOCK)
280 csd_unlock(data);
Jens Axboe3d442232008-06-26 11:21:34 +0200281 }
282}
283
Steven Rostedtd7240b92009-01-29 10:08:01 -0500284static DEFINE_PER_CPU(struct call_single_data, csd_data);
285
Jens Axboe3d442232008-06-26 11:21:34 +0200286/*
287 * smp_call_function_single - Run a function on a specific CPU
288 * @func: The function to run. This must be fast and non-blocking.
289 * @info: An arbitrary pointer to pass to the function.
Jens Axboe3d442232008-06-26 11:21:34 +0200290 * @wait: If true, wait until function has completed on other CPUs.
291 *
292 * Returns 0 on success, else a negative status code. Note that @wait
293 * will be implicitly turned on in case of allocation failures, since
294 * we fall back to on-stack allocation.
295 */
296int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
Jens Axboe8691e5a2008-06-06 11:18:06 +0200297 int wait)
Jens Axboe3d442232008-06-26 11:21:34 +0200298{
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100299 struct call_single_data d = {
300 .flags = 0,
301 };
Jens Axboe3d442232008-06-26 11:21:34 +0200302 unsigned long flags;
H. Peter Anvinf73be6de2008-08-25 17:07:14 -0700303 /* prevent preemption and reschedule on another processor,
304 as well as CPU removal */
Jens Axboe3d442232008-06-26 11:21:34 +0200305 int me = get_cpu();
H. Peter Anvinf73be6de2008-08-25 17:07:14 -0700306 int err = 0;
Jens Axboe3d442232008-06-26 11:21:34 +0200307
308 /* Can deadlock when called with interrupts disabled */
309 WARN_ON(irqs_disabled());
310
311 if (cpu == me) {
312 local_irq_save(flags);
313 func(info);
314 local_irq_restore(flags);
Rusty Russell4f4b6c12009-01-01 10:12:15 +1030315 } else if ((unsigned)cpu < nr_cpu_ids && cpu_online(cpu)) {
Steven Rostedtd7240b92009-01-29 10:08:01 -0500316 struct call_single_data *data;
Jens Axboe3d442232008-06-26 11:21:34 +0200317
318 if (!wait) {
Steven Rostedtd7240b92009-01-29 10:08:01 -0500319 /*
320 * We are calling a function on a single CPU
321 * and we are not going to wait for it to finish.
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100322 * We use a per cpu data to pass the information to
323 * that CPU. Since all callers of this code will
324 * use the same data, we must synchronize the
325 * callers to prevent a new caller from corrupting
326 * the data before the callee can access it.
Steven Rostedtd7240b92009-01-29 10:08:01 -0500327 *
328 * The CSD_FLAG_LOCK is used to let us know when
329 * the IPI handler is done with the data.
330 * The first caller will set it, and the callee
331 * will clear it. The next caller must wait for
332 * it to clear before we set it again. This
333 * will make sure the callee is done with the
334 * data before a new caller will use it.
335 */
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100336 data = &__get_cpu_var(csd_data);
337 csd_lock(data);
Steven Rostedtd7240b92009-01-29 10:08:01 -0500338 } else {
Jens Axboe3d442232008-06-26 11:21:34 +0200339 data = &d;
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100340 csd_wait_prepare(data);
Jens Axboe3d442232008-06-26 11:21:34 +0200341 }
342
343 data->func = func;
344 data->info = info;
345 generic_exec_single(cpu, data);
H. Peter Anvinf73be6de2008-08-25 17:07:14 -0700346 } else {
347 err = -ENXIO; /* CPU not online */
Jens Axboe3d442232008-06-26 11:21:34 +0200348 }
349
350 put_cpu();
H. Peter Anvinf73be6de2008-08-25 17:07:14 -0700351 return err;
Jens Axboe3d442232008-06-26 11:21:34 +0200352}
353EXPORT_SYMBOL(smp_call_function_single);
354
355/**
356 * __smp_call_function_single(): Run a function on another CPU
357 * @cpu: The CPU to run on.
358 * @data: Pre-allocated and setup data structure
359 *
360 * Like smp_call_function_single(), but allow caller to pass in a pre-allocated
361 * data structure. Useful for embedding @data inside other structures, for
362 * instance.
363 *
364 */
365void __smp_call_function_single(int cpu, struct call_single_data *data)
366{
367 /* Can deadlock when called with interrupts disabled */
368 WARN_ON((data->flags & CSD_FLAG_WAIT) && irqs_disabled());
369
370 generic_exec_single(cpu, data);
371}
372
Rusty Russellce47d972008-12-30 09:05:17 +1030373/* FIXME: Shim for archs using old arch_send_call_function_ipi API. */
374#ifndef arch_send_call_function_ipi_mask
375#define arch_send_call_function_ipi_mask(maskp) \
376 arch_send_call_function_ipi(*(maskp))
377#endif
378
Jens Axboe3d442232008-06-26 11:21:34 +0200379/**
Rusty Russell54b11e62008-12-30 09:05:16 +1030380 * smp_call_function_many(): Run a function on a set of other CPUs.
381 * @mask: The set of cpus to run on (only runs on online subset).
Jens Axboe3d442232008-06-26 11:21:34 +0200382 * @func: The function to run. This must be fast and non-blocking.
383 * @info: An arbitrary pointer to pass to the function.
384 * @wait: If true, wait (atomically) until function has completed on other CPUs.
385 *
Jens Axboe3d442232008-06-26 11:21:34 +0200386 * If @wait is true, then returns once @func has returned. Note that @wait
387 * will be implicitly turned on in case of allocation failures, since
388 * we fall back to on-stack allocation.
389 *
390 * You must not call this function with disabled interrupts or from a
391 * hardware interrupt handler or from a bottom half handler. Preemption
392 * must be disabled when calling this function.
393 */
Rusty Russell54b11e62008-12-30 09:05:16 +1030394void smp_call_function_many(const struct cpumask *mask,
395 void (*func)(void *), void *info,
396 bool wait)
Jens Axboe3d442232008-06-26 11:21:34 +0200397{
Rusty Russell54b11e62008-12-30 09:05:16 +1030398 struct call_function_data *data;
Jens Axboe3d442232008-06-26 11:21:34 +0200399 unsigned long flags;
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100400 int cpu, next_cpu, me = smp_processor_id();
Jens Axboe3d442232008-06-26 11:21:34 +0200401
402 /* Can deadlock when called with interrupts disabled */
403 WARN_ON(irqs_disabled());
404
Rusty Russell54b11e62008-12-30 09:05:16 +1030405 /* So, what's a CPU they want? Ignoring this one. */
406 cpu = cpumask_first_and(mask, cpu_online_mask);
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100407 if (cpu == me)
Rusty Russell54b11e62008-12-30 09:05:16 +1030408 cpu = cpumask_next_and(cpu, mask, cpu_online_mask);
409 /* No online cpus? We're done. */
410 if (cpu >= nr_cpu_ids)
411 return;
Jens Axboe3d442232008-06-26 11:21:34 +0200412
Rusty Russell54b11e62008-12-30 09:05:16 +1030413 /* Do we have another CPU which isn't us? */
414 next_cpu = cpumask_next_and(cpu, mask, cpu_online_mask);
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100415 if (next_cpu == me)
Rusty Russell54b11e62008-12-30 09:05:16 +1030416 next_cpu = cpumask_next_and(next_cpu, mask, cpu_online_mask);
417
418 /* Fastpath: do that cpu by itself. */
419 if (next_cpu >= nr_cpu_ids) {
420 smp_call_function_single(cpu, func, info, wait);
421 return;
Jens Axboe3d442232008-06-26 11:21:34 +0200422 }
423
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100424 data = &__get_cpu_var(cfd_data);
425 csd_lock(&data->csd);
Jens Axboe3d442232008-06-26 11:21:34 +0200426
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100427 spin_lock_irqsave(&data->lock, flags);
Rusty Russell54b11e62008-12-30 09:05:16 +1030428 if (wait)
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100429 csd_wait_prepare(&data->csd);
430
Jens Axboe3d442232008-06-26 11:21:34 +0200431 data->csd.func = func;
432 data->csd.info = info;
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100433 cpumask_and(data->cpumask, mask, cpu_online_mask);
434 cpumask_clear_cpu(me, data->cpumask);
435 data->refs = cpumask_weight(data->cpumask);
Jens Axboe3d442232008-06-26 11:21:34 +0200436
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100437 spin_lock(&call_function.lock);
438 /*
439 * Place entry at the _HEAD_ of the list, so that any cpu still
440 * observing the entry in generic_smp_call_function_interrupt() will
441 * not miss any other list entries.
442 */
443 list_add_rcu(&data->csd.list, &call_function.queue);
444 spin_unlock(&call_function.lock);
445 spin_unlock_irqrestore(&data->lock, flags);
Jens Axboe3d442232008-06-26 11:21:34 +0200446
Suresh Siddha561920a02008-10-30 18:28:41 +0100447 /*
448 * Make the list addition visible before sending the ipi.
Nick Piggin15d0d3b2009-02-25 06:22:45 +0100449 * (IPIs must obey or appear to obey normal Linux cache coherency
450 * rules -- see comment in generic_exec_single).
Suresh Siddha561920a02008-10-30 18:28:41 +0100451 */
452 smp_mb();
453
Jens Axboe3d442232008-06-26 11:21:34 +0200454 /* Send a message to all CPUs in the map */
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100455 arch_send_call_function_ipi_mask(data->cpumask);
Jens Axboe3d442232008-06-26 11:21:34 +0200456
457 /* optionally wait for the CPUs to complete */
Rusty Russell54b11e62008-12-30 09:05:16 +1030458 if (wait)
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100459 csd_wait(&data->csd);
Jens Axboe3d442232008-06-26 11:21:34 +0200460}
Rusty Russell54b11e62008-12-30 09:05:16 +1030461EXPORT_SYMBOL(smp_call_function_many);
Jens Axboe3d442232008-06-26 11:21:34 +0200462
463/**
464 * smp_call_function(): Run a function on all other CPUs.
465 * @func: The function to run. This must be fast and non-blocking.
466 * @info: An arbitrary pointer to pass to the function.
Jens Axboe3d442232008-06-26 11:21:34 +0200467 * @wait: If true, wait (atomically) until function has completed on other CPUs.
468 *
Rusty Russell54b11e62008-12-30 09:05:16 +1030469 * Returns 0.
Jens Axboe3d442232008-06-26 11:21:34 +0200470 *
471 * If @wait is true, then returns once @func has returned; otherwise
472 * it returns just before the target cpu calls @func. In case of allocation
473 * failure, @wait will be implicitly turned on.
474 *
475 * You must not call this function with disabled interrupts or from a
476 * hardware interrupt handler or from a bottom half handler.
477 */
Jens Axboe8691e5a2008-06-06 11:18:06 +0200478int smp_call_function(void (*func)(void *), void *info, int wait)
Jens Axboe3d442232008-06-26 11:21:34 +0200479{
Jens Axboe3d442232008-06-26 11:21:34 +0200480 preempt_disable();
Rusty Russell54b11e62008-12-30 09:05:16 +1030481 smp_call_function_many(cpu_online_mask, func, info, wait);
Jens Axboe3d442232008-06-26 11:21:34 +0200482 preempt_enable();
Rusty Russell54b11e62008-12-30 09:05:16 +1030483 return 0;
Jens Axboe3d442232008-06-26 11:21:34 +0200484}
485EXPORT_SYMBOL(smp_call_function);
486
487void ipi_call_lock(void)
488{
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100489 spin_lock(&call_function.lock);
Jens Axboe3d442232008-06-26 11:21:34 +0200490}
491
492void ipi_call_unlock(void)
493{
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100494 spin_unlock(&call_function.lock);
Jens Axboe3d442232008-06-26 11:21:34 +0200495}
496
497void ipi_call_lock_irq(void)
498{
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100499 spin_lock_irq(&call_function.lock);
Jens Axboe3d442232008-06-26 11:21:34 +0200500}
501
502void ipi_call_unlock_irq(void)
503{
Peter Zijlstra8969a5e2009-02-25 13:59:47 +0100504 spin_unlock_irq(&call_function.lock);
Jens Axboe3d442232008-06-26 11:21:34 +0200505}