Skip to contentSkip to conversation

trace-cmd: Use the new libtracefs API to address all dynamic events

PATCH Applied Tzvetomir Stoyanov (VMware) 2 participants 2 messages Mar 9, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd: Use the new libtracefs API to address all dynamic events

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.

---
 tracecmd/trace-record.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
tracecmd/trace-record.c +1 -6
index 9afc1042..8d9cbac2 100644
@@ -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)
Signature · 1 line
2.34.1
#1 lore raw
Quoted 7 lines · On Wed, 9 Mar 2022 07:44:58 +0200 "Tzvetomir Stoyanov (VMware)"…

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.

Applied, thanks Tzvetomir!

-- Steve

Quoted 22 lines
---
 tracecmd/trace-record.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)
tracecmd/trace-record.c +1 -6
index 9afc1042..8d9cbac2 100644
@@ -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)