arch/sh/kernel/smp.c
Source file repositories/reference/linux-study-clean/arch/sh/kernel/smp.c
File Facts
- System
- Linux kernel
- Corpus path
arch/sh/kernel/smp.c- Extension
.c- Size
- 9751 bytes
- Lines
- 476
- Domain
- Architecture Layer
- Bucket
- arch/sh
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/err.hlinux/cache.hlinux/cpumask.hlinux/delay.hlinux/init.hlinux/spinlock.hlinux/mm.hlinux/module.hlinux/cpu.hlinux/interrupt.hlinux/sched/mm.hlinux/sched/hotplug.hlinux/atomic.hlinux/clockchips.hlinux/profile.hasm/processor.hasm/mmu_context.hasm/smp.hasm/cacheflush.hasm/sections.hasm/setup.h
Detected Declarations
struct flush_tlb_datafunction register_smp_opsfunction smp_store_cpu_infofunction smp_prepare_cpusfunction smp_prepare_boot_cpufunction native_cpu_diefunction native_cpu_disablefunction play_dead_commonfunction native_play_deadfunction __cpu_disablefunction native_cpu_disablefunction native_cpu_diefunction native_play_deadfunction start_secondaryfunction __cpu_upfunction smp_cpus_donefunction arch_smp_send_reschedulefunction smp_send_stopfunction arch_send_call_function_ipi_maskfunction arch_send_call_function_single_ipifunction tick_broadcastfunction ipi_timerfunction smp_message_recvfunction setup_profiling_timerfunction flush_tlb_all_ipifunction flush_tlb_allfunction flush_tlb_mm_ipifunction cpufunction flush_tlb_range_ipifunction flush_tlb_rangefunction flush_tlb_kernel_range_ipifunction flush_tlb_kernel_rangefunction flush_tlb_page_ipifunction flush_tlb_pagefunction flush_tlb_one_ipifunction flush_tlb_one
Annotated Snippet
struct flush_tlb_data {
struct vm_area_struct *vma;
unsigned long addr1;
unsigned long addr2;
};
static void flush_tlb_range_ipi(void *info)
{
struct flush_tlb_data *fd = (struct flush_tlb_data *)info;
local_flush_tlb_range(fd->vma, fd->addr1, fd->addr2);
}
void flush_tlb_range(struct vm_area_struct *vma,
unsigned long start, unsigned long end)
{
struct mm_struct *mm = vma->vm_mm;
preempt_disable();
if ((atomic_read(&mm->mm_users) != 1) || (current->mm != mm)) {
struct flush_tlb_data fd;
fd.vma = vma;
fd.addr1 = start;
fd.addr2 = end;
smp_call_function(flush_tlb_range_ipi, (void *)&fd, 1);
} else {
int i;
for_each_online_cpu(i)
if (smp_processor_id() != i)
cpu_context(i, mm) = 0;
}
local_flush_tlb_range(vma, start, end);
preempt_enable();
}
static void flush_tlb_kernel_range_ipi(void *info)
{
struct flush_tlb_data *fd = (struct flush_tlb_data *)info;
local_flush_tlb_kernel_range(fd->addr1, fd->addr2);
}
void flush_tlb_kernel_range(unsigned long start, unsigned long end)
{
struct flush_tlb_data fd;
fd.addr1 = start;
fd.addr2 = end;
on_each_cpu(flush_tlb_kernel_range_ipi, (void *)&fd, 1);
}
static void flush_tlb_page_ipi(void *info)
{
struct flush_tlb_data *fd = (struct flush_tlb_data *)info;
local_flush_tlb_page(fd->vma, fd->addr1);
}
void flush_tlb_page(struct vm_area_struct *vma, unsigned long page)
{
preempt_disable();
if ((atomic_read(&vma->vm_mm->mm_users) != 1) ||
(current->mm != vma->vm_mm)) {
struct flush_tlb_data fd;
fd.vma = vma;
fd.addr1 = page;
smp_call_function(flush_tlb_page_ipi, (void *)&fd, 1);
} else {
int i;
for_each_online_cpu(i)
if (smp_processor_id() != i)
cpu_context(i, vma->vm_mm) = 0;
}
local_flush_tlb_page(vma, page);
preempt_enable();
}
static void flush_tlb_one_ipi(void *info)
{
struct flush_tlb_data *fd = (struct flush_tlb_data *)info;
local_flush_tlb_one(fd->addr1, fd->addr2);
}
void flush_tlb_one(unsigned long asid, unsigned long vaddr)
{
struct flush_tlb_data fd;
fd.addr1 = asid;
Annotation
- Immediate include surface: `linux/err.h`, `linux/cache.h`, `linux/cpumask.h`, `linux/delay.h`, `linux/init.h`, `linux/spinlock.h`, `linux/mm.h`, `linux/module.h`.
- Detected declarations: `struct flush_tlb_data`, `function register_smp_ops`, `function smp_store_cpu_info`, `function smp_prepare_cpus`, `function smp_prepare_boot_cpu`, `function native_cpu_die`, `function native_cpu_disable`, `function play_dead_common`, `function native_play_dead`, `function __cpu_disable`.
- Atlas domain: Architecture Layer / arch/sh.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.