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 V4 2/8] perf/x86/intel/uncore: correct fixed counter index check for NHM
Date: Thu,  2 Nov 2017 13:29:47 -0700	[thread overview]
Message-ID: <1509654593-4446-2-git-send-email-kan.liang@intel.com> (raw)
In-Reply-To: <1509654593-4446-1-git-send-email-kan.liang@intel.com>

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

For Nehalem and Westmere, there is only one fixed counter for W-Box.
There is no index which is bigger than UNCORE_PMC_IDX_FIXED.
It is not correct to use >= to check fixed counter.
The code quality issue will bring problem when new counter index is
introduced.

Signed-off-by: Kan Liang <Kan.liang@intel.com>
---

Changes since V3:
 - New patch for similar '>=' issue on NHM.

 arch/x86/events/intel/uncore_nhmex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/events/intel/uncore_nhmex.c b/arch/x86/events/intel/uncore_nhmex.c
index 6a5cbe9..6f0d0da 100644
--- a/arch/x86/events/intel/uncore_nhmex.c
+++ b/arch/x86/events/intel/uncore_nhmex.c
@@ -245,7 +245,7 @@ static void nhmex_uncore_msr_enable_event(struct intel_uncore_box *box, struct p
 {
 	struct hw_perf_event *hwc = &event->hw;
 
-	if (hwc->idx >= UNCORE_PMC_IDX_FIXED)
+	if (hwc->idx == UNCORE_PMC_IDX_FIXED)
 		wrmsrl(hwc->config_base, NHMEX_PMON_CTL_EN_BIT0);
 	else if (box->pmu->type->event_mask & NHMEX_PMON_CTL_EN_BIT0)
 		wrmsrl(hwc->config_base, hwc->config | NHMEX_PMON_CTL_EN_BIT22);
-- 
2.7.4

  reply	other threads:[~2017-11-02 20:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-02 20:29 [PATCH V4 1/8] perf/x86/intel/uncore: customized event_read for client IMC uncore kan.liang
2017-11-02 20:29 ` kan.liang [this message]
2018-01-14 20:47   ` [PATCH V4 2/8] perf/x86/intel/uncore: correct fixed counter index check for NHM Thomas Gleixner
2017-11-02 20:29 ` [PATCH V4 3/8] perf/x86/intel/uncore: correct fixed counter index check in generic code kan.liang
2018-01-14 20:47   ` Thomas Gleixner
2017-11-02 20:29 ` [PATCH V4 4/8] perf/x86/intel/uncore: add new data structures for free running counters kan.liang
2018-01-14 20:50   ` Thomas Gleixner
2018-01-14 20:52     ` Thomas Gleixner
2017-11-02 20:29 ` [PATCH V4 5/8] perf/x86/intel/uncore: add infrastructure for free running counter kan.liang
2018-01-14 20:52   ` Thomas Gleixner
2018-01-15 15:53     ` Liang, Kan
2017-11-02 20:29 ` [PATCH V4 6/8] perf/x86/intel/uncore: SKX support for IIO free running counters kan.liang
2018-01-14 20:54   ` Thomas Gleixner
2017-11-02 20:29 ` [PATCH V4 7/8] perf/x86/intel/uncore: expose uncore_pmu_event functions kan.liang
2018-01-14 20:53   ` Thomas Gleixner
2017-11-02 20:29 ` [PATCH V4 8/8] perf/x86/intel/uncore: clean up client IMC uncore kan.liang
2018-01-14 20:53   ` Thomas Gleixner
2017-11-17  2:18 ` [PATCH V4 1/8] perf/x86/intel/uncore: customized event_read for " Liang, Kan
2017-11-17  8:46   ` Thomas Gleixner
2017-12-11 13:53     ` 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=1509654593-4446-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®