mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jacob Shin <jacob.shin@amd.com>
To: Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>, <x86@kernel.org>,
	Stephane Eranian <eranian@google.com>,
	Jiri Olsa <jolsa@redhat.com>, <linux-kernel@vger.kernel.org>,
	Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>,
	Jacob Shin <jacob.shin@amd.com>
Subject: [PATCH 3/5] perf tools: Add breakpoint address mask to the mem event parser
Date: Tue, 9 Apr 2013 12:21:51 -0500	[thread overview]
Message-ID: <1365528113-5458-4-git-send-email-jacob.shin@amd.com> (raw)
In-Reply-To: <1365528113-5458-1-git-send-email-jacob.shin@amd.com>

From: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>

Allow perf tool to pass in breakpoint address mask to match an address
range, i.e.:

  $ perf stat -e mem:0x1000:w:0xf a.out

Will count writes to [0x1000 ~ 0x1010)

Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
Signed-off-by: Jacob Shin <jacob.shin@amd.com>
---
 tools/perf/util/parse-events.c |    3 ++-
 tools/perf/util/parse-events.h |    2 +-
 tools/perf/util/parse-events.y |   14 ++++++++++++--
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 6c8bb0f..0744895 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -508,12 +508,13 @@ do {					\
 }
 
 int parse_events_add_breakpoint(struct list_head **list, int *idx,
-				void *ptr, char *type)
+				void *ptr, char *type, void *msk)
 {
 	struct perf_event_attr attr;
 
 	memset(&attr, 0, sizeof(attr));
 	attr.bp_addr = (unsigned long) ptr;
+	attr.bp_addr_mask = (unsigned long) msk;
 
 	if (parse_breakpoint_type(type, &attr))
 		return -EINVAL;
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h
index 8a48593..83920cc 100644
--- a/tools/perf/util/parse-events.h
+++ b/tools/perf/util/parse-events.h
@@ -92,7 +92,7 @@ int parse_events_add_numeric(struct list_head **list, int *idx,
 int parse_events_add_cache(struct list_head **list, int *idx,
 			   char *type, char *op_result1, char *op_result2);
 int parse_events_add_breakpoint(struct list_head **list, int *idx,
-				void *ptr, char *type);
+				void *ptr, char *type, void *msk);
 int parse_events_add_pmu(struct list_head **list, int *idx,
 			 char *pmu , struct list_head *head_config);
 void parse_events__set_leader(char *name, struct list_head *list);
diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index afc44c1..cfb0877 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -263,13 +263,23 @@ PE_NAME_CACHE_TYPE
 }
 
 event_legacy_mem:
+PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP ':' PE_VALUE sep_dc
+{
+	struct parse_events_evlist *data = _data;
+	struct list_head *list = NULL;
+
+	ABORT_ON(parse_events_add_breakpoint(&list, &data->idx,
+					     (void *) $2, $4, (void *) $6));
+	$$ = list;
+}
+|
 PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc
 {
 	struct parse_events_evlist *data = _data;
 	struct list_head *list = NULL;
 
 	ABORT_ON(parse_events_add_breakpoint(&list, &data->idx,
-					     (void *) $2, $4));
+					     (void *) $2, $4, NULL));
 	$$ = list;
 }
 |
@@ -279,7 +289,7 @@ PE_PREFIX_MEM PE_VALUE sep_dc
 	struct list_head *list = NULL;
 
 	ABORT_ON(parse_events_add_breakpoint(&list, &data->idx,
-					     (void *) $2, NULL));
+					     (void *) $2, NULL, NULL));
 	$$ = list;
 }
 
-- 
1.7.9.5



  parent reply	other threads:[~2013-04-09 17:22 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-09 17:21 [PATCH 0/5] perf: Add support for hardware breakpoint address masks Jacob Shin
2013-04-09 17:21 ` [PATCH 1/5] perf: Add hardware breakpoint address mask Jacob Shin
2013-04-20 16:22   ` Oleg Nesterov
2013-04-20 21:46     ` Jacob Shin
2013-04-21 16:43       ` Oleg Nesterov
2013-04-09 17:21 ` [PATCH 2/5] perf, x86: AMD implementation for " Jacob Shin
2013-04-21 17:19   ` Oleg Nesterov
2013-04-22 22:14     ` Jacob Shin
2013-04-09 17:21 ` Jacob Shin [this message]
2013-04-21 17:10   ` [PATCH 3/5] perf tools: Add breakpoint address mask to the mem event parser Oleg Nesterov
2013-04-09 17:21 ` [PATCH 4/5] perf tools: Add breakpoint address mask syntax to perf list and documentation Jacob Shin
2013-04-09 17:21 ` [PATCH 5/5] perf tools: Add breakpoint address mask test case to tests/parse-events Jacob Shin
2013-04-15 17:28 ` [PATCH 0/5] perf: Add support for hardware breakpoint address masks Jacob Shin
2013-04-16  9:36   ` Ingo Molnar
2013-04-18 16:38     ` Jacob Shin
2013-04-18 18:57       ` Oleg Nesterov
2013-04-15 23:22 ` Jiri Olsa
2013-04-20 16:53 ` Oleg Nesterov
2013-04-20 22:47   ` [PATCH 1/5] perf: Add hardware breakpoint address mask Jacob Shin
2013-04-21 17:02     ` Oleg Nesterov
2013-04-22 21:37       ` Jacob Shin
2013-04-22 21:57         ` Jacob Shin
  -- strict thread matches above, loose matches on Subject: below --
2012-12-12 16:30 [PATCH 0/5] perf: Add support for hardware breakpoint address masks Jacob Shin
2012-12-12 16:30 ` [PATCH 3/5] perf tools: Add breakpoint address mask to the mem event parser Jacob Shin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1365528113-5458-4-git-send-email-jacob.shin@amd.com \
    --to=jacob.shin@amd.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=eranian@google.com \
    --cc=hpa@zytor.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=suravee.suthikulpanit@amd.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome