From: Robert Richter <robert.richter@amd.com>
To: Stephane Eranian <eranian@google.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 11/12] perf, x86: implement AMD IBS event configuration
Date: Tue, 11 May 2010 15:57:32 +0200 [thread overview]
Message-ID: <20100511135732.GL6450@erda.amd.com> (raw)
In-Reply-To: <r2sbd4cb8901004210437i343850b4z94ca99b9ec0316b6@mail.gmail.com>
On 21.04.10 13:37:27, Stephane Eranian wrote:
> Robert,
>
> Some more comments about model_spec.
>
> > Except for the sample period IBS can only be set up with raw (model
> > specific) config values and raw data samples. The event attributes for
> > the syscall should be programmed like this (IBS_FETCH):
> >
> > memset(&attr, 0, sizeof(attr));
> > attr.type = PERF_TYPE_RAW;
> > attr.sample_type = PERF_SAMPLE_CPU | PERF_SAMPLE_RAW;
> > attr.config = IBS_FETCH_CONFIG_DEFAULT
> > attr.config |=
> > ((unsigned long long)MODEL_SPEC_TYPE_IBS_FETCH << 32)
> > & MODEL_SPEC_TYPE_MASK;
> > attr.model_spec = 1;
> >
> Why do you need model_spec, in addition to your special encoding?
>
> > /*
> > + * Model specific hardware events
> > + *
> > + * With the attr.model_spec bit set we can setup hardware events
> > + * others than generic performance counters. A special PMU 64 bit
> > + * config value can be passed through the perf_event interface. The
> > + * concept of PMU model-specific arguments was practiced already in
> > + * Perfmon2. The type of event (8 bits) is determinded from the config
> > + * value too, bit 32-39 are reserved for this.
> > + */
> Isn't the config field big enough to encode all the information you need?
> In the kernel, you could check bit 32-39 and based on host CPU determine
> whether it refers to IBS or is a bogus value. I am trying to figure out what
> model_spec buys you. I believe RAW does not mean the final value as
> accepted by HW but a value that must be interpreted by the model-specific
> code to eventually come up with a raw HW value. In the current code, the
> RAW value is never passed as is, it is assembled from various bits and
> pieces incl. attr.config of course.
What about introducing a raw_type? We could reuse the unused bp_type
space for this. There is no longer the model_spec flag necessary and
we could pass the raw 64 bit config value without shifting bits to
encode the type there.
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
index 4924c96..c9b51b3 100644
--- a/include/linux/perf_event.h
+++ b/include/linux/perf_event.h
@@ -222,7 +222,10 @@ struct perf_event_attr {
__u32 wakeup_watermark; /* bytes before wakeup */
};
- __u32 bp_type;
+ union {
+ __u32 bp_type;
+ __u32 raw_type;
+ }
__u64 bp_addr;
__u64 bp_len;
};
Raw type would be architecure specific, e.g. for x86:
enum perf_raw_type {
PERF_RAW_PERFCTR = 0,
PERF_RAW_IBS_FETCH = 1,
PERF_RAW_IBS_OP = 2,
PERF_RAW_MAX,
};
Null is the architecture's default.
The raw event syntax could be suffixed by the type (as for
breakpoints):
-e rNNN[:TYPE]
Example:
perf record -e r186A:1 # ... meaning IBD fetch, cycle count 100000
perf record -e r0:1 -c 100000 # ... the same
Or with named types:
perf record -e r186A:IBS_FETCH ...
perf record -e r0:IBS_FETCH -c 100000 ...
I would prefer this solution as it has a number of advantages: A raw
event type may be specified without to encode the type in the config
value. The attr flags are not 'polluted'. We can follow the already
existing breakpoint concept in syntax and encoding.
-Robert
--
Advanced Micro Devices, Inc.
Operating System Research Center
email: robert.richter@amd.com
next prev parent reply other threads:[~2010-05-11 13:57 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-13 20:23 [PATCH 00/12] perf: introduce model specific events and AMD IBS Robert Richter
2010-04-13 20:23 ` [PATCH 01/12] perf, x86: move perfctr init code to x86_setup_perfctr() Robert Richter
2010-05-07 18:42 ` [tip:perf/core] perf, x86: Move " tip-bot for Robert Richter
2010-04-13 20:23 ` [PATCH 02/12] perf, x86: moving x86_setup_perfctr() Robert Richter
2010-05-07 18:42 ` [tip:perf/core] perf, x86: Move x86_setup_perfctr() tip-bot for Robert Richter
2010-04-13 20:23 ` [PATCH 03/12] perf, x86: call x86_setup_perfctr() from .hw_config() Robert Richter
2010-05-07 18:42 ` [tip:perf/core] perf, x86: Call " tip-bot for Robert Richter
2010-04-13 20:23 ` [PATCH 04/12] perf: introduce flag for model specific events Robert Richter
2010-04-13 20:23 ` [PATCH 05/12] perf, x86: pass enable bit mask to __x86_pmu_enable_event() Robert Richter
2010-05-07 18:43 ` [tip:perf/core] perf, x86: Pass " tip-bot for Robert Richter
2010-04-13 20:23 ` [PATCH 06/12] perf, x86: use weight instead of cmask in for_each_event_constraint() Robert Richter
2010-05-07 18:43 ` [tip:perf/core] perf, x86: Use " tip-bot for Robert Richter
2010-04-13 20:23 ` [PATCH 07/12] perf, x86: introduce bit range for special pmu events Robert Richter
2010-04-13 20:23 ` [PATCH 08/12] perf, x86: modify some code to allow the introduction of ibs events Robert Richter
2010-04-13 20:23 ` [PATCH 09/12] perf, x86: implement IBS feature detection Robert Richter
2010-04-13 20:23 ` [PATCH 10/12] perf, x86: setup NMI handler for IBS Robert Richter
2010-04-15 12:57 ` Peter Zijlstra
2010-04-15 13:11 ` Robert Richter
2010-04-19 16:04 ` Robert Richter
2010-04-13 20:23 ` [PATCH 11/12] perf, x86: implement AMD IBS event configuration Robert Richter
2010-04-19 13:46 ` Stephane Eranian
2010-04-20 10:31 ` Robert Richter
2010-04-20 16:05 ` Robert Richter
2010-04-21 8:47 ` Robert Richter
2010-04-21 9:02 ` Stephane Eranian
2010-04-21 9:21 ` Robert Richter
2010-04-21 10:54 ` Robert Richter
2010-04-21 11:37 ` Stephane Eranian
2010-04-21 16:58 ` Robert Richter
2010-04-22 17:32 ` Stephane Eranian
2010-05-11 13:57 ` Robert Richter [this message]
2010-04-13 20:23 ` [PATCH 12/12] perf, x86: implement the ibs interrupt handler Robert Richter
2010-04-19 12:19 ` Stephane Eranian
2010-04-20 13:10 ` Robert Richter
2010-04-22 14:45 ` Robert Richter
2010-05-07 15:28 ` [PATCH] perf: fix raw sample size if no sampling data is attached Robert Richter
2010-05-07 15:41 ` Peter Zijlstra
2010-05-07 19:48 ` Robert Richter
2010-05-18 15:12 ` [RFC PATCH] perf: align raw sample data on 64-bit boundaries Robert Richter
2010-05-19 7:39 ` Frederic Weisbecker
2010-05-19 9:31 ` Robert Richter
2010-05-24 21:25 ` Frederic Weisbecker
2010-05-28 17:35 ` Robert Richter
2010-04-13 20:45 ` [osrc-patches] [PATCH 00/12] perf: introduce model specific events and AMD IBS Robert Richter
2010-04-14 12:31 ` Robert Richter
2010-04-15 7:41 ` Peter Zijlstra
2010-04-15 7:44 ` Peter Zijlstra
2010-04-15 15:16 ` Robert Richter
2010-04-21 12:11 ` Peter Zijlstra
2010-04-21 13:21 ` Stephane Eranian
2010-04-21 18:26 ` Robert Richter
2010-04-21 18:40 ` Stephane Eranian
2010-04-21 16:28 ` Robert Richter
2010-04-28 16:16 ` [osrc-patches] " Robert Richter
2010-05-04 14:18 ` Peter Zijlstra
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=20100511135732.GL6450@erda.amd.com \
--to=robert.richter@amd.com \
--cc=a.p.zijlstra@chello.nl \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.