From: Peter Zijlstra <a.p.zijlstra@chello.nl>
To: Andi Kleen <andi@firstfloor.org>
Cc: linux-kernel@vger.kernel.org, fweisbec@gmail.com, mingo@elte.hu,
acme@redhat.com, eranian@google.com,
Andi Kleen <ak@linux.intel.com>
Subject: Re: [PATCH 1/3] perf-events: Add support for supplementary event registers
Date: Thu, 11 Nov 2010 20:09:14 +0100 [thread overview]
Message-ID: <1289502554.2084.153.camel@laptop> (raw)
In-Reply-To: <1289492117-18066-1-git-send-email-andi@firstfloor.org>
On Thu, 2010-11-11 at 17:15 +0100, Andi Kleen wrote:
> diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
> index ed63101..97133ec 100644
> --- a/arch/x86/kernel/cpu/perf_event.c
> +++ b/arch/x86/kernel/cpu/perf_event.c
> @@ -93,6 +93,8 @@ struct amd_nb {
> struct event_constraint event_constraints[X86_PMC_IDX_MAX];
> };
>
> +struct intel_percore;
> +
> #define MAX_LBR_ENTRIES 16
>
> struct cpu_hw_events {
> @@ -126,6 +128,8 @@ struct cpu_hw_events {
> void *lbr_context;
> struct perf_branch_stack lbr_stack;
> struct perf_branch_entry lbr_entries[MAX_LBR_ENTRIES];
There wants to be a comment here, this is definitely not LBR stuff.
> + int percore_used;
> + struct intel_percore *per_core;
Either per_core != NULL implies percore_used or it should be state
inside the struct.
>
> /*
> * AMD specific bits
> @@ -175,6 +179,24 @@ struct cpu_hw_events {
> #define for_each_event_constraint(e, c) \
> for ((e) = (c); (e)->weight; (e)++)
>
> +/*
> + * Extra registers for specific events.
> + * Some events need large masks and require external MSRs.
> + * Define a mapping to these extra registers.
> + */
> +
> +struct extra_reg {
> + unsigned event;
> + unsigned msr;
> + u64 config_mask;
> + u64 valid_mask;
> +};
s/unsigned/unsigned int/ (also later in the patch) and then align the
variable names.
> +
> +#define EVENT_EXTRA_REG(event, msr, m, vm) { event, msr, m, vm }
C99 initializers please
> +#define INTEL_EVENT_EXTRA_REG(event, msr, vm) \
> + EVENT_EXTRA_REG(event, msr, ARCH_PERFMON_EVENTSEL_EVENT, vm)
> +#define EVENT_EXTRA_END {}
Does that imply a zero filled struct?
> diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
> index c8f5c08..bbe7fba 100644
> --- a/arch/x86/kernel/cpu/perf_event_intel.c
> +++ b/arch/x86/kernel/cpu/perf_event_intel.c
> @@ -1,5 +1,14 @@
> #ifdef CONFIG_CPU_SUP_INTEL
>
> +struct intel_percore {
> + raw_spinlock_t lock;
> + int ref;
> + u64 config;
> + unsigned extra_reg;
> + u64 extra_config;
> +};
> +static DEFINE_PER_CPU(struct intel_percore, intel_percore);
Please dynamically allocate these when needed, just like the AMD
north-bridge structure.
> /*
> * Intel PerfMon, used on Core and later.
> */
> diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h
> index 057bf22..a353594 100644
> --- a/include/linux/perf_event.h
> +++ b/include/linux/perf_event.h
> @@ -224,7 +224,10 @@ struct perf_event_attr {
> };
>
> __u32 bp_type;
> - __u64 bp_addr;
> + union {
> + __u64 bp_addr;
> + __u64 event_extra; /* Extra for some events */
> + };
> __u64 bp_len;
> };
I think I like Stephane's suggestion better, frob them into the existing
u64 word, since its model specific and we still have 33 empty bits in
the control register there's plenty space.
next prev parent reply other threads:[~2010-11-11 19:09 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-11 16:15 [PATCH 1/3] perf-events: Add support for supplementary event registers Andi Kleen
2010-11-11 16:15 ` [PATCH 2/3] perf: Add support for extra parameters for raw events Andi Kleen
2010-11-11 17:54 ` Corey Ashford
2010-11-11 18:39 ` Andi Kleen
2010-11-11 19:38 ` Corey Ashford
2010-11-11 19:49 ` Andi Kleen
2010-11-11 19:59 ` Peter Zijlstra
2010-11-11 20:12 ` Andi Kleen
2010-11-11 20:37 ` Peter Zijlstra
2010-11-12 10:27 ` Andi Kleen
2010-11-12 10:49 ` Stephane Eranian
2010-11-12 11:36 ` Peter Zijlstra
2010-11-12 13:00 ` Stephane Eranian
2010-11-12 13:21 ` Peter Zijlstra
2010-11-12 14:03 ` Stephane Eranian
2010-11-12 13:30 ` Frederic Weisbecker
2010-11-12 15:00 ` Stephane Eranian
2010-11-12 10:41 ` Stephane Eranian
2010-11-12 10:48 ` Peter Zijlstra
2010-11-12 10:39 ` Stephane Eranian
2010-11-12 10:48 ` Andi Kleen
2010-11-12 10:52 ` Stephane Eranian
2010-11-12 10:56 ` Stephane Eranian
2010-11-11 16:15 ` [PATCH 3/3] perf-events: Fix LLC-* events on Intel Nehalem/Westmere Andi Kleen
2010-11-11 17:35 ` [PATCH/FIX] perf-events: Put the per cpu state for intel_pmu too Andi Kleen
2010-11-11 17:54 ` Stephane Eranian
2010-11-11 18:44 ` Andi Kleen
2010-11-11 21:29 ` Stephane Eranian
2010-11-11 18:06 ` [PATCH 1/3] perf-events: Add support for supplementary event registers Stephane Eranian
2010-11-11 18:42 ` Andi Kleen
2010-11-11 19:09 ` Peter Zijlstra [this message]
2010-11-11 19:25 ` Andi Kleen
2010-11-11 19:36 ` Peter Zijlstra
2010-11-11 19:45 ` Andi Kleen
2010-11-11 19:49 ` 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=1289502554.2084.153.camel@laptop \
--to=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=ak@linux.intel.com \
--cc=andi@firstfloor.org \
--cc=eranian@google.com \
--cc=fweisbec@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox