[PATCH v4 0/3] Support comma-separated symbols and :entry/:exit

Seokwoo Chung (Ryan) posted 3 patches 2 months, 1 week ago
Documentation/trace/fprobetrace.rst           |  17 +-
kernel/trace/trace.c                          |   3 +-
kernel/trace/trace_fprobe.c                   | 209 ++++++++++++++----
.../ftrace/test.d/dynevent/fprobe_list.tc     |  92 ++++++++
4 files changed, 269 insertions(+), 52 deletions(-)
create mode 100644 tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc
[PATCH v4 0/3] Support comma-separated symbols and :entry/:exit
Posted by Seokwoo Chung (Ryan) 2 months, 1 week ago
Extend fprobe to support list-style filters and explicit entry/exit suffixes.
Currentyl, fprobe only supports a single symbol (or wildcard) per event.
This patch allows users to specify a comma-separated list of symbols.

New Syntax:
- f:[GRP/][EVENT] func1,func2,func3:entry
- f:[GRP/][EVENT] func1,func2,func3:exit

Logic changes:
- Refactor parsing logic into 'parse_fprobe_spec'
- Support '!' prefix for exclusion
- Disable BTF lookup ('ctx->funcname = NULL') when a list or wildcard is used,
  as a single function signature cannot apply to multiple functions.
- Reject legacy '%return' suffix when used with lists or wildcards
- Update tracefs/README

Testing:
Verified on x86_64 via QEMU. Checked registration of lists, exclusions, and
explicit suffixes. Verified rejection of invalid syntax including trailing
commas and mixed legacy/new syntax.

Seokwoo Chung (Ryan) (3):
  docs: tracing/fprobe: Document list filters and :entry/:exit
  tracing/fprobe: Support comma-separated symbols and :entry/:exit
  selftests/ftrace: Add accept cases for fprobe list syntax

Changes in v4:
- Added validation to reject trailing commas (empty tokens) in symbol lists
- Added vaildation to reject mixed of list syntax with %return suffix
- Refactored parse_fprobe_spec to user __free(kfree) for automatic memory
  cleanup
- Removed the now-unused parse_symbol_and_return function to avoid compiler
  warnings.
- Tigtened %return detection to ensure it only matches as a strict suffix, not a
  substring
- Link to v3: https://lore.kernel.org/lkml/20250904103219.f4937968362bfff1ecd3f004@kernel.org/

 Documentation/trace/fprobetrace.rst           |  17 +-
 kernel/trace/trace.c                          |   3 +-
 kernel/trace/trace_fprobe.c                   | 209 ++++++++++++++----
 .../ftrace/test.d/dynevent/fprobe_list.tc     |  92 ++++++++
 4 files changed, 269 insertions(+), 52 deletions(-)
 create mode 100644 tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc

-- 
2.43.0
[PATCH v5 0/3] tracing/fprobe: Support comma-separated symbols and :entry/:exit
Posted by Seokwoo Chung (Ryan) 3 weeks, 2 days ago
This series extends fprobe dynamic events to accept a comma-separated list of
symbols and explicit/suffixes.

Currently, fprobe only supports a single symbol (or wildcard) per event. This
series allow users to specify a comma-separated list of symbols, including
exclusions, and to select entry/exit explicitly using /

Examples:
- f:[GRP/][EVENT] func1,func2,func3
- f:[GRP/][EVENT] func1,!func2,func3 (exclude with '!')

Logic changes:
- Refactor parsing logic into parse_fprobe_spec()
- Support comma-separated lists and '!' exclusions
- Add / suffixes for explicit entry/exit selection
- Preserve legacy single-symbol behavior (single symbols still accept %return)
- Disable BTF-based signature lookup when list/wildcard is used, since one
  function signature cannot apply to multiple functions
- Reject mixed legacy/new syntax where applicable (e.g. list + %return)
- Update tracefs/README and fprobe documentation
- Add ftrace selftests covering accepted list syntax cases

*Patch order is adjusted: code first, then docs, then selftest

Changes in v5:
- Reordered patches (code->docs->selftests) as suggested
- Addressed review feedback on README help text to show both legacy and list
  syntaxes
- Added missing traceprobe error IDs used by the new validation and fixed
  parsing/bracing issues found by automated builds
- Removed the dedicated list_mode field and infer list behavior from presence of
  filter/nofilter and keep struct trace_probe as the last member
