Bug 219302

Summary: Question about trace-cmd reset
Product: Tracing/Profiling Reporter: Metin Kaya (metin.kaya)
Component: FtraceAssignee: Steven Rostedt (rostedt)
Status: RESOLVED CODE_FIX    
Severity: normal CC: metin.kaya
Priority: P3    
Hardware: All   
OS: Linux   
Kernel Version: Subsystem:
Regression: No Bisected commit-id:

Description Metin Kaya 2024-09-23 12:06:24 UTC
Hello,

Running "trace-cmd reset" command destroys existing kprobe events:

```
# echo 'p do_sys_open' > /sys/kernel/tracing/kprobe_events
# echo 1 > /sys/kernel/tracing/events/kprobes/p_do_sys_open_0/enable
# cat /sys/kernel/tracing/kprobe_events
p:kprobes/p_do_sys_open_0 do_sys_open
# trace-cmd reset
# cat /sys/kernel/tracing/kprobe_events
#
```

I wonder if introducing a new flag to preserve kprobe events during the reset operation would make sense at all.

Thanks,
Comment 1 Steven Rostedt 2024-09-26 09:51:19 UTC
Yes it does make sense.

I'm open to taking patches that add options to trace-cmd reset that limit what it does. We should update libtracecmd's reset option too.
Comment 2 Metin Kaya 2024-09-26 10:18:17 UTC
Gotcha. Will send patch(es).
Thank you!
Comment 3 Metin Kaya 2024-10-09 15:40:56 UTC
> We should update libtracecmd's reset option too.

Hi Steven,

Could you please share a pointer about reset option in libtracecmd?

I implemented necessary changes, but only needed to modify clear_all_dynamic_events() and trace_reset() functions in trace-record.c.

Thanks,
Comment 4 Metin Kaya 2024-10-10 08:56:17 UTC
Just for the records: posted these patches on the mailing list [1].

[1] https://lore.kernel.org/linux-trace-devel/20241010085350.3479149-1-metin.kaya@arm.com/T/#t
Comment 5 Metin Kaya 2024-10-15 08:39:08 UTC
v2 [1] of the patch set is merged. Resolving the ticket.

[1] https://lore.kernel.org/linux-trace-devel/20241014123136.3890807-1-metin.kaya@arm.com/#t