Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932742Ab2JRXXp (ORCPT ); Thu, 18 Oct 2012 19:23:45 -0400 Received: from mga02.intel.com ([134.134.136.20]:20461 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756796Ab2JRXT5 (ORCPT ); Thu, 18 Oct 2012 19:19:57 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.80,609,1344236400"; d="scan'208";a="229462630" From: Andi Kleen To: a.p.zijlstra@chello.nl Cc: x86@kernel.org, linux-kernel@vger.kernel.org, acme@redhat.com, eranian@google.com, Andi Kleen Subject: [PATCH 28/34] tools, perf: Add a precise event qualifier Date: Thu, 18 Oct 2012 16:19:36 -0700 Message-Id: <1350602382-12771-29-git-send-email-andi@firstfloor.org> X-Mailer: git-send-email 1.7.7.6 In-Reply-To: <1350602382-12771-1-git-send-email-andi@firstfloor.org> References: <1350602382-12771-1-git-send-email-andi@firstfloor.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2212 Lines: 65 From: Andi Kleen Add a precise qualifier, like cpu/event=0x3c,precise=1/ This is needed so that the kernel can request enabling PEBS for TSX events. The parser bails out on any sysfs parse errors, so this is needed in any case to handle any event on the TSX perf kernel. Signed-off-by: Andi Kleen --- tools/perf/util/parse-events.c | 6 ++++++ tools/perf/util/parse-events.h | 1 + tools/perf/util/parse-events.l | 1 + 3 files changed, 8 insertions(+), 0 deletions(-) diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 401b088..de1cb9e 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c @@ -526,6 +526,12 @@ do { \ case PARSE_EVENTS__TERM_TYPE_NAME: CHECK_TYPE_VAL(STR); break; + case PARSE_EVENTS__TERM_TYPE_PRECISE: + CHECK_TYPE_VAL(NUM); + if ((unsigned)term->val.num > 2) + return -EINVAL; + attr->precise_ip = term->val.num; + break; default: return -EINVAL; } diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 839230c..0c78bb8 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h @@ -49,6 +49,7 @@ enum { PARSE_EVENTS__TERM_TYPE_NAME, PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD, PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE, + PARSE_EVENTS__TERM_TYPE_PRECISE, }; struct parse_events__term { diff --git a/tools/perf/util/parse-events.l b/tools/perf/util/parse-events.l index ef602f0..c2e5142 100644 --- a/tools/perf/util/parse-events.l +++ b/tools/perf/util/parse-events.l @@ -168,6 +168,7 @@ period { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_SAMPLE_PERIOD); } branch_type { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_BRANCH_SAMPLE_TYPE); } , { return ','; } "/" { BEGIN(INITIAL); return '/'; } +precise { return term(yyscanner, PARSE_EVENTS__TERM_TYPE_PRECISE); } } mem: { BEGIN(mem); return PE_PREFIX_MEM; } -- 1.7.7.6 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/