Commit 7354ec7a authored by Stefano Sanfilippo's avatar Stefano Sanfilippo Committed by Arnaldo Carvalho de Melo

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: default avatarStefano Sanfilippo <ssanfilippo@chromium.org>
Signed-off-by: default avatarRoss McIlroy <rmcilroy@chromium.org>
Reviewed-by: default avatarStephane 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.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 13b9012a
...@@ -263,8 +263,7 @@ jit_get_next_entry(struct jit_buf_desc *jd) ...@@ -263,8 +263,7 @@ jit_get_next_entry(struct jit_buf_desc *jd)
return NULL; return NULL;
if (id >= JIT_CODE_MAX) { if (id >= JIT_CODE_MAX) {
pr_warning("next_entry: unknown prefix %d, skipping\n", id); pr_warning("next_entry: unknown record type %d, skipping\n", id);
return NULL;
} }
if (bs > jd->bufsize) { if (bs > jd->bufsize) {
void *n; void *n;
...@@ -322,7 +321,8 @@ jit_get_next_entry(struct jit_buf_desc *jd) ...@@ -322,7 +321,8 @@ jit_get_next_entry(struct jit_buf_desc *jd)
break; break;
case JIT_CODE_MAX: case JIT_CODE_MAX:
default: default:
return NULL; /* skip unknown record (we have read them) */
break;
} }
return jr; return jr;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment