Re: [for-linus][PATCH 1/3] eventfs: Have the inodes all for files and directories all be the same

From: Steven Rostedt
Date: Thu Jan 25 2024 - 13:07:38 EST


On Thu, 25 Jan 2024 18:40:31 +0100
Christian Brauner <brauner@xxxxxxxxxx> wrote:

> But luckily no one is probably going to tar up tracefs. ;)

Actually, inodes isn't the biggest issue of tar, as tar *is* a common
operation on tracefs.

If you want to create a synthetic event using the sqlhist tool for an
embedded board, we recommend copying the tracefs directory over to your
workstation from the embedded device. Unfortunately tar never works. That's
because all tracefs (and debugfs) files have zero size in stat().

# cd /tmp
# (cd /sys/kernel && tar cvf - tracing) | tar xvf -
# ls -s tracing
total 28
0 available_events 0 max_graph_depth 0 stack_trace
0 available_filter_functions 4 options 0 stack_trace_filter
0 available_filter_functions_addrs 4 osnoise 0 synthetic_events
0 available_tracers 4 per_cpu 0 timestamp_mode
0 buffer_percent 0 printk_formats 0 touched_functions
0 buffer_size_kb 0 README 0 trace
0 buffer_subbuf_size_kb 0 recursed_functions 0 trace_clock
0 buffer_total_size_kb 0 saved_cmdlines 0 trace_marker
0 current_tracer 0 saved_cmdlines_size 0 trace_marker_raw
0 dynamic_events 0 saved_tgids 0 trace_options
0 dyn_ftrace_total_info 0 set_event 0 trace_pipe
0 enabled_functions 0 set_event_notrace_pid 4 trace_stat
0 error_log 0 set_event_pid 0 tracing_cpumask
0 eval_map 0 set_ftrace_filter 0 tracing_max_latency
4 events 0 set_ftrace_notrace 0 tracing_on
0 free_buffer 0 set_ftrace_notrace_pid 0 tracing_thresh
0 function_profile_enabled 0 set_ftrace_pid 0 uprobe_events
4 hwlat_detector 0 set_graph_function 0 uprobe_profile
4 instances 0 set_graph_notrace 0 user_events_data
0 kprobe_events 0 snapshot 0 user_events_status
0 kprobe_profile 0 stack_max_size

So instead we have been recommending cp -r

Note, for the sqlhist command, only the events are needed, so the
instructions is only to copy the events directory, because copying all of
tracefs will try to copy the "trace_pipe" file which will block which hangs
'cp'. And I don't know an option to tell the cp command not to block.

# cd /tmp
# mkdir tracing
# cp -r /sys/kernel/tracing/events tracing/events
# ls -s tracing/events/sched/sched_switch/
total 20
4 enable 4 filter 4 format 0 hist 0 hist_debug 4 id 0 inject 4 trigger

Where the tar would have had:

# ls -s tracing/events/sched/sched_switch/
total 0
0 enable 0 filter 0 format 0 hist 0 hist_debug 0 id 0 inject 0 trigger


-- Steve