Linux Trace Kernel
 help / color / mirror / Atom feed
From: Randy Dunlap <rdunlap@infradead.org>
To: hu.shengming@zte.com.cn
Cc: rostedt@goodmis.org, mhiramat@kernel.org,
	mathieu.desnoyers@efficios.com, mark.rutland@arm.com,
	corbet@lwn.net, skhan@linuxfoundation.org,
	linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org, ran.xiaokai@zte.com.cn,
	xu.xin16@zte.com.cn, zhang.run@zte.com.cn
Subject: Re: [RFC PATCH 4/4] Documentation/ftrace: Document function comm filters
Date: Sun, 30 Aug 2026 08:27:34 -0700	[thread overview]
Message-ID: <a61aa866-f95a-42fa-86d8-86f0726e0d00@infradead.org> (raw)
In-Reply-To: <20260830191258354QN6qx13iCRbQd2Uj3Ve2s@zte.com.cn>

Hi,

On 8/30/26 4:12 AM, hu.shengming@zte.com.cn wrote:
> From: Shengming Hu <hu.shengming@zte.com.cn>
> 
> Document set_ftrace_comm and set_ftrace_notrace_comm, including their
> write and O_TRUNC behavior, accepted comm names, interaction with PID
> filters, and when a task is rechecked after its comm changes.
> 
> Signed-off-by: Shengming Hu <hu.shengming@zte.com.cn>
> ---
>  Documentation/trace/ftrace.rst | 31 +++++++++++++++++++++++++++++++
>  1 file changed, 31 insertions(+)
> 
> diff --git a/Documentation/trace/ftrace.rst b/Documentation/trace/ftrace.rst
> index 7261f25f8b4b..a96fc436ec16 100644
> --- a/Documentation/trace/ftrace.rst
> +++ b/Documentation/trace/ftrace.rst
> @@ -313,6 +313,37 @@ of ftrace. Here is a list of some of the key files:
>          If a PID is in both this file and "set_ftrace_pid", then this
>          file takes precedence, and the thread will not be traced.
> 
> +  set_ftrace_comm:
> +
> +	Have the function and function_graph tracers trace only threads whose
> +	task comm is listed in this file. Names are matched exactly and must
> +	contain between 1 and TASK_COMM_LEN - 1 bytes.
> +
> +	Each write adds one name. A single trailing newline is ignored, while
> +	embedded newlines are rejected. A zero-length write or a write containing
> +	only a newline adds no entry. Duplicate entries have no effect.
> +
> +	Opening the file with O_TRUNC clears the filter. Otherwise, writes add

Is there a way to clear the filter from (in) a shell script?

> +	names to the existing filter. From a shell, use >> to add a name without
> +	clearing the filter. Reading an empty filter prints `no comm`.
> +
> +	If both set_ftrace_pid and set_ftrace_comm contain entries, a thread must
> +	match both filters to be traced.
> +
> +  set_ftrace_notrace_comm:
> +
> +	Have the function and function_graph tracers ignore threads whose task
> +	comm is listed in this file. Matching and file operations have the same
> +	semantics as set_ftrace_comm.
> +
> +	A match in either set_ftrace_notrace_pid or set_ftrace_notrace_comm
> +	excludes the thread and takes precedence over all include filters.
> +
> +	Function-tracer task filters are evaluated when a task is scheduled in,
> +	and the result is cached per CPU. Changing a filter refreshes the result
> +	for currently running tasks. If a running task changes its comm, it is
> +	rechecked the next time it is scheduled in.
> +
>    set_event_pid:
> 
>  	Have the events only trace a task with a PID listed in this file.

-- 
~Randy


  reply	other threads:[~2026-08-30 15:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-30 11:07 [RFC PATCH 0/4] ftrace: Add task comm filtering for function tracing hu.shengming
2026-08-30 11:09 ` [RFC PATCH 1/4] ftrace: Generalize function task filter names hu.shengming
2026-08-30 11:10 ` ​[RFC PATCH 2/4] ftrace: Centralize task filter state updates hu.shengming
2026-08-30 11:24   ` sashiko-bot
2026-08-30 11:12 ` [RFC PATCH 3/4] ftrace: Add exact task comm filtering hu.shengming
2026-08-30 11:12 ` [RFC PATCH 4/4] Documentation/ftrace: Document function comm filters hu.shengming
2026-08-30 15:27   ` Randy Dunlap [this message]
2026-08-31 10:52     ` hu.shengming
2026-08-31  1:20 ` [RFC PATCH 0/4] ftrace: Add task comm filtering for function tracing Masami Hiramatsu
2026-08-31 10:41   ` hu.shengming
2026-08-31 13:49 ` Steven Rostedt
2026-09-03  1:03   ` hu.shengming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a61aa866-f95a-42fa-86d8-86f0726e0d00@infradead.org \
    --to=rdunlap@infradead.org \
    --cc=corbet@lwn.net \
    --cc=hu.shengming@zte.com.cn \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=ran.xiaokai@zte.com.cn \
    --cc=rostedt@goodmis.org \
    --cc=skhan@linuxfoundation.org \
    --cc=xu.xin16@zte.com.cn \
    --cc=zhang.run@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox