trace_user_fault_init(9)
π trace_user_fault_init(9)
okay so this is a page straight out of the Kernel API Manual, and bestie, we're about to make it make sense π
β¨ NAME β¨
trace_user_fault_init β literally allocates or references a per CPU buffer. that's the whole vibe π
πΈ SYNOPSIS πΈ
int trace_user_fault_init (struct trace_user_buf_info *tinfo , size_t
size );
π¦ ARGUMENTS π¦
tinfoβ a pointer to the trace buffer descriptor. yes she's a pointer, yes she's iconic πsizeβ the size to allocate for each per CPU buffer. every single one gets this much, no cap π
β DESCRIPTION β
so what this does is create a per CPU buffer β one per CPU, hence the name β and that buffer is the thing you use to copy from user space while you're in a task context. it's giving "dedicated little scratch pad for user data" energy π«Ά
here's the part you actually need to remember, so like, pay attention: when you call trace_user_fault_read, preemption must be disabled. and then what does it do? it enables preemption and copies the user space data into the buffer. main character behaviour honestly.
and if any schedule switches happen along the way? it just retries until it succeeds without a schedule switch, because it knows the buffer is still valid. it's stubborn in the best way ππ₯
returns 0 on success, negative on failure. that's it, that's the contract β¨
lowkey important: preemption disabled before trace_user_fault_read, always. don't skip that step bestie, i'm begging π
π SEE ALSO π
kernel file ./kernel/trace/trace.c, plus the whole friend group:
trace_array_put(9)tracing_is_enabled(9)tracing_on(9)tracing_snapshot(9)tracing_alloc_snapshot(9)tracer_tracing_disable(9)tracer_tracing_enable(9)tracing_off(9)tracer_tracing_is_on(9)tracing_is_on(9)register_tracer(9)tracing_start(9)tracing_stop(9)trace_buffered_event_enable(9)trace_buffered_event_disable(9)trace_dump_stack(9)ignore_event(9)trace_adjust_address(9)tracing_update_buffers(9)trace_user_fault_destroy(9)trace_user_fault_get(9)trace_user_fault_put(9)trace_user_fault_read(9)err_pos(9)tracing_log_err(9)trace_array_get_by_name(9)tracing_init_dentry(9)
okay that's the whole page, you ate that π this came out of ./kernel/trace and it's dated October 2026 β go off, future kernel docs πβ¨π
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms