From: kan.liang@intel.com
To: tglx@linutronix.de, peterz@infradead.org, mingo@redhat.com,
linux-kernel@vger.kernel.org
Cc: acme@kernel.org, eranian@google.com, ak@linux.intel.com,
Kan Liang <Kan.liang@intel.com>
Subject: [PATCH V2 2/4] perf/x86/intel/uncore: inline function to check the fixed counter event
Date: Thu, 19 Oct 2017 09:55:35 -0700 [thread overview]
Message-ID: <1508432137-3984-2-git-send-email-kan.liang@intel.com> (raw)
In-Reply-To: <1508432137-3984-1-git-send-email-kan.liang@intel.com>
From: Kan Liang <Kan.liang@intel.com>
Remove the special codes in generic uncore_perf_event_update.
Introduce inline function to check the fixed counter event.
Signed-off-by: Kan Liang <Kan.liang@intel.com>
---
Changes since V1:
- New file to address check event->hw.idx >= UNCORE_PMC_IDX_FIXED
arch/x86/events/intel/uncore.c | 4 ++--
arch/x86/events/intel/uncore.h | 5 +++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index 1c5390f..76c1c78 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -203,7 +203,7 @@ static void uncore_assign_hw_event(struct intel_uncore_box *box,
hwc->idx = idx;
hwc->last_tag = ++box->tags[idx];
- if (hwc->idx == UNCORE_PMC_IDX_FIXED) {
+ if (uncore_pmc_fixed(hwc->idx)) {
hwc->event_base = uncore_fixed_ctr(box);
hwc->config_base = uncore_fixed_ctl(box);
return;
@@ -218,7 +218,7 @@ void uncore_perf_event_update(struct intel_uncore_box *box, struct perf_event *e
u64 prev_count, new_count, delta;
int shift;
- if (event->hw.idx >= UNCORE_PMC_IDX_FIXED)
+ if (uncore_pmc_fixed(event->hw.idx))
shift = 64 - uncore_fixed_ctr_bits(box);
else
shift = 64 - uncore_perf_ctr_bits(box);
diff --git a/arch/x86/events/intel/uncore.h b/arch/x86/events/intel/uncore.h
index df5989f..0ff08fba 100644
--- a/arch/x86/events/intel/uncore.h
+++ b/arch/x86/events/intel/uncore.h
@@ -156,6 +156,11 @@ static ssize_t __uncore_##_var##_show(struct kobject *kobj, \
static struct kobj_attribute format_attr_##_var = \
__ATTR(_name, 0444, __uncore_##_var##_show, NULL)
+static inline bool uncore_pmc_fixed(int idx)
+{
+ return (idx == UNCORE_PMC_IDX_FIXED);
+}
+
static inline unsigned uncore_pci_box_ctl(struct intel_uncore_box *box)
{
return box->pmu->type->box_ctl;
--
2.7.4
next prev parent reply other threads:[~2017-10-19 16:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-19 16:55 [PATCH V2 1/4] perf/x86/intel/uncore: use same idx for clinet IMC uncore events kan.liang
2017-10-19 16:55 ` kan.liang [this message]
2017-10-20 14:13 ` [PATCH V2 2/4] perf/x86/intel/uncore: inline function to check the fixed counter event Thomas Gleixner
2017-10-19 16:55 ` [PATCH V2 3/4] perf/x86/intel/uncore: add infrastructure for freerunning counters kan.liang
2017-10-20 14:15 ` Thomas Gleixner
2017-10-19 16:55 ` [PATCH V2 4/4] perf/x86/intel/uncore: SKX support for IIO freerunning counter kan.liang
2017-10-20 14:15 ` Thomas Gleixner
2017-10-20 14:12 ` [PATCH V2 1/4] perf/x86/intel/uncore: use same idx for clinet IMC uncore events Thomas Gleixner
2017-10-20 15:04 ` Liang, Kan
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=1508432137-3984-2-git-send-email-kan.liang@intel.com \
--to=kan.liang@intel.com \
--cc=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=eranian@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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
all inboxes | Powered by JetHome®