arch/csky/kernel/smp.c
Source file repositories/reference/linux-study-clean/arch/csky/kernel/smp.c
File Facts
- System
- Linux kernel
- Corpus path
arch/csky/kernel/smp.c- Extension
.c- Size
- 6095 bytes
- Lines
- 316
- Domain
- Architecture Layer
- Bucket
- arch/csky
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/init.hlinux/kernel.hlinux/mm.hlinux/sched.hlinux/kernel_stat.hlinux/notifier.hlinux/cpu.hlinux/percpu.hlinux/delay.hlinux/err.hlinux/irq.hlinux/irq_work.hlinux/irqdomain.hlinux/of.hlinux/seq_file.hlinux/sched/task_stack.hlinux/sched/mm.hlinux/sched/hotplug.hasm/irq.hasm/traps.hasm/sections.hasm/mmu_context.habi/fpu.h
Detected Declarations
struct ipi_data_structenum ipi_message_typefunction handle_ipifunction set_send_ipifunction send_ipi_messagefunction arch_show_interruptsfunction arch_send_call_function_ipi_maskfunction arch_send_call_function_single_ipifunction ipi_stopfunction smp_send_stopfunction arch_smp_send_reschedulefunction arch_irq_work_raisefunction smp_prepare_cpusfunction setup_smp_ipifunction setup_smpfunction for_each_of_cpu_nodefunction __cpu_upfunction smp_cpus_donefunction __cpu_disablefunction arch_cpuhp_cleanup_dead_cpufunction arch_cpu_idle_dead
Annotated Snippet
struct ipi_data_struct {
unsigned long bits ____cacheline_aligned;
unsigned long stats[IPI_MAX] ____cacheline_aligned;
};
static DEFINE_PER_CPU(struct ipi_data_struct, ipi_data);
static irqreturn_t handle_ipi(int irq, void *dev)
{
unsigned long *stats = this_cpu_ptr(&ipi_data)->stats;
while (true) {
unsigned long ops;
ops = xchg(&this_cpu_ptr(&ipi_data)->bits, 0);
if (ops == 0)
return IRQ_HANDLED;
if (ops & (1 << IPI_RESCHEDULE)) {
stats[IPI_RESCHEDULE]++;
scheduler_ipi();
}
if (ops & (1 << IPI_CALL_FUNC)) {
stats[IPI_CALL_FUNC]++;
generic_smp_call_function_interrupt();
}
if (ops & (1 << IPI_IRQ_WORK)) {
stats[IPI_IRQ_WORK]++;
irq_work_run();
}
BUG_ON((ops >> IPI_MAX) != 0);
}
return IRQ_HANDLED;
}
static void (*send_arch_ipi)(const struct cpumask *mask);
static int ipi_irq;
void __init set_send_ipi(void (*func)(const struct cpumask *mask), int irq)
{
if (send_arch_ipi)
return;
send_arch_ipi = func;
ipi_irq = irq;
}
static void
send_ipi_message(const struct cpumask *to_whom, enum ipi_message_type operation)
{
int i;
for_each_cpu(i, to_whom)
set_bit(operation, &per_cpu_ptr(&ipi_data, i)->bits);
smp_mb();
send_arch_ipi(to_whom);
}
static const char * const ipi_names[] = {
[IPI_EMPTY] = "Empty interrupts",
[IPI_RESCHEDULE] = "Rescheduling interrupts",
[IPI_CALL_FUNC] = "Function call interrupts",
[IPI_IRQ_WORK] = "Irq work interrupts",
};
int arch_show_interrupts(struct seq_file *p, int prec)
{
unsigned int cpu, i;
for (i = 0; i < IPI_MAX; i++) {
seq_printf(p, "%*s%u:%s", prec - 1, "IPI", i,
prec >= 4 ? " " : "");
for_each_online_cpu(cpu)
seq_printf(p, "%10lu ",
per_cpu_ptr(&ipi_data, cpu)->stats[i]);
seq_printf(p, " %s\n", ipi_names[i]);
}
return 0;
}
void arch_send_call_function_ipi_mask(struct cpumask *mask)
{
send_ipi_message(mask, IPI_CALL_FUNC);
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/kernel.h`, `linux/mm.h`, `linux/sched.h`, `linux/kernel_stat.h`, `linux/notifier.h`, `linux/cpu.h`.
- Detected declarations: `struct ipi_data_struct`, `enum ipi_message_type`, `function handle_ipi`, `function set_send_ipi`, `function send_ipi_message`, `function arch_show_interrupts`, `function arch_send_call_function_ipi_mask`, `function arch_send_call_function_single_ipi`, `function ipi_stop`, `function smp_send_stop`.
- Atlas domain: Architecture Layer / arch/csky.
- 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.