Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754098AbcJMLCH (ORCPT ); Thu, 13 Oct 2016 07:02:07 -0400 Received: from mail-qt0-f182.google.com ([209.85.216.182]:36230 "EHLO mail-qt0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753699AbcJMLB2 (ORCPT ); Thu, 13 Oct 2016 07:01:28 -0400 From: Stephane Eranian To: linux-kernel@vger.kernel.org Cc: acme@kernel.org, jolsa@redhat.com, peterz@infradead.org, mingo@elte.hu, anton@ozlabs.org, namhyung@kernel.org, Stefano Sanfilippo , Ross McIlroy Subject: [PATCH 4/9] perf/jit: make perf skip unknown records Date: Thu, 13 Oct 2016 03:59:38 -0700 Message-Id: <1476356383-30100-5-git-send-email-eranian@google.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1476356383-30100-1-git-send-email-eranian@google.com> References: <1476356383-30100-1-git-send-email-eranian@google.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1440 Lines: 46 From: Stefano Sanfilippo The behaviour 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 Signed-off-by: Ross McIlroy Reviewed-by: Stephane Eranian --- tools/perf/util/jitdump.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/jitdump.c b/tools/perf/util/jitdump.c index 95f0884aae02..5db2feb90060 100644 --- a/tools/perf/util/jitdump.c +++ b/tools/perf/util/jitdump.c @@ -263,8 +263,7 @@ jit_get_next_entry(struct jit_buf_desc *jd) return NULL; if (id >= JIT_CODE_MAX) { - pr_warning("next_entry: unknown prefix %d, skipping\n", id); - return NULL; + pr_warning("next_entry: unknown record type %d, skipping\n", id); } if (bs > jd->bufsize) { void *n; @@ -322,7 +321,8 @@ jit_get_next_entry(struct jit_buf_desc *jd) break; case JIT_CODE_MAX: default: - return NULL; + /* skip unknown record (we have read them) */ + break; } return jr; } -- 1.9.1