Skip to main content

Module percpu

Module percpu 

Source
Expand description

Per-CPU data (x86_64)

Minimal per-CPU tracking for SMP bring-up. This keeps CPU identity, online state, and per-CPU kernel stack top pointers.

Structs§

PerCpu
Per-CPU state.
PerCpuArch
Minimal per-CPU block accessed from assembly via GS base.

Constants§

KERNEL_RSP_OFFSET
MAX_CPUS
Maximum number of CPUs supported for now.
USER_RSP_OFFSET
Offsets used by the SYSCALL entry (must match PerCpuArch layout). Note: cpu_index is at offset 0 (8 bytes).

Functions§

apic_id_by_cpu_index
Get the APIC ID for a given CPU index, or None if not present.
cpu_count
Get the total number of CPUs that have been registered.
cpu_index_by_apic
Find a CPU index by APIC ID.
cpu_index_from_gs
Resolve current CPU index from GS base (compatibility).
current_cpu_index
Resolve current CPU index via a GS-relative load from offset 0.
current_cpu_index_fast
Alias for current_cpu_index.
get_cpu_count
Get the total number of CPUs (public alias for OSTD compatibility).
init_boot_cpu
Initialize the boot CPU (BSP) entry.
init_gs_base
Initialize GS base for this CPU to point at its per-CPU block.
is_preemptible
Returns true if preemption is currently allowed on this CPU (preempt_count == 0).
kernel_stack_top
Get the per-CPU kernel stack top for the given CPU index.
mark_online_by_apic
Mark a CPU as online by APIC ID.
mark_tlb_ready_current
Mark current CPU as ready to handle TLB shootdown IPIs.
percpu
Access the per-CPU array (read-only).
preempt_disable
Increment the preemption-disable depth for the current CPU. When depth > 0, the scheduler will not preempt this CPU.
preempt_enable
Decrement the preemption-disable depth for the current CPU. Must be paired with exactly one prior call to preempt_disable.
register_cpu
Register a new CPU by APIC ID, returning its CPU index.
set_kernel_rsp_current
Set the per-CPU SYSCALL kernel RSP for the current CPU.
set_kernel_rsp_for_cpu
Set the per-CPU SYSCALL kernel RSP (used by syscall entry).
set_kernel_stack_top
Set the per-CPU kernel stack top for the given CPU index.
tlb_ready
Returns true iff CPU index is online and ready for TLB shootdown.