Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf jit: Make perf skip unknown records

The behavior before this commit was to skip the remaining portion of the
jitdump in case an unknown record was found, including those records
that perf could handle.

With this change, parsing a record with an unknown id will cause a
warning to be emitted, the record will be skipped and parsing will
resume from the next (valid) one.

The patch aims at making perf more future proof, by extracting as much
information as possible from jitdumps.

Signed-off-by: Stefano Sanfilippo <ssanfilippo@chromium.org>
Signed-off-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Stephane Eranian <eranian@google.com>
Cc: Anton Blanchard <anton@ozlabs.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1476356383-30100-5-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Stefano Sanfilippo and committed by
Arnaldo Carvalho de Melo
7354ec7a 13b9012a

+3 -3
+3 -3
tools/perf/util/jitdump.c
··· 263 263 return NULL; 264 264 265 265 if (id >= JIT_CODE_MAX) { 266 - pr_warning("next_entry: unknown prefix %d, skipping\n", id); 267 - return NULL; 266 + pr_warning("next_entry: unknown record type %d, skipping\n", id); 268 267 } 269 268 if (bs > jd->bufsize) { 270 269 void *n; ··· 321 322 break; 322 323 case JIT_CODE_MAX: 323 324 default: 324 - return NULL; 325 + /* skip unknown record (we have read them) */ 326 + break; 325 327 } 326 328 return jr; 327 329 }