* [PATCH 1/2] tracing: fprobe: Remove unused local variable
@ 2025-09-24 0:26 Masami Hiramatsu (Google)
2025-09-24 0:26 ` [PATCH 2/2] tracing: fprobe: Fix to remove recorded module addresses from filter Masami Hiramatsu (Google)
2025-09-24 1:22 ` [PATCH 1/2] tracing: fprobe: Remove unused local variable menglong.dong
0 siblings, 2 replies; 6+ messages in thread
From: Masami Hiramatsu (Google) @ 2025-09-24 0:26 UTC (permalink / raw)
To: Steven Rostedt
Cc: Menglong Dong, Menglong Dong, Masami Hiramatsu, Mathieu Desnoyers,
linux-kernel, linux-trace-kernel
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
The 'ret' local variable in fprobe_remove_node_in_module() was used
for checking the error state in the loop, but commit dfe0d675df82
("tracing: fprobe: use rhltable for fprobe_ip_table") removed the loop.
So we don't need it anymore.
Fixes: dfe0d675df82 ("tracing: fprobe: use rhltable for fprobe_ip_table")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/fprobe.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
index 6a205903b1ed..12ec194fdfed 100644
--- a/kernel/trace/fprobe.c
+++ b/kernel/trace/fprobe.c
@@ -457,8 +457,6 @@ static int fprobe_addr_list_add(struct fprobe_addr_list *alist, unsigned long ad
static void fprobe_remove_node_in_module(struct module *mod, struct fprobe_hlist_node *node,
struct fprobe_addr_list *alist)
{
- int ret = 0;
-
if (!within_module(node->addr, mod))
return;
if (delete_fprobe_node(node))
@@ -467,8 +465,7 @@ static void fprobe_remove_node_in_module(struct module *mod, struct fprobe_hlist
* If failed to update alist, just continue to update hlist.
* Therefore, at list user handler will not hit anymore.
*/
- if (!ret)
- ret = fprobe_addr_list_add(alist, node->addr);
+ fprobe_addr_list_add(alist, node->addr);
}
/* Handle module unloading to manage fprobe_ip_table. */
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/2] tracing: fprobe: Fix to remove recorded module addresses from filter
2025-09-24 0:26 [PATCH 1/2] tracing: fprobe: Remove unused local variable Masami Hiramatsu (Google)
@ 2025-09-24 0:26 ` Masami Hiramatsu (Google)
2025-09-24 1:55 ` menglong.dong
2025-09-24 3:49 ` menglong.dong
2025-09-24 1:22 ` [PATCH 1/2] tracing: fprobe: Remove unused local variable menglong.dong
1 sibling, 2 replies; 6+ messages in thread
From: Masami Hiramatsu (Google) @ 2025-09-24 0:26 UTC (permalink / raw)
To: Steven Rostedt
Cc: Menglong Dong, Menglong Dong, Masami Hiramatsu, Mathieu Desnoyers,
linux-kernel, linux-trace-kernel
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Even if there is a memory allocation failure in fprobe_addr_list_add(),
there is a partial list of module addresses. So remove the recorded
addresses from filter if exists.
This also removes the redundant ret local variable.
Fixes: a3dc2983ca7b ("tracing: fprobe: Cleanup fprobe hash when module unloading")
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
kernel/trace/fprobe.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
index 12ec194fdfed..95e43814b85b 100644
--- a/kernel/trace/fprobe.c
+++ b/kernel/trace/fprobe.c
@@ -434,8 +434,9 @@ static int fprobe_addr_list_add(struct fprobe_addr_list *alist, unsigned long ad
{
unsigned long *addrs;
- if (alist->index >= alist->size)
- return -ENOMEM;
+ /* Previously we failed to expand the list. */
+ if (alist->index == alist->size)
+ return -ENOSPC;
alist->addrs[alist->index++] = addr;
if (alist->index < alist->size)
@@ -497,7 +498,7 @@ static int fprobe_module_callback(struct notifier_block *nb,
} while (node == ERR_PTR(-EAGAIN));
rhashtable_walk_exit(&iter);
- if (alist.index < alist.size && alist.index > 0)
+ if (alist.index > 0)
ftrace_set_filter_ips(&fprobe_graph_ops.ops,
alist.addrs, alist.index, 1, 0);
mutex_unlock(&fprobe_mutex);
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] tracing: fprobe: Fix to remove recorded module addresses from filter
2025-09-24 0:26 ` [PATCH 2/2] tracing: fprobe: Fix to remove recorded module addresses from filter Masami Hiramatsu (Google)
@ 2025-09-24 1:55 ` menglong.dong
2025-09-24 3:49 ` menglong.dong
1 sibling, 0 replies; 6+ messages in thread
From: menglong.dong @ 2025-09-24 1:55 UTC (permalink / raw)
To: Masami Hiramatsu (Google)
Cc: Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers, linux-kernel,
linux-trace-kernel
On 2025/9/24 08:26 Masami Hiramatsu (Google) <mhiramat@kernel.org> write:
> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> Even if there is a memory allocation failure in fprobe_addr_list_add(),
> there is a partial list of module addresses. So remove the recorded
> addresses from filter if exists.
> This also removes the redundant ret local variable.
I think this is what you do in the previous patch?
The rest looks good to me.
Reviewed-by: Menglong Dong <menglong8.dong@gmail.com>
(I think I should use Reviewed-by here, rather than Acked-by,
right?)
Thanks!
Menglong Dong
>
> Fixes: a3dc2983ca7b ("tracing: fprobe: Cleanup fprobe hash when module unloading")
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> ---
> kernel/trace/fprobe.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
> index 12ec194fdfed..95e43814b85b 100644
> --- a/kernel/trace/fprobe.c
> +++ b/kernel/trace/fprobe.c
> @@ -434,8 +434,9 @@ static int fprobe_addr_list_add(struct fprobe_addr_list *alist, unsigned long ad
> {
> unsigned long *addrs;
>
> - if (alist->index >= alist->size)
> - return -ENOMEM;
> + /* Previously we failed to expand the list. */
> + if (alist->index == alist->size)
> + return -ENOSPC;
>
> alist->addrs[alist->index++] = addr;
> if (alist->index < alist->size)
> @@ -497,7 +498,7 @@ static int fprobe_module_callback(struct notifier_block *nb,
> } while (node == ERR_PTR(-EAGAIN));
> rhashtable_walk_exit(&iter);
>
> - if (alist.index < alist.size && alist.index > 0)
> + if (alist.index > 0)
> ftrace_set_filter_ips(&fprobe_graph_ops.ops,
> alist.addrs, alist.index, 1, 0);
> mutex_unlock(&fprobe_mutex);
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] tracing: fprobe: Fix to remove recorded module addresses from filter
2025-09-24 0:26 ` [PATCH 2/2] tracing: fprobe: Fix to remove recorded module addresses from filter Masami Hiramatsu (Google)
2025-09-24 1:55 ` menglong.dong
@ 2025-09-24 3:49 ` menglong.dong
2025-09-24 8:10 ` Masami Hiramatsu
1 sibling, 1 reply; 6+ messages in thread
From: menglong.dong @ 2025-09-24 3:49 UTC (permalink / raw)
To: Masami Hiramatsu (Google)
Cc: Steven Rostedt, Masami Hiramatsu, Mathieu Desnoyers, linux-kernel,
linux-trace-kernel
On 2025/9/24 08:26 Masami Hiramatsu (Google) <mhiramat@kernel.org> write:
> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> Even if there is a memory allocation failure in fprobe_addr_list_add(),
> there is a partial list of module addresses. So remove the recorded
> addresses from filter if exists.
> This also removes the redundant ret local variable.
>
> Fixes: a3dc2983ca7b ("tracing: fprobe: Cleanup fprobe hash when module unloading")
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> ---
> kernel/trace/fprobe.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
Hi, Masami. Should I send the V2 of the patch:
tracing: fprobe: optimization for entry only case
after this series applied?
Thanks!
Menglong Dong
>
> diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
> index 12ec194fdfed..95e43814b85b 100644
> --- a/kernel/trace/fprobe.c
> +++ b/kernel/trace/fprobe.c
> @@ -434,8 +434,9 @@ static int fprobe_addr_list_add(struct fprobe_addr_list *alist, unsigned long ad
> {
> unsigned long *addrs;
>
> - if (alist->index >= alist->size)
> - return -ENOMEM;
> + /* Previously we failed to expand the list. */
> + if (alist->index == alist->size)
> + return -ENOSPC;
>
> alist->addrs[alist->index++] = addr;
> if (alist->index < alist->size)
> @@ -497,7 +498,7 @@ static int fprobe_module_callback(struct notifier_block *nb,
> } while (node == ERR_PTR(-EAGAIN));
> rhashtable_walk_exit(&iter);
>
> - if (alist.index < alist.size && alist.index > 0)
> + if (alist.index > 0)
> ftrace_set_filter_ips(&fprobe_graph_ops.ops,
> alist.addrs, alist.index, 1, 0);
> mutex_unlock(&fprobe_mutex);
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH 2/2] tracing: fprobe: Fix to remove recorded module addresses from filter
2025-09-24 3:49 ` menglong.dong
@ 2025-09-24 8:10 ` Masami Hiramatsu
0 siblings, 0 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2025-09-24 8:10 UTC (permalink / raw)
To: menglong.dong
Cc: Steven Rostedt, Mathieu Desnoyers, linux-kernel,
linux-trace-kernel
On Wed, 24 Sep 2025 11:49:39 +0800
menglong.dong@linux.dev wrote:
> On 2025/9/24 08:26 Masami Hiramatsu (Google) <mhiramat@kernel.org> write:
> > From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> >
> > Even if there is a memory allocation failure in fprobe_addr_list_add(),
> > there is a partial list of module addresses. So remove the recorded
> > addresses from filter if exists.
> > This also removes the redundant ret local variable.
> >
> > Fixes: a3dc2983ca7b ("tracing: fprobe: Cleanup fprobe hash when module unloading")
> > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> > ---
> > kernel/trace/fprobe.c | 7 ++++---
> > 1 file changed, 4 insertions(+), 3 deletions(-)
>
> Hi, Masami. Should I send the V2 of the patch:
>
> tracing: fprobe: optimization for entry only case
>
> after this series applied?
Yeah, I'll push this [2/2] to stable tonight. and
push [1/2] to probes/for-next too. I'll rebase probes/for-next
so that it will have both patch.
Thank you,
>
> Thanks!
> Menglong Dong
>
> >
> > diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
> > index 12ec194fdfed..95e43814b85b 100644
> > --- a/kernel/trace/fprobe.c
> > +++ b/kernel/trace/fprobe.c
> > @@ -434,8 +434,9 @@ static int fprobe_addr_list_add(struct fprobe_addr_list *alist, unsigned long ad
> > {
> > unsigned long *addrs;
> >
> > - if (alist->index >= alist->size)
> > - return -ENOMEM;
> > + /* Previously we failed to expand the list. */
> > + if (alist->index == alist->size)
> > + return -ENOSPC;
> >
> > alist->addrs[alist->index++] = addr;
> > if (alist->index < alist->size)
> > @@ -497,7 +498,7 @@ static int fprobe_module_callback(struct notifier_block *nb,
> > } while (node == ERR_PTR(-EAGAIN));
> > rhashtable_walk_exit(&iter);
> >
> > - if (alist.index < alist.size && alist.index > 0)
> > + if (alist.index > 0)
> > ftrace_set_filter_ips(&fprobe_graph_ops.ops,
> > alist.addrs, alist.index, 1, 0);
> > mutex_unlock(&fprobe_mutex);
> >
> >
> >
>
>
>
>
--
Masami Hiramatsu (Google) <mhiramat@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] tracing: fprobe: Remove unused local variable
2025-09-24 0:26 [PATCH 1/2] tracing: fprobe: Remove unused local variable Masami Hiramatsu (Google)
2025-09-24 0:26 ` [PATCH 2/2] tracing: fprobe: Fix to remove recorded module addresses from filter Masami Hiramatsu (Google)
@ 2025-09-24 1:22 ` menglong.dong
1 sibling, 0 replies; 6+ messages in thread
From: menglong.dong @ 2025-09-24 1:22 UTC (permalink / raw)
To: Steven Rostedt, Masami Hiramatsu (Google)
Cc: Masami Hiramatsu, Mathieu Desnoyers, linux-kernel,
linux-trace-kernel
On 2025/9/24 08:26 Masami Hiramatsu (Google) <mhiramat@kernel.org> write:
> From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
>
> The 'ret' local variable in fprobe_remove_node_in_module() was used
> for checking the error state in the loop, but commit dfe0d675df82
> ("tracing: fprobe: use rhltable for fprobe_ip_table") removed the loop.
> So we don't need it anymore.
>
> Fixes: dfe0d675df82 ("tracing: fprobe: use rhltable for fprobe_ip_table")
> Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
> ---
> kernel/trace/fprobe.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/kernel/trace/fprobe.c b/kernel/trace/fprobe.c
> index 6a205903b1ed..12ec194fdfed 100644
> --- a/kernel/trace/fprobe.c
> +++ b/kernel/trace/fprobe.c
> @@ -457,8 +457,6 @@ static int fprobe_addr_list_add(struct fprobe_addr_list *alist, unsigned long ad
> static void fprobe_remove_node_in_module(struct module *mod, struct fprobe_hlist_node *node,
> struct fprobe_addr_list *alist)
> {
> - int ret = 0;
Acked-by: Menglong Dong <menglong8.dong@gmail.com>
Thanks~
> -
> if (!within_module(node->addr, mod))
> return;
> if (delete_fprobe_node(node))
> @@ -467,8 +465,7 @@ static void fprobe_remove_node_in_module(struct module *mod, struct fprobe_hlist
> * If failed to update alist, just continue to update hlist.
> * Therefore, at list user handler will not hit anymore.
> */
> - if (!ret)
> - ret = fprobe_addr_list_add(alist, node->addr);
> + fprobe_addr_list_add(alist, node->addr);
> }
>
> /* Handle module unloading to manage fprobe_ip_table. */
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-09-24 8:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-24 0:26 [PATCH 1/2] tracing: fprobe: Remove unused local variable Masami Hiramatsu (Google)
2025-09-24 0:26 ` [PATCH 2/2] tracing: fprobe: Fix to remove recorded module addresses from filter Masami Hiramatsu (Google)
2025-09-24 1:55 ` menglong.dong
2025-09-24 3:49 ` menglong.dong
2025-09-24 8:10 ` Masami Hiramatsu
2025-09-24 1:22 ` [PATCH 1/2] tracing: fprobe: Remove unused local variable menglong.dong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).