IPI(9) | Kernel Developer's Manual | IPI(9) |
ipi
—
#include <sys/ipi.h>
typedef void (*ipi_func_t)(void *);
u_int
ipi_register
(ipi_func_t
func, void
*arg);
void
ipi_unregister
(u_int
ipi_id);
void
ipi_trigger
(u_int
ipi_id, struct cpu_info
*ci);
void
ipi_trigger_multi
(u_int
ipi_id, const kcpuset_t
*target);
void
ipi_trigger_broadcast
(u_int
ipi_id, bool
skip_self);
void
ipi_unicast
(ipi_msg_t
*msg, struct cpu_info
*ci);
void
ipi_multicast
(ipi_msg_t
*msg, const kcpuset_t
*target);
void
ipi_broadcast
(ipi_msg_t
*msg, bool
skip_self);
void
ipi_wait
(ipi_msg_t
*msg);
ipi
interface provides
capability to send inter-processor interrupts (IPIs) amongst CPUs. The
interface has two mechanisms: asynchronous IPI to invoke functions with a
constant argument and synchronous IPIs with the cross-call support.
Other synchronization interfaces are built using the MI IPI interface. For a general purpose inter-processor cross-calls or remote interrupts, use the xcall(9) or softint(9) interfaces.
The primary use cases of the MI IPIs include the following:
ipi_register
(func,
arg)ipi_unregister
(ipi_id)ipi_trigger
(ipi_id,
ci)ipi_trigger_multi
(ipi_id,
target)ipi_trigger_broadcast
(ipi_id,
skip_self)true
for skip_self.ipi_func_t func; void arg;
The func member specifies a function to invoke and arg is the argument to be passed to the function.
ipi_unicast
(msg,
ci)ipi_multicast
(msg,
target)ipi_broadcast
(msg,
skip_self)true
for
skip_self.ipi_wait
(msg)All described functions, except
ipi_wait
(), must be called with the kernel
preemption disabled. All synchronous IPI invocations must be completed (wait
for them with the ipi_wait
() function) before the
IPI message structure can be destroyed or new cross-call requests can be
performed.
ipi_trigger
(),
ipi_trigger_multi
(),
ipi_trigger_broadcast
(),
ipi_unicast
(),
ipi_multicast
(), or
ipi_broadcast
(), also happen before any memory
operations in the IPI handler function on the remote CPU.
For synchronous IPIs, all memory operations that happen before the
IPI handler function has returned on the remote CPU also happen before
ipi_wait
() returns on the waiting CPU.
IPL_HIGH
and should generally not use any other
synchronization interfaces such as
mutex(9). If spin-locks are used,
they must be used carefully and have no contention.
ipi
interface is implemented within the file
sys/kern/subr_ipi.c.
ipi
interface first appeared in
NetBSD 7.0.
March 31, 2019 | NetBSD 10.1 |