# HG changeset patch
# User Niraj Tolia <ntolia@xxxxxxxxx>
# Date 1231217146 28800
# Node ID eb1ad7bbdaf3ae553a6bf319180b5880f5ac4307
# Parent 8417ddc981b407753f966c568ef8c7b673d8d22a
Xenoprof patch to fix the counter overflow check for CPUs with counter
width > 32
I had to port this patch from mainline Linux where it can be found at
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=7c64ade53a6f977d73f16243865c42ceae999aea
Signed-off-by: Niraj Tolia <ntolia@xxxxxxxxx>
diff -r 8417ddc981b4 -r eb1ad7bbdaf3 xen/arch/x86/oprofile/op_model_ppro.c
--- a/xen/arch/x86/oprofile/op_model_ppro.c Mon Jan 05 11:10:54 2009 +0000
+++ b/xen/arch/x86/oprofile/op_model_ppro.c Mon Jan 05 20:45:46 2009 -0800
@@ -25,9 +25,8 @@
#define NUM_COUNTERS 2
#define NUM_CONTROLS 2
-#define CTR_READ(l,h,msrs,c) do {rdmsr(msrs->counters[(c)].addr, (l), (h));}
while (0)
#define CTR_WRITE(l,msrs,c) do {wrmsr(msrs->counters[(c)].addr, -(u32)(l),
-1);} while (0)
-#define CTR_OVERFLOWED(n) (!((n) & (1U<<31)))
+#define CTR_OVERFLOWED(n) (!((n) & (1ULL<<31)))
#define CTRL_READ(l,h,msrs,c) do {rdmsr((msrs->controls[(c)].addr), (l),
(h));} while (0)
#define CTRL_WRITE(l,h,msrs,c) do {wrmsr((msrs->controls[(c)].addr), (l),
(h));} while (0)
@@ -98,7 +97,7 @@ static int ppro_check_ctrs(unsigned int
struct op_msrs const * const msrs,
struct cpu_user_regs * const regs)
{
- unsigned int low, high;
+ u64 val;
int i;
int ovf = 0;
unsigned long eip = regs->eip;
@@ -107,8 +106,8 @@ static int ppro_check_ctrs(unsigned int
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)) {
xenoprof_log_event(current, regs, eip, mode, i);
CTR_WRITE(reset_value[i], msrs, i);
ovf = 1;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|