mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 1/4] perf/x86/intel/uncore: use same idx for clinet IMC uncore events
Date: Thu, 19 Oct 2017 09:55:34 -0700	[thread overview]
Message-ID: <1508432137-3984-1-git-send-email-kan.liang@intel.com> (raw)

From: Kan Liang <Kan.liang@intel.com>

The clinet IMC uncore is the only one who claims two 'fixed counters'.
To specially handle it, event->hw.idx >= UNCORE_PMC_IDX_FIXED is used to
check fixed counters in the generic uncore_perf_event_update.
It does not have problem in current code. Because there are no counters
whose idx is larger than fixed counters. However, it will have problem
if new counter type is introduced in generic code. For example,
freerunning counters.

Actually, the 'fixed counters' in the clinet IMC uncore is not
traditional fixed counter. They are freerunning counters, which don't
need the idx to indicate which counter is assigned. They also have same
bits wide. So it's OK to let them use the same idx. event_base is good
enough to select the proper freerunning counter.

There is no traditional fixed counter in clinet IMC uncore. Let them use
the same idx as fixed event for clinet IMC uncore events.

The following patch will remove the special codes in generic
uncore_perf_event_update.

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_snb.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/uncore_snb.c b/arch/x86/events/intel/uncore_snb.c
index db1127c..107e772 100644
--- a/arch/x86/events/intel/uncore_snb.c
+++ b/arch/x86/events/intel/uncore_snb.c
@@ -400,6 +400,13 @@ static int snb_uncore_imc_event_init(struct perf_event *event)
 	event->hw.branch_reg.idx = EXTRA_REG_NONE;
 	/*
 	 * check event is known (whitelist, determines counter)
+	 *
+	 * The events and freerunning counters are 1:1 mapped.
+	 * The freerunning counters are always available.
+	 * It doesn't need hw.idx to indicate which counter is assigned.
+	 * There is no traditional fixed counter support for client IMC.
+	 * So let them reuse the same idx as fixed event.
+	 * Base will be used to get the proper freerunning counter.
 	 */
 	switch (cfg) {
 	case SNB_UNCORE_PCI_IMC_DATA_READS:
@@ -408,7 +415,7 @@ static int snb_uncore_imc_event_init(struct perf_event *event)
 		break;
 	case SNB_UNCORE_PCI_IMC_DATA_WRITES:
 		base = SNB_UNCORE_PCI_IMC_DATA_WRITES_BASE;
-		idx = UNCORE_PMC_IDX_FIXED + 1;
+		idx = UNCORE_PMC_IDX_FIXED;
 		break;
 	default:
 		return -EINVAL;
-- 
2.7.4

             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 kan.liang [this message]
2017-10-19 16:55 ` [PATCH V2 2/4] perf/x86/intel/uncore: inline function to check the fixed counter event kan.liang
2017-10-20 14:13   ` 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-1-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®