CPU_XCALL(9)

NAME
cpu_xcall_set, cpu_xcall, cpu_xcall_sync, XCALL_INITIALIZER - CPU crosscall API

SYNOPSIS
#include <sys/xcall.h>
void
cpu_xcall_set(struct xcall *xc, void (*func)(void *), void *arg);
void
cpu_xcall(struct cpu_info *ci, struct xcall *xc);
void
cpu_xcall_sync(struct cpu_info *ci, void (*func)(void *), void *arg, const char *wmesg);
XCALL_INITIALIZER(void (*func)(void *), void *arg);

DESCRIPTION
The CPU crosscall API supports the dispatch of function execution to a specific CPU in the kernel. The functions are run in a software interrupt context at IPL_SOFTCLOCK.

The cpu_xcall_set() function prepares the xcall structure xc to call the function func with argument arg via future calls to cpu_xcall().

cpu_xcall() dispatches a call to a function with an argument represented by xc on the CPU specified by the ci cpu_info structure. The same xc may be scheduled for execution on multiple CPUs concurrently.

cpu_xcall_sync() dispatches a call to the function func with argument arg on the CPU specified by the ci cpu_info structure, and waits for that function to complete. cpu_xcall_sync() may sleep waiting for the call to func to complete with wmesg as the wait message.

XCALL_INITIALIZER() initialises an xcall structure to call the function func with argument arg via future calls to cpu_xcall().

CONTEXT
cpu_xcall_set() and cpu_xcall() can be called from process context or from interrupt context.

cpu_xcall_sync() can be called from process context.

SEE ALSO
spl(9), tsleep(9)

HISTORY
The cpu_xcall_set functions first appeared in OpenBSD 7.8.

AUTHORS
The cpu_xcall_set functions were written by David Gwynne <dlg@openbsd.org>.