linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: kan.liang@intel.com
To: peterz@infradead.org, tglx@linutronix.de, 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: [RESEND PATCH V7 3/8] perf/x86/intel/uncore: Correct fixed counter index check in generic code
Date: Thu,  3 May 2018 11:25:08 -0700	[thread overview]
Message-ID: <1525371913-10597-3-git-send-email-kan.liang@intel.com> (raw)
In-Reply-To: <1525371913-10597-1-git-send-email-kan.liang@intel.com>

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

There is no index which is bigger than UNCORE_PMC_IDX_FIXED. The only
exception is client IMC uncore, which has been specially handled.
For generic code, it is not correct to use >= to check fixed counter.
The code quality issue will bring problem when a new counter index is
introduced.

Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Kan Liang <kan.liang@intel.com>
---

No changes since V6

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

diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c
index a7956fc..3b0f93e 100644
--- a/arch/x86/events/intel/uncore.c
+++ b/arch/x86/events/intel/uncore.c
@@ -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 (event->hw.idx == UNCORE_PMC_IDX_FIXED)
 		shift = 64 - uncore_fixed_ctr_bits(box);
 	else
 		shift = 64 - uncore_perf_ctr_bits(box);
-- 
2.7.4

  parent reply	other threads:[~2018-05-04  2:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 18:25 [RESEND PATCH V7 1/8] perf/x86/intel/uncore: Customized event_read() for client IMC uncore kan.liang
2018-05-03 18:25 ` [RESEND PATCH V7 2/8] perf/x86/intel/uncore: Correct fixed counter index check for NHM kan.liang
2018-05-31 12:30   ` [tip:perf/core] " tip-bot for Kan Liang
2018-05-03 18:25 ` kan.liang [this message]
2018-05-31 12:31   ` [tip:perf/core] perf/x86/intel/uncore: Correct fixed counter index check in generic code tip-bot for Kan Liang
2018-05-03 18:25 ` [RESEND PATCH V7 4/8] perf/x86/intel/uncore: Add new data structures for free running counters kan.liang
2018-05-31 12:31   ` [tip:perf/core] " tip-bot for Kan Liang
2018-05-03 18:25 ` [RESEND PATCH V7 5/8] perf/x86/intel/uncore: Add infrastructure for free running counter kan.liang
2018-05-31 12:32   ` [tip:perf/core] perf/x86/intel/uncore: Add infrastructure for free running counters tip-bot for Kan Liang
2018-05-03 18:25 ` [RESEND PATCH V7 6/8] perf/x86/intel/uncore: Support IIO free-running counters on SKX kan.liang
2018-05-31 12:32   ` [tip:perf/core] " tip-bot for Kan Liang
2018-05-03 18:25 ` [RESEND PATCH V7 7/8] perf/x86/intel/uncore: Expose uncore_pmu_event functions kan.liang
2018-05-31 12:33   ` [tip:perf/core] perf/x86/intel/uncore: Expose uncore_pmu_event*() functions tip-bot for Kan Liang
2018-05-03 18:25 ` [RESEND PATCH V7 8/8] perf/x86/intel/uncore: Clean up client IMC uncore kan.liang
2018-05-31 12:33   ` [tip:perf/core] " tip-bot for Kan Liang
2018-05-31 12:30 ` [tip:perf/core] perf/x86/intel/uncore: Introduce customized event_read() for " tip-bot for Kan Liang

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=1525371913-10597-3-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;
as well as URLs for NNTP newsgroup(s).