linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] trace-cmd library: Fix sparse cpu_data
@ 2022-03-12 23:40 Steven Rostedt
  2022-03-12 23:40 ` [PATCH 1/2] trace-cmd library: Make cpu_data[] match the cpus Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Steven Rostedt @ 2022-03-12 23:40 UTC (permalink / raw)
  To: linux-trace-devel; +Cc: Steven Rostedt (Google)

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

I have a new box that has 128 logical CPUs, and when I do trace-cmd record, as
most of my CPUs are idle, they are not recorded into the CPU file.

I had a test run that only had 35 of the 128 CPUs have data, and trace-cmd
created a 35 cpu_data array to hold this information. But when I tried to load
this into KernelShark, it crashed.

It crashed because it uses the CPU number to retrieve information. Thus, when
it asked for CPU 45 and the internal trace-cmd library only had 35 cpu_data
items, it overlooked the array.

Make the array non sparse. That is, if there's only one CPU in the file, and
it's CPU 100, make an array of 101 (including CPU 0) where all the CPUs with
no data just have a cpu_data filled with zeros.

Also, fix tracecmd_read_cpu_first() return NULL if the CPU passed to it is
greater than the number of items in the cpu_data array. This is because it
would ask for cpu 64 but the last CPU with data in it was CPU 63, and
trace-cmd library only made an array of 64 (0-63) items.

Steven Rostedt (Google) (2):
  trace-cmd library: Make cpu_data[] match the cpus
  trace-cmd library: Do not read CPU greater than CPUs registered

 lib/trace-cmd/trace-input.c | 54 ++++++++++++++++++++++++++++++-------
 1 file changed, 45 insertions(+), 9 deletions(-)

-- 
2.35.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-03-14 16:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-12 23:40 [PATCH 0/2] trace-cmd library: Fix sparse cpu_data Steven Rostedt
2022-03-12 23:40 ` [PATCH 1/2] trace-cmd library: Make cpu_data[] match the cpus Steven Rostedt
2022-03-12 23:40 ` [PATCH 2/2] trace-cmd library: Do not read CPU greater than CPUs registered Steven Rostedt
2022-03-14 14:59 ` [PATCH 0/2] trace-cmd library: Fix sparse cpu_data Yordan Karadzhov
2022-03-14 16:01   ` Steven Rostedt
2022-03-14 16:05     ` Yordan Karadzhov
2022-03-14 16:14       ` Steven Rostedt

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).