login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
December
»
1
Re: [PATCH 2/3] perf-events: Add support for supplementary event registers v4
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
[view in full thread]
From: Peter Zijlstra
Subject:
Re: [PATCH 2/3] perf-events: Add support for supplementary event registers v4
Date: Wednesday, December 1, 2010 - 7:26 am
On Mon, 2010-11-29 at 14:12 +0100, Andi Kleen wrote:
quoted text
> diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c > index 817d2b1..a6754ea 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 { > @@ -128,6 +130,13 @@ struct cpu_hw_events { > struct perf_branch_entry lbr_entries[MAX_LBR_ENTRIES]; > > /* > + * Intel percore register state. > + * Coordinate shared resources between HT threads. > + */ > + int percore_used; /* Used by this CPU? */ > + struct intel_percore *per_core; > + > + /* > * AMD specific bits > */ > struct amd_nb *amd_nb;
quoted text
> +/* > + * Per core state > + * This used to coordinate shared registers for HT threads. > + */ > +struct intel_percore { > + raw_spinlock_t lock; /* protect structure */ > + struct er_account regs[MAX_EXTRA_REGS]; > + int refcnt; /* number of threads */ > + unsigned core_id; > +}; > + > /* > * Intel PerfMon, used on Core and later. > */
quoted text
> +static int intel_pmu_cpu_prepare(int cpu) > +{ > + struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); > + > + cpuc->per_core = kzalloc_node(sizeof(struct intel_percore), > + GFP_KERNEL, cpu_to_node(cpu)); > + if (!cpuc->per_core) > + return NOTIFY_BAD; > + > + raw_spin_lock_init(&cpuc->per_core->lock); > + cpuc->per_core->core_id = -1; > + return NOTIFY_OK; > +} > + > static void intel_pmu_cpu_starting(int cpu) > { > + struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); > + int core_id = topology_core_id(cpu); > + int i; > + > + for_each_online_cpu(i) { > + struct intel_percore *pc = per_cpu(cpu_hw_events, i).per_core; > + > + if (pc && pc->core_id == core_id) { > + kfree(cpuc->per_core); > + cpuc->per_core = pc; > + break; > + } > + } > + > + cpuc->per_core->core_id = core_id; > + cpuc->per_core->refcnt++; > + > init_debug_store_on_cpu(cpu); > /* > * Deal with CPUs that don't clear their LBRs on power-up. > @@ -868,6 +1049,15 @@ static void intel_pmu_cpu_starting(int cpu) > > static void intel_pmu_cpu_dying(int cpu) > { > + struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu); > + struct intel_percore *pc = cpuc->per_core; > + > + if (pc) { > + if (pc->core_id == -1 || --pc->refcnt == 0) > + kfree(pc); > + cpuc->per_core = NULL; > + } > + > fini_debug_store_on_cpu(cpu); > } > > @@ -892,7 +1082,9 @@ static __initconst const struct x86_pmu intel_pmu = { > */ > .max_period = (1ULL << 31) - 1, > .get_event_constraints = intel_get_event_constraints, > + .put_event_constraints = intel_put_event_constraints, > > + .cpu_prepare = intel_pmu_cpu_prepare, > .cpu_starting = intel_pmu_cpu_starting, > .cpu_dying = intel_pmu_cpu_dying, > }; > @@ -1010,7 +1202,10 @@ static __init int intel_pmu_init(void) > intel_pmu_lbr_init_nhm(); > > x86_pmu.event_constraints = intel_nehalem_event_constraints; > + x86_pmu.percore_constraints = > + intel_nehalem_percore_constraints; > x86_pmu.enable_all = intel_pmu_nhm_enable_all; > + x86_pmu.extra_regs = intel_nehalem_extra_regs; > pr_cont("Nehalem events, "); > break; > > @@ -1032,7 +1227,10 @@ static __init int intel_pmu_init(void) > intel_pmu_lbr_init_nhm(); > > x86_pmu.event_constraints = intel_westmere_event_constraints; > + x86_pmu.percore_constraints = > + intel_westmere_percore_constraints; > x86_pmu.enable_all = intel_pmu_nhm_enable_all; > + x86_pmu.extra_regs = intel_westmere_extra_regs; > pr_cont("Westmere events, "); > break; >
You seem to have lost the needs_percore stuff. --
unsubscribe notice
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/
Previous message: [
thread
] [
date
] [
author
]
Next message: [thread] [
date
] [
author
]
Messages in current thread:
Updated perf offcore patchkit
, Andi Kleen
, (Mon Nov 29, 6:12 am)
[PATCH 1/3] perf: Document enhanced event encoding for OFF ...
, Andi Kleen
, (Mon Nov 29, 6:12 am)
[PATCH 2/3] perf-events: Add support for supplementary eve ...
, Andi Kleen
, (Mon Nov 29, 6:12 am)
Re: [PATCH 2/3] perf-events: Add support for supplementary ...
, Peter Zijlstra
, (Wed Dec 1, 7:26 am)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Mel Gorman
Re: [PATCH 1/4] vmstat: remove zone->lock from walk_zones_in_node
Guenter Roeck
Re: [lm-sensors] Location for thermal drivers
David Woodhouse
Re: RFC: Moving firmware blobs out of the kernel.
Siddha, Suresh B
Re: [PATCH 2.6.21 review I] [11/25] x86: default to physical mode on hotplug CPU k...
Peter Zijlstra
Re: [patch 4/6] mm: merge populate and nopage into fault (fixes nonlinear)
git-commits-head
:
Linux Kernel Mailing List
[MIPS] Fix potential latency problem due to non-atomic cpu_wait.
Linux Kernel Mailing List
USB: rename USB_SPEED_VARIABLE to USB_SPEED_WIRELESS
Linux Kernel Mailing List
lib/vsprintf.c: fix bug omitting minus sign of numbers (module_param)
Linux Kernel Mailing List
[Bluetooth] Initiate authentication during connection establishment
Linux Kernel Mailing List
[POWERPC] 4xx: Add ppc40x_defconfig
linux-netdev
:
MERCEDES
Your mail id has won 950,000.00 in the MERCEDES Benz Online Promo.for claims send:
David Miller
Re: [PATCH] xen/netfront: do not mark packets of length < MSS as GSO
David Miller
Re: skb_segment() questions
Shan Wei
[RFC PATCH net-next 2/5]IPv6:netfilter: Send an ICMPv6 "Fragment Reassembly Timeou...
Stanislaw Gruszka
[PATCH 1/4] bnx2x: use smp_mb() to keep ordering of read write operations
git
:
Nicolas Sebrecht
git-svn died of signal 11 (was "3 failures on test t9100 (svn)")
Junio C Hamano
Re: [PATCH 2/2] Add url.<base>.pushInsteadOf: URL rewriting for push only
Martin Langhoff
Re: [PATCH] GIT commit statistics.
Alexandre Julliard
[PATCH] gitweb: Put back shortlog instead of graphiclog in the project list.
Josh Triplett
[PATCH 2/2] Add url.<base>.pushInsteadOf: URL rewriting for push only
openbsd-misc
:
Taisto Qvist XX
Re: AMD GEODE LX-800 just works with kernel from install42.iso and kernelpanics wi...
Nico Meijer
Re: gOS Develop Kit with VIA pc-1 Processor Platform VIA C7-D
Andreas Bihlmaier
Re: jetway board sensors (Fintek F71805F)
admin
Drive a 2009 car from R799p/m
Antti Harri
Re: how to create a sha256 hash
Colocation donated by:
Syndicate