* [PATCH v1] kernel/trace/trace: check the return value of tracing_update_buffers()
@ 2022-09-17 2:03 Li Zhong
2022-09-26 18:32 ` Steven Rostedt
0 siblings, 1 reply; 2+ messages in thread
From: Li Zhong @ 2022-09-17 2:03 UTC (permalink / raw)
To: linux-kernel; +Cc: mingo, rostedt, Li Zhong
Check the return value of tracing_update_buffers() in case it fails.
Signed-off-by: Li Zhong <floridsleeves@gmail.com>
---
kernel/trace/trace.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index d3005279165d..0e367e326147 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3305,7 +3305,8 @@ void trace_printk_init_buffers(void)
pr_warn("**********************************************************\n");
/* Expand the buffers to set size */
- tracing_update_buffers();
+ if (tracing_update_buffers() < 0)
+ return;
buffers_allocated = 1;
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v1] kernel/trace/trace: check the return value of tracing_update_buffers()
2022-09-17 2:03 [PATCH v1] kernel/trace/trace: check the return value of tracing_update_buffers() Li Zhong
@ 2022-09-26 18:32 ` Steven Rostedt
0 siblings, 0 replies; 2+ messages in thread
From: Steven Rostedt @ 2022-09-26 18:32 UTC (permalink / raw)
To: Li Zhong; +Cc: linux-kernel, mingo
On Fri, 16 Sep 2022 19:03:53 -0700
Li Zhong <floridsleeves@gmail.com> wrote:
> Check the return value of tracing_update_buffers() in case it fails.
FYI, the subject should be:
tracing: Check the return value of tracing_update_buffers()
>
> Signed-off-by: Li Zhong <floridsleeves@gmail.com>
> ---
> kernel/trace/trace.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
> index d3005279165d..0e367e326147 100644
> --- a/kernel/trace/trace.c
> +++ b/kernel/trace/trace.c
> @@ -3305,7 +3305,8 @@ void trace_printk_init_buffers(void)
> pr_warn("**********************************************************\n");
>
> /* Expand the buffers to set size */
> - tracing_update_buffers();
> + if (tracing_update_buffers() < 0)
> + return;
Even if the buffers are not expanded, tracing can still work. This should
not return here. But instead we should have something like:
/* Allocation really should not fail here at boot up or module load */
if (tracing_update_buffers() < 0)
pr_err("Failed to expand tracing buffers for trace_printk() calls\n");
else
buffers_allocate = 1;
As we still want the cmdline action done late in the code.
-- Steve
>
> buffers_allocated = 1;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-26 18:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-17 2:03 [PATCH v1] kernel/trace/trace: check the return value of tracing_update_buffers() Li Zhong
2022-09-26 18:32 ` Steven Rostedt
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.