kernel/trace/trace_output.c
Source file repositories/reference/linux-study-clean/kernel/trace/trace_output.c
File Facts
- System
- Linux kernel
- Corpus path
kernel/trace/trace_output.c- Extension
.c- Size
- 45579 bytes
- Lines
- 1935
- Domain
- Core OS
- Bucket
- Scheduler, Processes, Timers, Sync, And Syscalls
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
trace.hlinux/module.hlinux/mutex.hlinux/ftrace.hlinux/kprobes.hlinux/sched/clock.hlinux/sched/mm.hlinux/idr.hlinux/btf.hlinux/bpf.hlinux/hashtable.htrace_output.htrace_btf.h
Detected Declarations
function trace_print_bputs_msg_onlyfunction trace_print_bprintk_msg_onlyfunction trace_print_printk_msg_onlyfunction trace_print_flags_seqfunction trace_print_symbols_seqfunction trace_print_flags_seq_u64function trace_print_symbols_seq_u64function trace_print_bitmask_seqfunction trace_print_hex_seqfunction trace_print_array_seqfunction trace_print_hex_dump_seqfunction trace_raw_output_prepfunction trace_event_printffunction __printffunction trace_output_callfunction trace_seq_print_symfunction seq_print_user_ipfunction seq_print_ip_symfunction trace_print_lat_fmtfunction lat_print_genericfunction trace_find_markfunction lat_print_timestampfunction trace_print_timefunction trace_print_contextfunction trace_print_lat_contextfunction print_function_argsfunction trace_event_read_lockfunction hash_for_each_possiblefunction free_trace_event_typefunction alloc_trace_event_typefunction trace_event_read_lockfunction trace_event_read_unlockfunction register_trace_eventfunction __unregister_trace_eventfunction unregister_trace_eventfunction print_arrayfunction print_fieldsfunction list_for_each_entry_reversefunction print_event_fieldsfunction list_for_each_entryfunction trace_nop_printfunction print_fn_tracefunction trace_fn_tracefunction trace_fn_rawfunction trace_fn_hexfunction trace_fn_binfunction trace_ctxwake_printfunction trace_ctx_print
Annotated Snippet
switch (el_size) {
case 1:
trace_seq_printf(p, "%s0x%x", prefix,
*(u8 *)ptr);
break;
case 2:
trace_seq_printf(p, "%s0x%x", prefix,
*(u16 *)ptr);
break;
case 4:
trace_seq_printf(p, "%s0x%x", prefix,
*(u32 *)ptr);
break;
case 8:
trace_seq_printf(p, "%s0x%llx", prefix,
*(u64 *)ptr);
break;
default:
trace_seq_printf(p, "BAD SIZE:%zu 0x%x", el_size,
*(u8 *)ptr);
el_size = 1;
}
prefix = ",";
ptr += el_size;
}
trace_seq_putc(p, '}');
trace_seq_putc(p, 0);
return ret;
}
EXPORT_SYMBOL(trace_print_array_seq);
const char *
trace_print_hex_dump_seq(struct trace_seq *p, const char *prefix_str,
int prefix_type, int rowsize, int groupsize,
const void *buf, size_t len, bool ascii)
{
const char *ret = trace_seq_buffer_ptr(p);
trace_seq_putc(p, '\n');
trace_seq_hex_dump(p, prefix_str, prefix_type,
rowsize, groupsize, buf, len, ascii);
trace_seq_putc(p, 0);
return ret;
}
EXPORT_SYMBOL(trace_print_hex_dump_seq);
int trace_raw_output_prep(struct trace_iterator *iter,
struct trace_event *trace_event)
{
struct trace_event_call *event;
struct trace_seq *s = &iter->seq;
struct trace_seq *p = &iter->tmp_seq;
struct trace_entry *entry;
event = container_of(trace_event, struct trace_event_call, event);
entry = iter->ent;
if (entry->type != event->event.type) {
WARN_ON_ONCE(1);
return TRACE_TYPE_UNHANDLED;
}
trace_seq_init(p);
trace_seq_printf(s, "%s: ", trace_event_name(event));
return trace_handle_return(s);
}
EXPORT_SYMBOL(trace_raw_output_prep);
void trace_event_printf(struct trace_iterator *iter, const char *fmt, ...)
{
struct trace_seq *s = &iter->seq;
va_list ap;
if (ignore_event(iter))
return;
va_start(ap, fmt);
trace_seq_vprintf(s, trace_event_format(iter, fmt), ap);
va_end(ap);
}
EXPORT_SYMBOL(trace_event_printf);
static __printf(3, 0)
int trace_output_raw(struct trace_iterator *iter, char *name,
char *fmt, va_list ap)
{
struct trace_seq *s = &iter->seq;
Annotation
- Immediate include surface: `trace.h`, `linux/module.h`, `linux/mutex.h`, `linux/ftrace.h`, `linux/kprobes.h`, `linux/sched/clock.h`, `linux/sched/mm.h`, `linux/idr.h`.
- Detected declarations: `function trace_print_bputs_msg_only`, `function trace_print_bprintk_msg_only`, `function trace_print_printk_msg_only`, `function trace_print_flags_seq`, `function trace_print_symbols_seq`, `function trace_print_flags_seq_u64`, `function trace_print_symbols_seq_u64`, `function trace_print_bitmask_seq`, `function trace_print_hex_seq`, `function trace_print_array_seq`.
- Atlas domain: Core OS / Scheduler, Processes, Timers, Sync, And Syscalls.
- Implementation status: integration 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.