LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andi Kleen <andi@firstfloor.org>
To: Eric Dumazet <dada1@cosmosbay.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Pekka J Enberg <penberg@cs.helsinki.fi>,
	Robert Richter <robert.richter@amd.com>,
	Andi Kleen <andi@firstfloor.org>,
	linux kernel <linux-kernel@vger.kernel.org>,
	Andi Kleen <ak@linux.intel.com>
Subject: Re: linux-2.6.28-rc2 regression : oprofile doesnt work anymore ?
Date: Fri, 7 Nov 2008 14:02:49 +0100	[thread overview]
Message-ID: <20081107130249.GN29626@one.firstfloor.org> (raw)
In-Reply-To: <49130694.7000007@cosmosbay.com>


Can you please test this patch and see if it solves the problem?

Thanks,
-Andi

---

oprofile: Fix p6 counter overflow check

Fix the counter overflow check for CPUs with counter width > 32

I had a similar change in a different patch that I didn't submit
and I didn't notice the problem earlier because it was always
tested together.

Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
 arch/x86/oprofile/op_model_ppro.c |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Index: linux-2.6.28-rc3-test/arch/x86/oprofile/op_model_ppro.c
===================================================================
--- linux-2.6.28-rc3-test.orig/arch/x86/oprofile/op_model_ppro.c	2008-11-07 13:46:23.000000000 +0100
+++ linux-2.6.28-rc3-test/arch/x86/oprofile/op_model_ppro.c	2008-11-07 13:50:57.000000000 +0100
@@ -27,8 +27,7 @@
 static int counter_width = 32;
 
 #define CTR_IS_RESERVED(msrs, c) (msrs->counters[(c)].addr ? 1 : 0)
-#define CTR_READ(l, h, msrs, c) do {rdmsr(msrs->counters[(c)].addr, (l), (h)); } while (0)
-#define CTR_OVERFLOWED(n) (!((n) & (1U<<(counter_width-1))))
+#define CTR_OVERFLOWED(n) (!((n) & (1ULL<<(counter_width-1))))
 
 #define CTRL_IS_RESERVED(msrs, c) (msrs->controls[(c)].addr ? 1 : 0)
 #define CTRL_READ(l, h, msrs, c) do {rdmsr((msrs->controls[(c)].addr), (l), (h)); } while (0)
@@ -124,14 +123,14 @@
 static int ppro_check_ctrs(struct pt_regs * const regs,
 			   struct op_msrs const * const msrs)
 {
-	unsigned int low, high;
+	u64 val;
 	int i;
 
 	for (i = 0 ; i < num_counters; ++i) {
 		if (!reset_value[i])
 			continue;
-		CTR_READ(low, high, msrs, i);
-		if (CTR_OVERFLOWED(low)) {
+		rdmsrl(msrs->counters[i].addr, val);
+		if (CTR_OVERFLOWED(val)) {
 			oprofile_add_sample(regs, i);
 			wrmsrl(msrs->counters[i].addr, -reset_value[i]);
 		}


-- 
ak@linux.intel.com

  reply	other threads:[~2008-11-07 12:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-30 18:01 Eric Dumazet
2008-10-31 14:21 ` Pekka Enberg
2008-11-04 18:18   ` Robert Richter
2008-11-04 19:19     ` Pekka J Enberg
2008-11-04 22:32       ` Eric Dumazet
2008-11-05  6:09         ` Eric Dumazet
2008-11-06 15:00           ` Eric Dumazet
2008-11-07 13:02             ` Andi Kleen [this message]
2008-11-07 15:13               ` Eric Dumazet
2008-11-07 16:05                 ` Andi Kleen
2008-11-07 16:12                   ` Eric Dumazet
2008-11-07 16:47                     ` Andi Kleen
2008-11-07 16:51                       ` Eric Dumazet
2008-11-07 16:26               ` Robert Richter
2008-11-04 22:58       ` Andi Kleen
2008-11-04 20:09     ` Andi Kleen
2008-10-31 16:08 ` Jesper Dangaard Brouer
2008-11-01  2:29 ` Robert Richter

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=20081107130249.GN29626@one.firstfloor.org \
    --to=andi@firstfloor.org \
    --cc=ak@linux.intel.com \
    --cc=dada1@cosmosbay.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=penberg@cs.helsinki.fi \
    --cc=robert.richter@amd.com \
    --subject='Re: linux-2.6.28-rc2 regression : oprofile doesnt work anymore ?' \
    /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

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).