Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158199
b: refs/heads/master
c: 74c9a5c
h: refs/heads/master
i:
  158197: 0cbc9dc
  158195: cfc3ebd
  158191: 470f0a4
v: v3
  • Loading branch information
Robert Richter committed Jun 11, 2009
1 parent bda2366 commit 9e03e00
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d2731a4387ad6c6bca07abfe9ed41d450fb6d665
refs/heads/master: 74c9a5c341bb1f6cbb5095b07c77230f19682ce8
19 changes: 8 additions & 11 deletions trunk/arch/x86/oprofile/op_model_ppro.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ static int num_counters = 2;
static int counter_width = 32;

#define CTR_OVERFLOWED(n) (!((n) & (1ULL<<(counter_width-1))))

#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)
#define CTRL_CLEAR(x) (x &= (1<<21))
#define CTRL_SET_EVENT(val, e) (val |= e)

Expand Down Expand Up @@ -88,9 +85,9 @@ static void ppro_setup_ctrs(struct op_msrs const * const msrs)
for (i = 0 ; i < num_counters; ++i) {
if (unlikely(!CTRL_IS_RESERVED(msrs, i)))
continue;
CTRL_READ(low, high, msrs, i);
rdmsr(msrs->controls[i].addr, low, high);
CTRL_CLEAR(low);
CTRL_WRITE(low, high, msrs, i);
wrmsr(msrs->controls[i].addr, low, high);
}

/* avoid a false detection of ctr overflows in NMI handler */
Expand All @@ -107,14 +104,14 @@ static void ppro_setup_ctrs(struct op_msrs const * const msrs)

wrmsrl(msrs->counters[i].addr, -reset_value[i]);

CTRL_READ(low, high, msrs, i);
rdmsr(msrs->controls[i].addr, low, high);
CTRL_CLEAR(low);
CTRL_SET_ENABLE(low);
CTRL_SET_USR(low, counter_config[i].user);
CTRL_SET_KERN(low, counter_config[i].kernel);
CTRL_SET_UM(low, counter_config[i].unit_mask);
CTRL_SET_EVENT(low, counter_config[i].event);
CTRL_WRITE(low, high, msrs, i);
wrmsr(msrs->controls[i].addr, low, high);
} else {
reset_value[i] = 0;
}
Expand Down Expand Up @@ -162,9 +159,9 @@ static void ppro_start(struct op_msrs const * const msrs)
return;
for (i = 0; i < num_counters; ++i) {
if (reset_value[i]) {
CTRL_READ(low, high, msrs, i);
rdmsr(msrs->controls[i].addr, low, high);
CTRL_SET_ACTIVE(low);
CTRL_WRITE(low, high, msrs, i);
wrmsr(msrs->controls[i].addr, low, high);
}
}
}
Expand All @@ -180,9 +177,9 @@ static void ppro_stop(struct op_msrs const * const msrs)
for (i = 0; i < num_counters; ++i) {
if (!reset_value[i])
continue;
CTRL_READ(low, high, msrs, i);
rdmsr(msrs->controls[i].addr, low, high);
CTRL_SET_INACTIVE(low);
CTRL_WRITE(low, high, msrs, i);
wrmsr(msrs->controls[i].addr, low, high);
}
}

Expand Down

0 comments on commit 9e03e00

Please sign in to comment.