lkml.org 
[lkml]   [2014]   [Feb]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v1 07/10] perf/x86/uncore: allow more than one fixed counter per box
Date
This patch modifies some of the helper functions to support
more than one fixed counter per uncore PCI PMU box.

Signed-off-by: Stephane Eranian <eranian@google.com>
---
arch/x86/kernel/cpu/perf_event_intel_uncore.c | 4 ++--
arch/x86/kernel/cpu/perf_event_intel_uncore.h | 22 +++++++++++++---------
2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.c b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
index 2980994c..69a4ad0 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c
@@ -2777,8 +2777,8 @@ static void uncore_assign_hw_event(struct intel_uncore_box *box, struct perf_eve
hwc->idx = idx;
hwc->last_tag = ++box->tags[idx];

- if (hwc->idx == UNCORE_PMC_IDX_FIXED) {
- hwc->event_base = uncore_fixed_ctr(box);
+ if (hwc->idx >= UNCORE_PMC_IDX_FIXED) {
+ hwc->event_base = uncore_fixed_ctr(box, idx);
hwc->config_base = uncore_fixed_ctl(box);
return;
}
diff --git a/arch/x86/kernel/cpu/perf_event_intel_uncore.h b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
index 433c180..c63a3ff 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_uncore.h
+++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.h
@@ -538,9 +538,18 @@ static inline unsigned uncore_pci_fixed_ctl(struct intel_uncore_box *box)
return box->pmu->type->fixed_ctl;
}

-static inline unsigned uncore_pci_fixed_ctr(struct intel_uncore_box *box)
+static inline int uncore_fixed_ctr_bits(struct intel_uncore_box *box)
+{
+ return box->pmu->type->fixed_ctr_bits;
+}
+
+static inline unsigned uncore_pci_fixed_ctr(struct intel_uncore_box *box,
+ int idx)
{
- return box->pmu->type->fixed_ctr;
+ int bits = uncore_fixed_ctr_bits(box);
+ int bytes = round_up(bits, 8);
+
+ return idx * bytes + box->pmu->type->fixed_ctr;
}

static inline
@@ -554,11 +563,6 @@ static inline int uncore_perf_ctr_bits(struct intel_uncore_box *box)
return box->pmu->type->perf_ctr_bits;
}

-static inline int uncore_fixed_ctr_bits(struct intel_uncore_box *box)
-{
- return box->pmu->type->fixed_ctr_bits;
-}
-
static inline
unsigned uncore_pci_perf_ctr(struct intel_uncore_box *box, int idx)
{
@@ -627,10 +631,10 @@ unsigned uncore_fixed_ctl(struct intel_uncore_box *box)
}

static inline
-unsigned uncore_fixed_ctr(struct intel_uncore_box *box)
+unsigned uncore_fixed_ctr(struct intel_uncore_box *box, int idx)
{
if (box->pci_dev)
- return uncore_pci_fixed_ctr(box);
+ return uncore_pci_fixed_ctr(box, idx);
else
return uncore_msr_fixed_ctr(box);
}
--
1.7.9.5


\
 
 \ /
  Last update: 2014-02-03 14:41    [W:0.113 / U:0.128 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site