From: "Steven Rostedt (Google)" <rostedt@xxxxxxxxxxx> 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