rethook: Remove warning messages printed for finding return address of a frame.
PATCH v2 1/1 rethook: Remove warning messages printed for finding return address of a frame.
The function rethook_find_ret_addr() prints a warning message and returns 0 when the target task is running and is not the "current" task in order to prevent the incorrect return address, although it still may return an incorrect address.
However, the warning message turns into noise when BPF profiling programs call bpf_get_task_stack() on running tasks in a firm with a large number of hosts.
The callers should be aware and willing to take the risk of receiving an incorrect return address from a task that is currently running other than the "current" one. A warning is not needed here as the callers are intent on it.
---
Changes from v1:
- Rephrased the commit log.
- Removed the confusing last part of the first paragraph.
- Removed "frequently" from the 2nd paragraph, replaced by "a firm with a large number of hosts".
v1: https://lore.kernel.org/all/[email protected]/
--- kernel/trace/rethook.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/rethook.c +1 -1
@@ -248,7 +248,7 @@ unsigned long rethook_find_ret_addr(struct task_struct *tsk, unsigned long frameif (WARN_ON_ONCE (!cur))return 0 ; -if (WARN_ON_ONCE (tsk != current &&task_is_running (tsk))) +if (tsk != current &&task_is_running (tsk))return 0 ; do {
Signature · 1 line
2.34.1
Masami Hiramatsu (Google)
maintainerQuoted 5 lines · On Mon, 8 Apr 2024 10:51:40 -0700 Kui-Feng Lee <[email protected]> wrote:
The function
rethook_find_ret_addr()prints a warning message and returns 0 when the target task is running and is not the "current" task in order to prevent the incorrect return address, although it still may return an incorrect address.
Quoted 9 lines
However, the warning message turns into noise when BPF profiling programs call
bpf_get_task_stack()on running tasks in a firm with a large number of hosts.The callers should be aware and willing to take the risk of receiving an incorrect return address from a task that is currently running other than the "current" one. A warning is not needed here as the callers are intent on it.
OK, looks good to me. Let me pick it to probes/for-next. Thanks!
Quoted 35 lines
Acked-by Andrii Nakryiko <[email protected]>Acked-by John Fastabend <[email protected]>Signed-off-by Kui-Feng Lee <[email protected]>---
Changes from v1:- Rephrased the commit log.
- Removed the confusing last part of the first paragraph.
- Removed "frequently" from the 2nd paragraph, replaced by "a firm with a large number of hosts".
v1: https://lore.kernel.org/all/[email protected]/
--- kernel/trace/rethook.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/trace/rethook.c +1
-1@@ -248,7 +248,7 @@ unsigned long rethook_find_ret_addr(struct task_struct *tsk, unsigned long frameif (WARN_ON_ONCE (!cur))return 0 ; -if (WARN_ON_ONCE (tsk != current &&task_is_running (tsk))) +if (tsk != current &&task_is_running (tsk))return 0 ; do {Signature · 1 line
2.34.1
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>