Linux Documentation
 help / color / mirror / Atom feed
From: <hu.shengming@zte.com.cn>
To: <rdunlap@infradead.org>
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: Mon, 31 Aug 2026 18:52:29 +0800 (CST)	[thread overview]
Message-ID: <20260831185229820QtPvU0In3o2wLbCelSO_8@zte.com.cn> (raw)
In-Reply-To: <a61aa866-f95a-42fa-86d8-86f0726e0d00@infradead.org>

Randy wrote:
> Hi,
> 

Hi Randy,

> 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?
> 

Yes. It can be cleared with:

  # echo > set_ftrace_comm

The shell opens the file with O_TRUNC, which clears the existing filter.

I described the O_TRUNC behavior but overlooked the corresponding
user-facing shell command. Thanks for pointing this out.

Based on Masami's feedback, I am now considering reworking the series
around a generic event trigger that updates set_ftrace_pid, so the
comm-specific files may not remain in the next version.

--
With Best Regards,
Shengming

  reply	other threads:[~2026-08-31 10:52 UTC|newest]

Thread overview: 11+ 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: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
2026-08-31 10:52     ` hu.shengming [this message]
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=20260831185229820QtPvU0In3o2wLbCelSO_8@zte.com.cn \
    --to=hu.shengming@zte.com.cn \
    --cc=corbet@lwn.net \
    --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=rdunlap@infradead.org \
    --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