1 #include <lwk/kernel.h>
6 * Carries out an inter-CPU function call. The specified function is executed
7 * on all of the target CPUs that are currently online and executes in
8 * interrupt context with interrupts disabled... it must not block and should
12 * [IN] cpu_mask: The target CPUs of the cross-call.
13 * [IN] func: The function to execute on each target CPU.
14 * [IN] info: Argument to pass to func().
15 * [IN] wait: true = wait for cross-call to fully complete.
21 * NOTE: If wait=0, care must be taken to ensure that the data pointed to by
22 * the info argument remains valid until the cross-call function func()
23 * completes on all target CPUs.
28 void (*func)(void *info),
36 BUG_ON(irqs_disabled());
39 /* Only target online CPUs */
40 cpus_and(cpu_mask, cpu_mask, cpu_online_map);
42 /* No need to xcall ourself... we'll just call func() directly */
43 if ((contains_me = cpu_isset(this_cpu, cpu_mask)))
44 cpu_clear(this_cpu, cpu_mask);
46 /* Perform xcall to remote CPUs */
47 if ((status = arch_xcall_function(cpu_mask, func, info, wait)))
50 /* Call func() on the local CPU, if it was in cpu_mask */
58 * Sends a reschedule inter-processor interrupt to the target CPU.
59 * This causes the target CPU to call schedule().
61 * NOTE: It is safe to call this with locks held and interrupts
62 * disabled so long as the caller will drop the locks and
63 * re-enable interrupts "soon", independent of whether the
64 * target actually receives the reschedule interrupt.
65 * Deadlock may occur if these conditions aren't met.
68 xcall_reschedule(id_t cpu)
70 arch_xcall_reschedule(cpu);