public inbox for linux-trace-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: <hu.shengming@zte.com.cn>
Cc: <rostedt@goodmis.org>, <mhiramat@kernel.org>,
	<mathieu.desnoyers@efficios.com>, <linux-kernel@vger.kernel.org>,
	<linux-trace-kernel@vger.kernel.org>, <zhang.run@zte.com.cn>,
	<yang.tao172@zte.com.cn>, <yang.yang29@zte.com.cn>
Subject: Re: [PATCH 1/2] fgraph: fix thresh_return clear per-task notrace
Date: Tue, 24 Feb 2026 17:33:24 +0900	[thread overview]
Message-ID: <20260224173324.3db58282e7afc817aaa13138@kernel.org> (raw)
In-Reply-To: <20260221113007819YgrZsMGABff4Rc-O_fZxL@zte.com.cn>

On Sat, 21 Feb 2026 11:30:07 +0800 (CST)
<hu.shengming@zte.com.cn> wrote:

> From: Shengming Hu <hu.shengming@zte.com.cn>
> 
> When tracing_thresh is enabled, function graph tracing uses
> trace_graph_thresh_return() as the return handler. Unlike
> trace_graph_return(), it did not clear the per-task
> TRACE_GRAPH_NOTRACE flag set by the entry handler for
> set_graph_notrace addresses. This could leave the task
> permanently in "notrace" state and effectively disable
> function graph tracing for that task.
> 
> Mirror trace_graph_return()'s per-task notrace handling by
> clearing TRACE_GRAPH_NOTRACE and returning early when set.
> 

Good catch!

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

Thanks!


> Fixes: b84214890a9bc ("function_graph: Move graph notrace bit to
> shadow stack global var")
> Signed-off-by: Shengming Hu <hu.shengming@zte.com.cn>
> ---
>  kernel/trace/trace_functions_graph.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
> index 1de6f1573..cbe43680c 100644
> --- a/kernel/trace/trace_functions_graph.c
> +++ b/kernel/trace/trace_functions_graph.c
> @@ -400,14 +400,15 @@ static void trace_graph_thresh_return(struct ftrace_graph_ret *trace,
>  				      struct fgraph_ops *gops,
>  				      struct ftrace_regs *fregs)
>  {
> +	unsigned long *task_var = fgraph_get_task_var(gops);
>  	struct fgraph_times *ftimes;
>  	struct trace_array *tr;
>  	int size;
> 
>  	ftrace_graph_addr_finish(gops, trace);
> 
> -	if (trace_recursion_test(TRACE_GRAPH_NOTRACE_BIT)) {
> -		trace_recursion_clear(TRACE_GRAPH_NOTRACE_BIT);
> +	if (*task_var & TRACE_GRAPH_NOTRACE) {
> +		*task_var &= ~TRACE_GRAPH_NOTRACE;
>  		return;
>  	}
> 
> -- 
> 2.25.1


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

  reply	other threads:[~2026-02-24  8:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-21  3:16 [PATCH 0/2] fgraph: fixes for thresh_return return handler hu.shengming
2026-02-21  3:30 ` [PATCH 1/2] fgraph: fix thresh_return clear per-task notrace hu.shengming
2026-02-24  8:33   ` Masami Hiramatsu [this message]
2026-02-21  3:33 ` [PATCH 2/2] fgraph: fix thresh_return nosleeptime double-adjust hu.shengming
2026-02-24  8:36   ` Masami Hiramatsu

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=20260224173324.3db58282e7afc817aaa13138@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=hu.shengming@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rostedt@goodmis.org \
    --cc=yang.tao172@zte.com.cn \
    --cc=yang.yang29@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