arch/x86/xen/smp_pv.c
Source file repositories/reference/linux-study-clean/arch/x86/xen/smp_pv.c
File Facts
- System
- Linux kernel
- Corpus path
arch/x86/xen/smp_pv.c- Extension
.c- Size
- 10815 bytes
- Lines
- 455
- Domain
- Architecture Layer
- Bucket
- arch/x86
- Inferred role
- Architecture Layer: implementation source
- Status
- source implementation candidate
Why This File Exists
CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/sched.hlinux/sched/task_stack.hlinux/err.hlinux/slab.hlinux/smp.hlinux/irq_work.hlinux/tick.hlinux/nmi.hlinux/cpuhotplug.hlinux/stackprotector.hlinux/pgtable.hasm/paravirt.hasm/idtentry.hasm/desc.hasm/cpu.hasm/apic.hasm/io_apic.hxen/interface/xen.hxen/interface/vcpu.hxen/interface/xenpmu.hasm/spec-ctrl.hasm/xen/interface.hasm/xen/hypercall.hxen/xen.hxen/page.hxen/events.hxen/hvc-console.hxen-ops.h
Detected Declarations
function cpu_bringupfunction cpu_bringup_and_idlefunction xen_smp_intr_free_pvfunction xen_smp_intr_init_pvfunction xen_pv_smp_configfunction xen_pv_smp_prepare_boot_cpufunction xen_pv_smp_prepare_cpusfunction cpu_initialize_contextfunction xen_pv_kick_apfunction xen_pv_poll_sync_statefunction xen_pv_cpu_disablefunction xen_pv_cpu_diefunction xen_pv_cleanup_dead_cpufunction xen_pv_cpu_disablefunction xen_pv_cpu_diefunction xen_pv_cleanup_dead_cpufunction xen_pv_play_deadfunction stop_selffunction xen_pv_stop_other_cpusfunction xen_irq_work_interruptfunction xen_smp_count_cpusfunction xen_smp_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Xen SMP support
*
* This file implements the Xen versions of smp_ops. SMP under Xen is
* very straightforward. Bringing a CPU up is simply a matter of
* loading its initial context and setting it running.
*
* IPIs are handled through the Xen event mechanism.
*
* Because virtual CPUs can be scheduled onto any real CPU, there's no
* useful topology information for the kernel to make use of. As a
* result, all CPUs are treated as if they're single-core and
* single-threaded.
*/
#include <linux/sched.h>
#include <linux/sched/task_stack.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/smp.h>
#include <linux/irq_work.h>
#include <linux/tick.h>
#include <linux/nmi.h>
#include <linux/cpuhotplug.h>
#include <linux/stackprotector.h>
#include <linux/pgtable.h>
#include <asm/paravirt.h>
#include <asm/idtentry.h>
#include <asm/desc.h>
#include <asm/cpu.h>
#include <asm/apic.h>
#include <asm/io_apic.h>
#include <xen/interface/xen.h>
#include <xen/interface/vcpu.h>
#include <xen/interface/xenpmu.h>
#include <asm/spec-ctrl.h>
#include <asm/xen/interface.h>
#include <asm/xen/hypercall.h>
#include <xen/xen.h>
#include <xen/page.h>
#include <xen/events.h>
#include <xen/hvc-console.h>
#include "xen-ops.h"
cpumask_var_t xen_cpu_initialized_map;
static DEFINE_PER_CPU(struct xen_common_irq, xen_irq_work) = { .irq = -1 };
static DEFINE_PER_CPU(struct xen_common_irq, xen_pmu_irq) = { .irq = -1 };
static irqreturn_t xen_irq_work_interrupt(int irq, void *dev_id);
static void cpu_bringup(void)
{
int cpu;
cr4_init();
cpuhp_ap_sync_alive();
cpu_init();
fpu__init_cpu();
touch_softlockup_watchdog();
/* PVH runs in ring 0 and allows us to do native syscalls. Yay! */
if (!xen_feature(XENFEAT_supervisor_mode_kernel))
xen_enable_syscall();
cpu = smp_processor_id();
identify_secondary_cpu(cpu);
set_cpu_sibling_map(cpu);
speculative_store_bypass_ht_init();
xen_setup_cpu_clockevents();
notify_cpu_starting(cpu);
set_cpu_online(cpu, true);
smp_mb();
/* We can take interrupts now: we're officially "up". */
local_irq_enable();
}
asmlinkage __visible void cpu_bringup_and_idle(void)
{
Annotation
- Immediate include surface: `linux/sched.h`, `linux/sched/task_stack.h`, `linux/err.h`, `linux/slab.h`, `linux/smp.h`, `linux/irq_work.h`, `linux/tick.h`, `linux/nmi.h`.
- Detected declarations: `function cpu_bringup`, `function cpu_bringup_and_idle`, `function xen_smp_intr_free_pv`, `function xen_smp_intr_init_pv`, `function xen_pv_smp_config`, `function xen_pv_smp_prepare_boot_cpu`, `function xen_pv_smp_prepare_cpus`, `function cpu_initialize_context`, `function xen_pv_kick_ap`, `function xen_pv_poll_sync_state`.
- Atlas domain: Architecture Layer / arch/x86.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.