arch/xtensa/kernel/process.c
Source file repositories/reference/linux-study-clean/arch/xtensa/kernel/process.c
File Facts
- System
- Linux kernel
- Corpus path
arch/xtensa/kernel/process.c- Extension
.c- Size
- 10976 bytes
- Lines
- 401
- Domain
- Architecture Layer
- Bucket
- arch/xtensa
- Inferred role
- Architecture Layer: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/errno.hlinux/sched.hlinux/sched/debug.hlinux/sched/task.hlinux/sched/task_stack.hlinux/kernel.hlinux/mm.hlinux/smp.hlinux/stddef.hlinux/unistd.hlinux/ptrace.hlinux/elf.hlinux/hw_breakpoint.hlinux/init.hlinux/prctl.hlinux/init_task.hlinux/module.hlinux/mqueue.hlinux/fs.hlinux/slab.hlinux/rcupdate.hlinux/uaccess.hasm/io.hasm/processor.hasm/platform.hasm/mmu.hasm/irq.hlinux/atomic.hasm/asm-offsets.hasm/regs.hasm/hw_breakpoint.hasm/sections.h
Detected Declarations
function local_coprocessors_flush_release_allfunction local_coprocessor_release_allfunction coprocessor_release_allfunction local_coprocessor_flush_allfunction coprocessor_flush_allfunction local_coprocessor_flush_release_allfunction coprocessor_flush_release_allfunction arch_cpu_idlefunction exitfunction flush_threadfunction arch_dup_task_structfunction regsfunction __get_wchanexport pm_power_offexport __stack_chk_guard
Annotated Snippet
if (ti) {
coprocessor_flush(ti, i);
for (j = 0; j < n; j++)
if (unique_owner[j] == ti)
break;
if (j == n)
unique_owner[n++] = ti;
coprocessor_owner[i] = NULL;
}
}
for (i = 0; i < n; i++) {
/* pairs with memw (1) in fast_coprocessor and memw in switch_to */
smp_wmb();
unique_owner[i]->cpenable = 0;
}
xtensa_set_sr(0, cpenable);
}
static void local_coprocessor_release_all(void *info)
{
struct thread_info *ti = info;
struct thread_info **coprocessor_owner;
int i;
coprocessor_owner = this_cpu_ptr(&exc_table)->coprocessor_owner;
/* Walk through all cp owners and release it for the requested one. */
for (i = 0; i < XCHAL_CP_MAX; i++) {
if (coprocessor_owner[i] == ti)
coprocessor_owner[i] = NULL;
}
/* pairs with memw (1) in fast_coprocessor and memw in switch_to */
smp_wmb();
ti->cpenable = 0;
if (ti == current_thread_info())
xtensa_set_sr(0, cpenable);
}
void coprocessor_release_all(struct thread_info *ti)
{
if (ti->cpenable) {
/* pairs with memw (2) in fast_coprocessor */
smp_rmb();
smp_call_function_single(ti->cp_owner_cpu,
local_coprocessor_release_all,
ti, true);
}
}
static void local_coprocessor_flush_all(void *info)
{
struct thread_info *ti = info;
struct thread_info **coprocessor_owner;
unsigned long old_cpenable;
int i;
coprocessor_owner = this_cpu_ptr(&exc_table)->coprocessor_owner;
old_cpenable = xtensa_xsr(ti->cpenable, cpenable);
for (i = 0; i < XCHAL_CP_MAX; i++) {
if (coprocessor_owner[i] == ti)
coprocessor_flush(ti, i);
}
xtensa_set_sr(old_cpenable, cpenable);
}
void coprocessor_flush_all(struct thread_info *ti)
{
if (ti->cpenable) {
/* pairs with memw (2) in fast_coprocessor */
smp_rmb();
smp_call_function_single(ti->cp_owner_cpu,
local_coprocessor_flush_all,
ti, true);
}
}
static void local_coprocessor_flush_release_all(void *info)
{
local_coprocessor_flush_all(info);
local_coprocessor_release_all(info);
}
void coprocessor_flush_release_all(struct thread_info *ti)
{
if (ti->cpenable) {
/* pairs with memw (2) in fast_coprocessor */
Annotation
- Immediate include surface: `linux/errno.h`, `linux/sched.h`, `linux/sched/debug.h`, `linux/sched/task.h`, `linux/sched/task_stack.h`, `linux/kernel.h`, `linux/mm.h`, `linux/smp.h`.
- Detected declarations: `function local_coprocessors_flush_release_all`, `function local_coprocessor_release_all`, `function coprocessor_release_all`, `function local_coprocessor_flush_all`, `function coprocessor_flush_all`, `function local_coprocessor_flush_release_all`, `function coprocessor_flush_release_all`, `function arch_cpu_idle`, `function exit`, `function flush_thread`.
- Atlas domain: Architecture Layer / arch/xtensa.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
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.