Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147625
b: refs/heads/master
c: dcd945e
h: refs/heads/master
i:
  147623: 776327b
v: v3
  • Loading branch information
Paul Mackerras authored and Ingo Molnar committed Jun 3, 2009
1 parent c8909b1 commit 50e6f3e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 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: 6984efb692e97ce5f75f26e595685c04c2061bac
refs/heads/master: dcd945e0d8a6d654e3e1de51faea9f98f1504aa5
16 changes: 14 additions & 2 deletions trunk/arch/powerpc/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,16 +372,28 @@ static void write_mmcr0(struct cpu_hw_counters *cpuhw, unsigned long mmcr0)

/*
* Write MMCR0, then read PMC5 and PMC6 immediately.
* To ensure we don't get a performance monitor interrupt
* between writing MMCR0 and freezing/thawing the limited
* counters, we first write MMCR0 with the counter overflow
* interrupt enable bits turned off.
*/
asm volatile("mtspr %3,%2; mfspr %0,%4; mfspr %1,%5"
: "=&r" (pmc5), "=&r" (pmc6)
: "r" (mmcr0), "i" (SPRN_MMCR0),
: "r" (mmcr0 & ~(MMCR0_PMC1CE | MMCR0_PMCjCE)),
"i" (SPRN_MMCR0),
"i" (SPRN_PMC5), "i" (SPRN_PMC6));

if (mmcr0 & MMCR0_FC)
freeze_limited_counters(cpuhw, pmc5, pmc6);
else
thaw_limited_counters(cpuhw, pmc5, pmc6);

/*
* Write the full MMCR0 including the counter overflow interrupt
* enable bits, if necessary.
*/
if (mmcr0 & (MMCR0_PMC1CE | MMCR0_PMCjCE))
mtspr(SPRN_MMCR0, mmcr0);
}

/*
Expand Down Expand Up @@ -1108,7 +1120,7 @@ static void perf_counter_interrupt(struct pt_regs *regs)

for (i = 0; i < cpuhw->n_counters; ++i) {
counter = cpuhw->counter[i];
if (is_limited_pmc(counter->hw.idx))
if (!counter->hw.idx || is_limited_pmc(counter->hw.idx))
continue;
val = read_pmc(counter->hw.idx);
if ((int)val < 0) {
Expand Down

0 comments on commit 50e6f3e

Please sign in to comment.