CPU_XCALL(9) Kernel Developer's Manual CPU_XCALL(9)

cpu_xcall_set, cpu_xcall, cpu_xcall_sync, XCALL_INITIALIZERCPU crosscall API

#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);

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 () function prepares the xcall structure xc to call the function func with argument arg via future calls to 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.

() 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.

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

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.

spl(9), tsleep(9)

The cpu_xcall_set functions first appeared in OpenBSD 7.8.

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

OpenBSD 7.8 July 13, 2025 CPU_XCALL(9)