]> git.baikalelectronics.ru Git - kernel.git/commit
tracing: Fix sleeping while atomic in kdb ftdump
authorDouglas Anderson <dianders@chromium.org>
Sat, 9 Jul 2022 00:09:52 +0000 (17:09 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 21 Jul 2022 19:24:24 +0000 (21:24 +0200)
commitca7cf8d29d39f58e45c0fe75d7c66e36a4fcaf8d
tree6903856b9fc9fe08a7f6295438a690b06b235098
parent44131ee28623b741d526ca525e9c1e6bfdc138b2
tracing: Fix sleeping while atomic in kdb ftdump

[ Upstream commit 9a62ac48d15d55b68ac35bd0da3dbd622a6265e1 ]

If you drop into kdb and type "ftdump" you'll get a sleeping while
atomic warning from memory allocation in trace_find_next_entry().

This appears to have been caused by commit 7c2a3035d9a2 ("tracing:
Save off entry when peeking at next entry"), which added the
allocation in that path. The problematic commit was already fixed by
commit d2f84cc688f0 ("tracing: Do not allocate buffer in
trace_find_next_entry() in atomic") but that fix missed the kdb case.

The fix here is easy: just move the assignment of the static buffer to
the place where it should have been to begin with:
trace_init_global_iter(). That function is called in two places, once
is right before the assignment of the static buffer added by the
previous fix and once is in kdb.

Note that it appears that there's a second static buffer that we need
to assign that was added in commit ce133cf6c0cd ("tracing: Show real
address for trace event arguments"), so we'll move that too.

Link: https://lkml.kernel.org/r/20220708170919.1.I75844e5038d9425add2ad853a608cb44bb39df40@changeid
Fixes: 7c2a3035d9a2 ("tracing: Save off entry when peeking at next entry")
Fixes: ce133cf6c0cd ("tracing: Show real address for trace event arguments")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/trace/trace.c