mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Andy Chiu <andybnac@gmail.com>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	mark.rutland@arm.com, mhiramat@kernel.org,
	mathieu.desnoyers@efficios.com, bjorn@rivosinc.com,
	puranjay12@gmail.com, alexghiti@rivosinc.com,
	paul.walmsley@sifive.com, greentime.hu@sifive.com,
	nick.hu@sifive.com, nylon.chen@sifive.com, eric.lin@sifive.com,
	vicent.chen@sifive.com, zong.li@sifive.com,
	yongxuan.wang@sifive.com, samuel.holland@sifive.com,
	olivia.chu@sifive.com, c2232430@gmail.com
Subject: Re: [PATCH] ftrace: properly merge notrace hash
Date: Mon, 7 Apr 2025 16:09:24 -0400	[thread overview]
Message-ID: <20250407160924.7c28fffd@gandalf.local.home> (raw)
In-Reply-To: <20250407180745.42848-1-andybnac@gmail.com>

On Tue,  8 Apr 2025 02:07:44 +0800
Andy Chiu <andybnac@gmail.com> wrote:

> The global notrace hash should be jointly decided by the intersection of
> each subops's notrace hash, but not the filter hash.
> 
> Fixes: 5fccc7552ccb ("ftrace: Add subops logic to allow one ops to manage many")
> Signed-off-by: Andy Chiu <andybnac@gmail.com>
> ---
>  kernel/trace/ftrace.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
> index 1a48aedb5255..ee662f380b61 100644
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -3526,18 +3526,17 @@ int ftrace_startup_subops(struct ftrace_ops *ops, struct ftrace_ops *subops, int
>  	    ftrace_hash_empty(subops->func_hash->notrace_hash)) {
>  		notrace_hash = EMPTY_HASH;
>  	} else {
> -		size_bits = max(ops->func_hash->filter_hash->size_bits,
> -				subops->func_hash->filter_hash->size_bits);
> +		size_bits = max(ops->func_hash->notrace_hash->size_bits,
> +				subops->func_hash->notrace_hash->size_bits);
>  		notrace_hash = alloc_ftrace_hash(size_bits);
>  		if (!notrace_hash) {
> -			free_ftrace_hash(filter_hash);
> +			free_ftrace_hash(notrace_hash);
>  			return -ENOMEM;
>  		}
>  
> -		ret = intersect_hash(&notrace_hash, ops->func_hash->filter_hash,
> -				     subops->func_hash->filter_hash);
> +		ret = intersect_hash(&notrace_hash, ops->func_hash->notrace_hash,
> +				     subops->func_hash->notrace_hash);

Thanks for catching this.


>  		if (ret < 0) {
> -			free_ftrace_hash(filter_hash);

The filter_hash still needs to be freed, as it could have been allocated in
the previous if statement and never used (both the filter_hash and
notrace_hash get used at the end of the function via ftrace_update_ops().

Care to send a v2?

-- Steve


>  			free_ftrace_hash(notrace_hash);
>  			return ret;
>  		}


  reply	other threads:[~2025-04-07 20:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-07 18:07 Andy Chiu
2025-04-07 20:09 ` Steven Rostedt [this message]
2025-04-08 15:55   ` Andy Chiu

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=20250407160924.7c28fffd@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=alexghiti@rivosinc.com \
    --cc=andybnac@gmail.com \
    --cc=bjorn@rivosinc.com \
    --cc=c2232430@gmail.com \
    --cc=eric.lin@sifive.com \
    --cc=greentime.hu@sifive.com \
    --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=nick.hu@sifive.com \
    --cc=nylon.chen@sifive.com \
    --cc=olivia.chu@sifive.com \
    --cc=paul.walmsley@sifive.com \
    --cc=puranjay12@gmail.com \
    --cc=samuel.holland@sifive.com \
    --cc=vicent.chen@sifive.com \
    --cc=yongxuan.wang@sifive.com \
    --cc=zong.li@sifive.com \
    /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

all inboxes | Powered by JetHome®