From: Frederic Weisbecker <fweisbec@gmail.com>
To: suravee.suthikulpanit@amd.com
Cc: mingo@kernel.org, mingo@redhat.com, jacob.w.shin@gmail.com,
oleg@redhat.com, a.p.zijlstra@chello.nl, acme@ghostprotocols.net,
hpa@zytor.com, tgl@domain.invalid, linux-kernel@vger.kernel.org,
sherry.hurwitz@amd.com
Subject: Re: [PATCH 2/3] perf tools: allow user to specify hardware breakpoint bp_len
Date: Tue, 10 Dec 2013 16:25:34 +0100 [thread overview]
Message-ID: <20131210152532.GF10633@localhost.localdomain> (raw)
In-Reply-To: <1380730268-25807-3-git-send-email-suravee.suthikulpanit@amd.com>
On Wed, Oct 02, 2013 at 11:11:07AM -0500, suravee.suthikulpanit@amd.com wrote:
> From: Jacob Shin <jacob.w.shin@gmail.com>
>
> Currently bp_len is given a default value of 4. Allow user to override it:
>
> $ perf stat -e mem:0x1000/8
> ^
> bp_len
>
> If no value is given, it will default to 4 as it did before.
>
> Signed-off-by: Jacob Shin <jacob.w.shin@gmail.com>
> Signed-off-by: Suravee Suthikulpanit <suravee.suthikulpanit@amd.com>
> ---
> tools/perf/Documentation/perf-record.txt | 7 +++++--
> tools/perf/util/parse-events.c | 17 +++++++----------
> tools/perf/util/parse-events.h | 2 +-
> tools/perf/util/parse-events.l | 1 +
> tools/perf/util/parse-events.y | 26 ++++++++++++++++++++++++--
> 5 files changed, 38 insertions(+), 15 deletions(-)
>
> diff --git a/tools/perf/Documentation/perf-record.txt b/tools/perf/Documentation/perf-record.txt
> index e297b74..e07491f 100644
> --- a/tools/perf/Documentation/perf-record.txt
> +++ b/tools/perf/Documentation/perf-record.txt
> @@ -33,12 +33,15 @@ OPTIONS
> - a raw PMU event (eventsel+umask) in the form of rNNN where NNN is a
> hexadecimal event descriptor.
>
> - - a hardware breakpoint event in the form of '\mem:addr[:access]'
> + - a hardware breakpoint event in the form of '\mem:addr[/len][:access]'
> where addr is the address in memory you want to break in.
> Access is the memory access type (read, write, execute) it can
> - be passed as follows: '\mem:addr[:[r][w][x]]'.
> + be passed as follows: '\mem:addr[:[r][w][x]]'. len is the range,
> + number of bytes from specified addr, which the breakpoint will cover.
> If you want to profile read-write accesses in 0x1000, just set
> 'mem:0x1000:rw'.
> + If you want to profile write accesses in [0x1000~1008), just set
> + 'mem:0x1000/8:w'.
>
> --filter=<filter>::
> Event filter.
> diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
> index 9812531..65d81ae 100644
> --- a/tools/perf/util/parse-events.c
> +++ b/tools/perf/util/parse-events.c
> @@ -515,7 +515,7 @@ do { \
> }
>
> int parse_events_add_breakpoint(struct list_head *list, int *idx,
> - void *ptr, char *type)
> + void *ptr, char *type, u64 len)
> {
> struct perf_event_attr attr;
>
> @@ -525,14 +525,11 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx,
> if (parse_breakpoint_type(type, &attr))
> return -EINVAL;
>
> - /*
> - * We should find a nice way to override the access length
> - * Provide some defaults for now
> - */
> - if (attr.bp_type == HW_BREAKPOINT_X)
> - attr.bp_len = sizeof(long);
> - else
> - attr.bp_len = HW_BREAKPOINT_LEN_4;
> + /* Provide some defaults if len is not specified */
> + if (!len)
> + len = attr.bp_type == HW_BREAKPOINT_X ? sizeof(long) :
> + HW_BREAKPOINT_LEN_4;
Why is LEN_4 affected in the type?
> + attr.bp_len = len;
Thanks.
next prev parent reply other threads:[~2013-12-10 15:25 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-02 16:11 [PATCH V5 0/3] perf/x86/amd: AMD Family 16h Data Breakpoint Extensions suravee.suthikulpanit
2013-10-02 16:11 ` [PATCH 1/3] perf/x86/amd: AMD support for bp_len > HW_BREAKPOINT_LEN_8 suravee.suthikulpanit
2013-10-31 9:58 ` Frederic Weisbecker
2013-10-31 10:48 ` Borislav Petkov
2013-10-31 11:23 ` Frederic Weisbecker
2013-11-02 4:34 ` Borislav Petkov
2013-11-08 21:22 ` Suravee Suthikulpanit
2013-11-08 14:40 ` Borislav Petkov
2013-10-31 16:49 ` Oleg Nesterov
2013-11-08 19:41 ` Frederic Weisbecker
2013-11-09 15:11 ` Oleg Nesterov
2013-11-09 15:32 ` Frederic Weisbecker
2013-11-09 15:54 ` Oleg Nesterov
2013-11-11 15:44 ` Frederic Weisbecker
2013-11-11 17:51 ` Oleg Nesterov
2013-12-02 23:12 ` Frederic Weisbecker
2013-12-04 13:57 ` Oleg Nesterov
2013-12-10 14:43 ` Frederic Weisbecker
2013-12-10 14:52 ` Frederic Weisbecker
2013-12-10 15:23 ` Frederic Weisbecker
2013-12-10 16:19 ` Oleg Nesterov
2013-12-10 16:30 ` Frederic Weisbecker
2013-12-11 12:05 ` Suravee Suthikulanit
2013-10-02 16:11 ` [PATCH 2/3] perf tools: allow user to specify hardware breakpoint bp_len suravee.suthikulpanit
2013-12-10 15:25 ` Frederic Weisbecker [this message]
2013-12-10 16:22 ` Oleg Nesterov
2013-12-10 16:26 ` Frederic Weisbecker
2013-10-02 16:11 ` [PATCH 3/3] perf tools: add hardware breakpoint bp_len test cases suravee.suthikulpanit
2013-10-02 16:15 ` [PATCH V5 0/3] perf/x86/amd: AMD Family 16h Data Breakpoint Extensions Oleg Nesterov
2013-10-02 16:54 ` Suravee Suthikulpanit
2013-10-31 9:43 ` Frederic Weisbecker
-- strict thread matches above, loose matches on Subject: below --
2013-04-28 6:05 [PATCH V4 " Jacob Shin
2013-04-28 6:05 ` [PATCH 2/3] perf tools: allow user to specify hardware breakpoint bp_len Jacob Shin
2013-04-26 18:57 [PATCH 0/3] perf/x86/amd: AMD Family 16h Data Breakpoint Extensions Jacob Shin
2013-04-26 18:57 ` [PATCH 2/3] perf tools: allow user to specify hardware breakpoint bp_len Jacob Shin
2013-04-27 16:58 ` Oleg Nesterov
2013-04-27 17:34 ` Oleg Nesterov
2013-04-28 5:44 ` Jacob Shin
2013-04-28 5:50 ` H. Peter Anvin
2013-04-28 16:12 ` Oleg Nesterov
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=20131210152532.GF10633@localhost.localdomain \
--to=fweisbec@gmail.com \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@ghostprotocols.net \
--cc=hpa@zytor.com \
--cc=jacob.w.shin@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mingo@redhat.com \
--cc=oleg@redhat.com \
--cc=sherry.hurwitz@amd.com \
--cc=suravee.suthikulpanit@amd.com \
--cc=tgl@domain.invalid \
/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;
as well as URLs for NNTP newsgroup(s).