- Link to v4: https://lore.kernel.org/linux-trace-kernel/20251127151218.4763b25c751bb2aac4b1ee36@kernel.org/

I am not fully confident the runtime testing coverage that I did is sufficient
across configs/architectures, so additional verification would be appreciated.

Best regards,
Ryan Chung

Seokwoo Chung (Ryan) (3):
  tracing/fprobe: Support comma-separated symbols and :entry/:exit
  docs: tracing/fprobe: Document list filters and :entry/:exit
  selftests/ftrace: Add accept cases for fprobe list syntax

 Documentation/trace/fprobetrace.rst           | 18 +++++--
 kernel/trace/trace.c                          |  4 +-
 kernel/trace/trace_fprobe.c                   | 49 ++++++++++---------
 kernel/trace/trace_probe.h                    |  2 +
 .../ftrace/test.d/dynevent/fprobe_list.tc     |  2 +-
 5 files changed, 47 insertions(+), 28 deletions(-)


base-commit: f0c13b210e4366e03bd9e8967347b06b227e20a4
-- 
2.43.0
[PATCH v5 1/3] tracing/fprobe: Support comma-separated symbols and :entry/:exit
Posted by Seokwoo Chung (Ryan) 3 weeks, 2 days ago
Signed-off-by: Seokwoo Chung (Ryan) <seokwoo.chung130@gmail.com>
---
 kernel/trace/trace.c        |  4 +--
 kernel/trace/trace_fprobe.c | 49 ++++++++++++++++++++-----------------
 kernel/trace/trace_probe.h  |  2 ++
 3 files changed, 31 insertions(+), 24 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 10cdcc7b194e..73b59d47dfe7 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -5578,8 +5578,8 @@ static const char readme_msg[] =
 	"\t           r[maxactive][:[<group>/][<event>]] <place> [<args>]\n"
 #endif
 #ifdef CONFIG_FPROBE_EVENTS
-	"\t           f[:[<group>/][<event>]] <func-name>[:entry|:exit] [<args>]\n"
-	"\t		(single symbols still accept %return)\n"
+	"\t           f[:[<group>/][<event>]] <func-name>[%return] [<args>]\n"
+	"\t	      f[:[<group>/][<event>]] <func-list>[:entry|:exit] [<args>]\n" 
 	"\t           t[:[<group>/][<event>]] <tracepoint> [<args>]\n"
 #endif
 #ifdef CONFIG_HIST_TRIGGERS
diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c
index 5a2a41eea603..1663c341ddb4 100644
--- a/kernel/trace/trace_fprobe.c
+++ b/kernel/trace/trace_fprobe.c
@@ -187,16 +187,23 @@ DEFINE_FREE(tuser_put, struct tracepoint_user *,
  */
 struct trace_fprobe {
 	struct dyn_event	devent;
-	char			*filter;
+
 	struct fprobe		fp;
-	bool			list_mode;
-	char			*nofilter;
 	const char		*symbol;
-	struct trace_probe	tp;
+	char			*filter;
+	char			*nofilter;
+
 	bool			tprobe;
 	struct tracepoint_user	*tuser;
+
+	struct trace_probe tp;
 };
 
+static inline bool trace_fprobe_has_list(const struct trace_fprobe *tf)
+{
+	return tf->filter || tf->nofilter;
+}
+
 static bool is_trace_fprobe(struct dyn_event *ev)
 {
 	return ev->ops == &trace_fprobe_ops;
@@ -847,7 +854,7 @@ static int __register_trace_fprobe(struct trace_fprobe *tf)
 	 * - list_mode: pass filter/nofilter
 	 * - single: pass symbol only (legacy)
 	 */
-	if (tf->list_mode)
+	if (trace_fprobe_has_list(tf))
 		return register_fprobe(&tf->fp, tf->filter, tf->nofilter);
 	return register_fprobe(&tf->fp, tf->symbol, NULL);
 }
@@ -1188,11 +1195,18 @@ static int parse_fprobe_spec(const char *in, bool is_tracepoint,
 	*base = NULL; *filter = NULL; *nofilter = NULL;
 	*is_return = false; *list_mode = false;
 
-	if (is_tracepoint) {
+	if (is_tracepoint) 
+	{
 		if (strchr(in, ',') || strchr(in, ':'))
+		{
+			trace_probe_log_err(0, BAD_TP_NAME);
 			return -EINVAL;
+		}
 		if (strstr(in, "%return"))
+		{
+			trace_probe_log_err(p - in, BAD_TP_NAME);
 			return -EINVAL;
+		}
 		for (p = in; *p; p++)
 			if (!isalnum(*p) && *p != '_')
 				return -EINVAL;
@@ -1225,6 +1239,7 @@ static int parse_fprobe_spec(const char *in, bool is_tracepoint,
 			} else if (!strcmp(p, ":entry")) {
 				*(char *)p = '\0';
 			} else {
+				trace_probe_log_err(p - work, BAD_LIST_SUFFIX);
 				return -EINVAL;
 			}
 		}
@@ -1233,6 +1248,7 @@ static int parse_fprobe_spec(const char *in, bool is_tracepoint,
 	list = !!strchr(work, ',');
 	
 	if (list && legacy_ret) {
+		trace_probe_log_err(p - work, BAD_LEGACY_RET);
 		return -EINVAL;
 	}
 
@@ -1245,12 +1261,9 @@ static int parse_fprobe_spec(const char *in, bool is_tracepoint,
 
 	if (list) {
 		char *tmp = b, *tok;
-		size_t fsz, nfsz;
 
-		fsz = nfsz = strlen(b) + 1;
-
-		f = kzalloc(fsz, GFP_KERNEL);
-		nf = kzalloc(nfsz, GFP_KERNEL);
+		f = kzalloc(strlen(b) + 1, GFP_KERNEL);
+		nf = kzalloc(strlen(b) + 1, GFP_KERNEL);
 		if (!f || !nf)
 			return -ENOMEM;
 
@@ -1261,6 +1274,7 @@ static int parse_fprobe_spec(const char *in, bool is_tracepoint,
 			if (*tok == '\0') {
 				trace_probe_log_err(tmp - b - 1, BAD_TP_NAME);
 				return -EINVAL;
+			}
 
 			if (neg)
 				tok++;
@@ -1455,17 +1469,8 @@ static int trace_fprobe_create_internal(int argc, const char *argv[],
 
 	/* carry list parsing result into tf */
 	if (!is_tracepoint) {
-		tf->list_mode = list_mode;
-		if (parsed_filter) {
-			tf->filter = kstrdup(parsed_filter, GFP_KERNEL);
-			if (!tf->filter)
-				return -ENOMEM;
-		}
-		if (parsed_nofilter) {
-			tf->nofilter = kstrdup(parsed_nofilter, GFP_KERNEL);
-			if (!tf->nofilter)
-				return -ENOMEM;
-		}
+		tf->filter = no_free_ptr(parsed_filter);
+		tf->nofilter = no_free_ptr(parsed_nofilter);
 	}
 
 	/* parse arguments */
diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
index 9fc56c937130..b8b0544eb7cd 100644
--- a/kernel/trace/trace_probe.h
+++ b/kernel/trace/trace_probe.h
@@ -494,9 +494,11 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call,
 	C(BAD_PROBE_ADDR,	"Invalid probed address or symbol"),	\
 	C(NON_UNIQ_SYMBOL,	"The symbol is not unique"),		\
 	C(BAD_RETPROBE,		"Retprobe address must be an function entry"), \
+	C(BAD_LEGACY_RET,	"Legacy %return not allowed with list"), \
 	C(NO_TRACEPOINT,	"Tracepoint is not found"),		\
 	C(BAD_TP_NAME,		"Invalid character in tracepoint name"),\
 	C(BAD_ADDR_SUFFIX,	"Invalid probed address suffix"), \
+	C(BAD_LIST_SUFFIX,	"Bad list suffix"), \
 	C(NO_GROUP_NAME,	"Group name is not specified"),		\
 	C(GROUP_TOO_LONG,	"Group name is too long"),		\
 	C(BAD_GROUP_NAME,	"Group name must follow the same rules as C identifiers"), \
-- 
2.43.0
Re: [PATCH v5 1/3] tracing/fprobe: Support comma-separated symbols and :entry/:exit
Posted by Steven Rostedt 2 weeks, 3 days ago
On Wed, 14 Jan 2026 17:13:38 -0500
"Seokwoo Chung (Ryan)" <seokwoo.chung130@gmail.com> wrote:

Missing change log. The subject is the "what" the patch is doing, the
change log needs the "why".

> Signed-off-by: Seokwoo Chung (Ryan) <seokwoo.chung130@gmail.com>
> ---
>  kernel/trace/trace.c        |  4 +--
>  kernel/trace/trace_fprobe.c | 49 ++++++++++++++++++++-----------------
>  kernel/trace/trace_probe.h  |  2 ++
>  3 files changed, 31 insertions(+), 24 deletions(-)
> 
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index 10cdcc7b194e..73b59d47dfe7 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -5578,8 +5578,8 @@ static const char readme_msg[] =
>  	"\t           r[maxactive][:[<group>/][<event>]] <place> [<args>]\n"
>  #endif
>  #ifdef CONFIG_FPROBE_EVENTS
> -	"\t           f[:[<group>/][<event>]] <func-name>[:entry|:exit] [<args>]\n"
> -	"\t		(single symbols still accept %return)\n"
> +	"\t           f[:[<group>/][<event>]] <func-name>[%return] [<args>]\n"
> +	"\t	      f[:[<group>/][<event>]] <func-list>[:entry|:exit] [<args>]\n" 
>  	"\t           t[:[<group>/][<event>]] <tracepoint> [<args>]\n"
>  #endif
>  #ifdef CONFIG_HIST_TRIGGERS
> diff --git a/kernel/trace/trace_fprobe.c b/kernel/trace/trace_fprobe.c
> index 5a2a41eea603..1663c341ddb4 100644
> --- a/kernel/trace/trace_fprobe.c
> +++ b/kernel/trace/trace_fprobe.c
> @@ -187,16 +187,23 @@ DEFINE_FREE(tuser_put, struct tracepoint_user *,
>   */
>  struct trace_fprobe {
>  	struct dyn_event	devent;
> -	char			*filter;
> +
>  	struct fprobe		fp;
> -	bool			list_mode;
> -	char			*nofilter;
>  	const char		*symbol;
> -	struct trace_probe	tp;
> +	char			*filter;
> +	char			*nofilter;
> +
>  	bool			tprobe;
>  	struct tracepoint_user	*tuser;
> +
> +	struct trace_probe tp;

Why is this being updated? Nothing in the change log says why?

>  };
>  
> +static inline bool trace_fprobe_has_list(const struct trace_fprobe *tf)
> +{
> +	return tf->filter || tf->nofilter;
> +}
> +
>  static bool is_trace_fprobe(struct dyn_event *ev)
>  {
>  	return ev->ops == &trace_fprobe_ops;
> @@ -847,7 +854,7 @@ static int __register_trace_fprobe(struct trace_fprobe *tf)
>  	 * - list_mode: pass filter/nofilter
>  	 * - single: pass symbol only (legacy)
>  	 */
> -	if (tf->list_mode)
> +	if (trace_fprobe_has_list(tf))
>  		return register_fprobe(&tf->fp, tf->filter, tf->nofilter);
>  	return register_fprobe(&tf->fp, tf->symbol, NULL);
>  }
> @@ -1188,11 +1195,18 @@ static int parse_fprobe_spec(const char *in, bool is_tracepoint,
>  	*base = NULL; *filter = NULL; *nofilter = NULL;
>  	*is_return = false; *list_mode = false;
>  
> -	if (is_tracepoint) {
> +	if (is_tracepoint) 
> +	{
>  		if (strchr(in, ',') || strchr(in, ':'))
> +		{
> +			trace_probe_log_err(0, BAD_TP_NAME);
>  			return -EINVAL;
> +		}
>  		if (strstr(in, "%return"))
> +		{
> +			trace_probe_log_err(p - in, BAD_TP_NAME);
>  			return -EINVAL;
> +		}
>  		for (p = in; *p; p++)
>  			if (!isalnum(*p) && *p != '_')
>  				return -EINVAL;
> @@ -1225,6 +1239,7 @@ static int parse_fprobe_spec(const char *in, bool is_tracepoint,
>  			} else if (!strcmp(p, ":entry")) {
>  				*(char *)p = '\0';
>  			} else {
> +				trace_probe_log_err(p - work, BAD_LIST_SUFFIX);
>  				return -EINVAL;
>  			}
>  		}
> @@ -1233,6 +1248,7 @@ static int parse_fprobe_spec(const char *in, bool is_tracepoint,
>  	list = !!strchr(work, ',');
>  	
>  	if (list && legacy_ret) {
> +		trace_probe_log_err(p - work, BAD_LEGACY_RET);
>  		return -EINVAL;
>  	}
>  
> @@ -1245,12 +1261,9 @@ static int parse_fprobe_spec(const char *in, bool is_tracepoint,
>  
>  	if (list) {
>  		char *tmp = b, *tok;
> -		size_t fsz, nfsz;
>  
> -		fsz = nfsz = strlen(b) + 1;
> -
> -		f = kzalloc(fsz, GFP_KERNEL);
> -		nf = kzalloc(nfsz, GFP_KERNEL);
> +		f = kzalloc(strlen(b) + 1, GFP_KERNEL);
> +		nf = kzalloc(strlen(b) + 1, GFP_KERNEL);
>  		if (!f || !nf)
>  			return -ENOMEM;
>  
> @@ -1261,6 +1274,7 @@ static int parse_fprobe_spec(const char *in, bool is_tracepoint,
>  			if (*tok == '\0') {
>  				trace_probe_log_err(tmp - b - 1, BAD_TP_NAME);
>  				return -EINVAL;
> +			}
>  
>  			if (neg)
>  				tok++;
> @@ -1455,17 +1469,8 @@ static int trace_fprobe_create_internal(int argc, const char *argv[],
>  
>  	/* carry list parsing result into tf */
>  	if (!is_tracepoint) {
> -		tf->list_mode = list_mode;
> -		if (parsed_filter) {
> -			tf->filter = kstrdup(parsed_filter, GFP_KERNEL);
> -			if (!tf->filter)
> -				return -ENOMEM;
> -		}
> -		if (parsed_nofilter) {
> -			tf->nofilter = kstrdup(parsed_nofilter, GFP_KERNEL);
> -			if (!tf->nofilter)
> -				return -ENOMEM;
> -		}
> +		tf->filter = no_free_ptr(parsed_filter);
> +		tf->nofilter = no_free_ptr(parsed_nofilter);
>  	}
>  
>  	/* parse arguments */
> diff --git a/kernel/trace/trace_probe.h b/kernel/trace/trace_probe.h
> index 9fc56c937130..b8b0544eb7cd 100644
> --- a/kernel/trace/trace_probe.h
> +++ b/kernel/trace/trace_probe.h
> @@ -494,9 +494,11 @@ extern int traceprobe_define_arg_fields(struct trace_event_call *event_call,
>  	C(BAD_PROBE_ADDR,	"Invalid probed address or symbol"),	\
>  	C(NON_UNIQ_SYMBOL,	"The symbol is not unique"),		\
>  	C(BAD_RETPROBE,		"Retprobe address must be an function entry"), \
> +	C(BAD_LEGACY_RET,	"Legacy %return not allowed with list"), \
>  	C(NO_TRACEPOINT,	"Tracepoint is not found"),		\
>  	C(BAD_TP_NAME,		"Invalid character in tracepoint name"),\
>  	C(BAD_ADDR_SUFFIX,	"Invalid probed address suffix"), \
> +	C(BAD_LIST_SUFFIX,	"Bad list suffix"), \
>  	C(NO_GROUP_NAME,	"Group name is not specified"),		\
>  	C(GROUP_TOO_LONG,	"Group name is too long"),		\
>  	C(BAD_GROUP_NAME,	"Group name must follow the same rules as C identifiers"), \

This definitely needs discussion on why this is needed.

-- Steve
Re: [PATCH v5 1/3] tracing/fprobe: Support comma-separated symbols and :entry/:exit
Posted by Steven Rostedt 2 weeks, 3 days ago
On Tue, 20 Jan 2026 15:50:47 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Wed, 14 Jan 2026 17:13:38 -0500
> "Seokwoo Chung (Ryan)" <seokwoo.chung130@gmail.com> wrote:
> 
> Missing change log. The subject is the "what" the patch is doing, the
> change log needs the "why".

Ah, just noticed you sent a revision. I'll reply there.

-- Steve
[PATCH v5 2/3] docs: tracing/fprobe: Document list filters and :entry/:exit
Posted by Seokwoo Chung (Ryan) 3 weeks, 2 days ago
Signed-off-by: Seokwoo Chung (Ryan) <seokwoo.chung130@gmail.com>
---
 Documentation/trace/fprobetrace.rst | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/Documentation/trace/fprobetrace.rst b/Documentation/trace/fprobetrace.rst
index b4c2ca3d02c1..5efd9c374365 100644
--- a/Documentation/trace/fprobetrace.rst
+++ b/Documentation/trace/fprobetrace.rst
@@ -25,14 +25,19 @@ Synopsis of fprobe-events
 -------------------------
 ::
 
-  f[:[GRP1/][EVENT1]] SYM [FETCHARGS]                       : Probe on function entry
-  f[MAXACTIVE][:[GRP1/][EVENT1]] SYM%return [FETCHARGS]     : Probe on function exit
+  f[:[GRP1/][EVENT1]] SYM [FETCHARGS]			: Probe on function entry
+  f[MAXACTIVE][:[GRP1/][EVENT1]] SYM%return [FETCHARGS] : Probe on function exit
+  f[:[GRP1/][EVENT1] SYM[,[!]SYM[,...][:entry|:exit] [FETCHARGS] : Probe on
+  list/wildcard
   t[:[GRP2/][EVENT2]] TRACEPOINT [FETCHARGS]                : Probe on tracepoint
 
  GRP1           : Group name for fprobe. If omitted, use "fprobes" for it.
  GRP2           : Group name for tprobe. If omitted, use "tracepoints" for it.
  EVENT1         : Event name for fprobe. If omitted, the event name is
-                  "SYM__entry" or "SYM__exit".
+          - For a single literal symbol, the event name is
+            "SYM__entry" or "SYM__exit".
+          - For a *list or any wildcard*, an explicit [GRP1/][EVENT1] is
+            required.
  EVENT2         : Event name for tprobe. If omitted, the event name is
                   the same as "TRACEPOINT", but if the "TRACEPOINT" starts
                   with a digit character, "_TRACEPOINT" is used.
@@ -40,6 +45,13 @@ Synopsis of fprobe-events
                   can be probed simultaneously, or 0 for the default value
                   as defined in Documentation/trace/fprobe.rst
 
+ SYM        : Function name or comma-separated list of symbols.
+          - SYM prefixed with "!" are exclusions.
+          - ":entry" suffix means it probes entry of given symbols
+            (default)
+          - ":exit" suffix means it probes exit of given symbols.
+          - "%return" suffix means it probes exit of SYM (single
+            symbol).
  FETCHARGS      : Arguments. Each probe can have up to 128 args.
   ARG           : Fetch "ARG" function argument using BTF (only for function
                   entry or tracepoint.) (\*1)
-- 
2.43.0
Re: [PATCH v5 2/3] docs: tracing/fprobe: Document list filters and :entry/:exit
Posted by Steven Rostedt 2 weeks, 3 days ago
On Wed, 14 Jan 2026 17:13:39 -0500
"Seokwoo Chung (Ryan)" <seokwoo.chung130@gmail.com> wrote:


Again, no change log :-(

-- Steve


> Signed-off-by: Seokwoo Chung (Ryan) <seokwoo.chung130@gmail.com>
> ---
>  Documentation/trace/fprobetrace.rst | 18 +++++++++++++++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/trace/fprobetrace.rst b/Documentation/trace/fprobetrace.rst
> index b4c2ca3d02c1..5efd9c374365 100644
> --- a/Documentation/trace/fprobetrace.rst
> +++ b/Documentation/trace/fprobetrace.rst
> @@ -25,14 +25,19 @@ Synopsis of fprobe-events
>  -------------------------
>  ::
>  
> -  f[:[GRP1/][EVENT1]] SYM [FETCHARGS]                       : Probe on function entry
> -  f[MAXACTIVE][:[GRP1/][EVENT1]] SYM%return [FETCHARGS]     : Probe on function exit
> +  f[:[GRP1/][EVENT1]] SYM [FETCHARGS]			: Probe on function entry
> +  f[MAXACTIVE][:[GRP1/][EVENT1]] SYM%return [FETCHARGS] : Probe on function exit
> +  f[:[GRP1/][EVENT1] SYM[,[!]SYM[,...][:entry|:exit] [FETCHARGS] : Probe on
> +  list/wildcard
>    t[:[GRP2/][EVENT2]] TRACEPOINT [FETCHARGS]                : Probe on tracepoint
>  
>   GRP1           : Group name for fprobe. If omitted, use "fprobes" for it.
>   GRP2           : Group name for tprobe. If omitted, use "tracepoints" for it.
>   EVENT1         : Event name for fprobe. If omitted, the event name is
> -                  "SYM__entry" or "SYM__exit".
> +          - For a single literal symbol, the event name is
> +            "SYM__entry" or "SYM__exit".
> +          - For a *list or any wildcard*, an explicit [GRP1/][EVENT1] is
> +            required.
>   EVENT2         : Event name for tprobe. If omitted, the event name is
>                    the same as "TRACEPOINT", but if the "TRACEPOINT" starts
>                    with a digit character, "_TRACEPOINT" is used.
> @@ -40,6 +45,13 @@ Synopsis of fprobe-events
>                    can be probed simultaneously, or 0 for the default value
>                    as defined in Documentation/trace/fprobe.rst
>  
> + SYM        : Function name or comma-separated list of symbols.
> +          - SYM prefixed with "!" are exclusions.
> +          - ":entry" suffix means it probes entry of given symbols
> +            (default)
> +          - ":exit" suffix means it probes exit of given symbols.
> +          - "%return" suffix means it probes exit of SYM (single
> +            symbol).
>   FETCHARGS      : Arguments. Each probe can have up to 128 args.
>    ARG           : Fetch "ARG" function argument using BTF (only for function
>                    entry or tracepoint.) (\*1)
[PATCH v5 3/3] selftests/ftrace: Add accept cases for fprobe list syntax
Posted by Seokwoo Chung (Ryan) 3 weeks, 2 days ago
Signed-off-by: Seokwoo Chung (Ryan) <seokwoo.chung130@gmail.com>
---
 tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc b/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc
index 45e57c6f487d..79392e268929 100644
--- a/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc
+++ b/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc
@@ -1,7 +1,7 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0
 # description: Fprobe event list syntax and :entry/:exit suffixes
-# requires: dynamic_events "f[:[<group>/][<event>]] <func-name>[:entry|:exit] [<args>]":README
+# requires: dynamic_events "f[:[<group>/][<event>]] <func-list>[:entry|:exit] [<args>]":README
 
 # Setup symbols to test. These are common kernel functions.
 PLACE=vfs_read
-- 
2.43.0
Re: [PATCH v5 3/3] selftests/ftrace: Add accept cases for fprobe list syntax
Posted by Steven Rostedt 2 weeks, 3 days ago
On Wed, 14 Jan 2026 17:13:40 -0500
"Seokwoo Chung (Ryan)" <seokwoo.chung130@gmail.com> wrote:

-ENOCHANGELOG

 :-(

-- Steve


> Signed-off-by: Seokwoo Chung (Ryan) <seokwoo.chung130@gmail.com>
> ---
>  tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc b/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc
> index 45e57c6f487d..79392e268929 100644
> --- a/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc
> +++ b/tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc
> @@ -1,7 +1,7 @@
>  #!/bin/sh
>  # SPDX-License-Identifier: GPL-2.0
>  # description: Fprobe event list syntax and :entry/:exit suffixes
> -# requires: dynamic_events "f[:[<group>/][<event>]] <func-name>[:entry|:exit] [<args>]":README
> +# requires: dynamic_events "f[:[<group>/][<event>]] <func-list>[:entry|:exit] [<args>]":README
>  
>  # Setup symbols to test. These are common kernel functions.
>  PLACE=vfs_read
[PATCH v5 0/3] tracing/fprobe: Support comma-separated symbols and :entry/:exit
Posted by Seokwoo Chung (Ryan) 3 weeks, 2 days ago
This series extends fprobe dynamic events to accept a comma-separated list of
symbols and explicit/suffixes.

Currently, fprobe only supports a single symbol (or wildcard) per event. This
series allow users to specify a comma-separated list of symbols, including
exclusions, and to select entry/exit explicitly using /

Examples:
- f:[GRP/][EVENT] func1,func2,func3
- f:[GRP/][EVENT] func1,!func2,func3 (exclude with '!')

Logic changes:
- Refactor parsing logic into parse_fprobe_spec()
- Support comma-separated lists and '!' exclusions
- Add / suffixes for explicit entry/exit selection
- Preserve legacy single-symbol behavior (single symbols still accept %return)
- Disable BTF-based signature lookup when list/wildcard is used, since one
  function signature cannot apply to multiple functions
- Reject mixed legacy/new syntax where applicable (e.g. list + %return)
- Update tracefs/README and fprobe documentation
- Add ftrace selftests covering accepted list syntax cases

*Patch order is adjusted: code first, then docs, then selftest

Changes in v5:
- Reordered patches (code->docs->selftests) as suggested
- Addressed review feedback on README help text to show both legacy and list
  syntaxes
- Added missing traceprobe error IDs used by the new validation and fixed
  parsing/bracing issues found by automated builds
- Removed the dedicated list_mode field and infer list behavior from presence of
  filter/nofilter and keep struct trace_probe as the last member
- Link to v4: https://lore.kernel.org/linux-trace-kernel/20251127151218.4763b25c751bb2aac4b1ee36@kernel.org/

I am not fully confident the runtime testing coverage that I did is sufficient
across configs/architectures, so additional verification would be appreciated.

Best regards,
Ryan Chung

Seokwoo Chung (Ryan) (3):
  tracing/fprobe: Support comma-separated symbols and :entry/:exit
  docs: tracing/fprobe: Document list filters and :entry/:exit
  selftests/ftrace: Add accept cases for fprobe list syntax

 Documentation/trace/fprobetrace.rst           | 18 +++++--
 kernel/trace/trace.c                          |  4 +-
 kernel/trace/trace_fprobe.c                   | 49 ++++++++++---------
 kernel/trace/trace_probe.h                    |  2 +
 .../ftrace/test.d/dynevent/fprobe_list.tc     |  2 +-
 5 files changed, 47 insertions(+), 28 deletions(-)


base-commit: f0c13b210e4366e03bd9e8967347b06b227e20a4
-- 
2.43.0
Re: [PATCH v4 0/3] Support comma-separated symbols and :entry/:exit
Posted by Masami Hiramatsu (Google) 2 months, 1 week ago
On Wed, 26 Nov 2025 13:41:07 -0500
"Seokwoo Chung (Ryan)" <seokwoo.chung130@gmail.com> wrote:

> Extend fprobe to support list-style filters and explicit entry/exit suffixes.
> Currentyl, fprobe only supports a single symbol (or wildcard) per event.
> This patch allows users to specify a comma-separated list of symbols.
> 
> New Syntax:
> - f:[GRP/][EVENT] func1,func2,func3:entry
> - f:[GRP/][EVENT] func1,func2,func3:exit

Thanks for updating!

> 
> Logic changes:
> - Refactor parsing logic into 'parse_fprobe_spec'
> - Support '!' prefix for exclusion
> - Disable BTF lookup ('ctx->funcname = NULL') when a list or wildcard is used,
>   as a single function signature cannot apply to multiple functions.
> - Reject legacy '%return' suffix when used with lists or wildcards
> - Update tracefs/README
> 
> Testing:
> Verified on x86_64 via QEMU. Checked registration of lists, exclusions, and
> explicit suffixes. Verified rejection of invalid syntax including trailing
> commas and mixed legacy/new syntax.
> 
> Seokwoo Chung (Ryan) (3):
>   docs: tracing/fprobe: Document list filters and :entry/:exit
>   tracing/fprobe: Support comma-separated symbols and :entry/:exit

For the next time, please add docs patch after code change because of bisect.
(Or, include the document update into code update.)

>   selftests/ftrace: Add accept cases for fprobe list syntax

Testing after code is good. :)

Thank you,

> 
> Changes in v4:
> - Added validation to reject trailing commas (empty tokens) in symbol lists
> - Added vaildation to reject mixed of list syntax with %return suffix
> - Refactored parse_fprobe_spec to user __free(kfree) for automatic memory
>   cleanup
> - Removed the now-unused parse_symbol_and_return function to avoid compiler
>   warnings.
> - Tigtened %return detection to ensure it only matches as a strict suffix, not a
>   substring
> - Link to v3: https://lore.kernel.org/lkml/20250904103219.f4937968362bfff1ecd3f004@kernel.org/
> 
>  Documentation/trace/fprobetrace.rst           |  17 +-
>  kernel/trace/trace.c                          |   3 +-
>  kernel/trace/trace_fprobe.c                   | 209 ++++++++++++++----
>  .../ftrace/test.d/dynevent/fprobe_list.tc     |  92 ++++++++
>  4 files changed, 269 insertions(+), 52 deletions(-)
>  create mode 100644 tools/testing/selftests/ftrace/test.d/dynevent/fprobe_list.tc
> 
> -- 
> 2.43.0
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>