Message ID | 20220309054458.636350-1-tz.stoyanov@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Commit | aaa70ba278d91ec8d686d11c354a29df4ca0b678 |
Headers | show |
Series | trace-cmd: Use the new libtracefs API to address all dynamic events | expand |
On Wed, 9 Mar 2022 07:44:58 +0200 "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com> wrote: > The trace-cmd reset logic clears all dynamically created ftrace events. > The current implementation lists all events that should be cleared. > That logic is fragile, as when a new type of dynamic event is > introduced the logic should be updated. Instead, the newly introduced > libtracefs define should be used: TRACEFS_DYNEVENT_ALL. > > Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> Applied, thanks Tzvetomir! -- Steve > --- > tracecmd/trace-record.c | 7 +------ > 1 file changed, 1 insertion(+), 6 deletions(-) > > diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c > index 9afc1042..8d9cbac2 100644 > --- a/tracecmd/trace-record.c > +++ b/tracecmd/trace-record.c > @@ -5262,12 +5262,7 @@ static void clear_all_dynamic_events(void) > { > /* Clear event probes first, as they may be attached to other dynamic event */ > tracefs_dynevent_destroy_all(TRACEFS_DYNEVENT_EPROBE, true); > - tracefs_dynevent_destroy_all(TRACEFS_DYNEVENT_KPROBE | > - TRACEFS_DYNEVENT_KRETPROBE | > - TRACEFS_DYNEVENT_UPROBE | > - TRACEFS_DYNEVENT_URETPROBE | > - TRACEFS_DYNEVENT_SYNTH, > - true); > + tracefs_dynevent_destroy_all(TRACEFS_DYNEVENT_ALL, true); > } > > static void clear_func_filters(void)
diff --git a/tracecmd/trace-record.c b/tracecmd/trace-record.c index 9afc1042..8d9cbac2 100644 --- a/tracecmd/trace-record.c +++ b/tracecmd/trace-record.c @@ -5262,12 +5262,7 @@ static void clear_all_dynamic_events(void) { /* Clear event probes first, as they may be attached to other dynamic event */ tracefs_dynevent_destroy_all(TRACEFS_DYNEVENT_EPROBE, true); - tracefs_dynevent_destroy_all(TRACEFS_DYNEVENT_KPROBE | - TRACEFS_DYNEVENT_KRETPROBE | - TRACEFS_DYNEVENT_UPROBE | - TRACEFS_DYNEVENT_URETPROBE | - TRACEFS_DYNEVENT_SYNTH, - true); + tracefs_dynevent_destroy_all(TRACEFS_DYNEVENT_ALL, true); } static void clear_func_filters(void)
The trace-cmd reset logic clears all dynamically created ftrace events. The current implementation lists all events that should be cleared. That logic is fragile, as when a new type of dynamic event is introduced the logic should be updated. Instead, the newly introduced libtracefs define should be used: TRACEFS_DYNEVENT_ALL. Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com> --- tracecmd/trace-record.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)