Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147355
b: refs/heads/master
c: ca8f2d7
h: refs/heads/master
i:
  147353: 549c71e
  147351: 97e12fe
v: v3
  • Loading branch information
Paul Mackerras authored and Ingo Molnar committed Apr 9, 2009
1 parent daf458b commit f6daace
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 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: 6c0b324435ff49fb3c68fe808a93853d81c7fb97
refs/heads/master: ca8f2d7f019a8547f39ddb9ed0144932f12807f2
31 changes: 17 additions & 14 deletions trunk/arch/powerpc/kernel/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ hw_perf_counter_init(struct perf_counter *counter)
* here so there is no possibility of being interrupted.
*/
static void record_and_restart(struct perf_counter *counter, long val,
struct pt_regs *regs)
struct pt_regs *regs, int nmi)
{
s64 prev, delta, left;
int record = 0;
Expand Down Expand Up @@ -749,7 +749,7 @@ static void record_and_restart(struct perf_counter *counter, long val,
* Finally record data if requested.
*/
if (record)
perf_counter_overflow(counter, 1, regs, 0);
perf_counter_overflow(counter, nmi, regs, 0);
}

/*
Expand All @@ -762,14 +762,25 @@ static void perf_counter_interrupt(struct pt_regs *regs)
struct perf_counter *counter;
long val;
int found = 0;
int nmi;

/*
* If interrupts were soft-disabled when this PMU interrupt
* occurred, treat it as an NMI.
*/
nmi = !regs->softe;
if (nmi)
nmi_enter();
else
irq_enter();

for (i = 0; i < cpuhw->n_counters; ++i) {
counter = cpuhw->counter[i];
val = read_pmc(counter->hw.idx);
if ((int)val < 0) {
/* counter has overflowed */
found = 1;
record_and_restart(counter, val, regs);
record_and_restart(counter, val, regs, nmi);
}
}

Expand All @@ -796,18 +807,10 @@ static void perf_counter_interrupt(struct pt_regs *regs)
*/
mtspr(SPRN_MMCR0, cpuhw->mmcr[0]);

/*
* If we need a wakeup, check whether interrupts were soft-enabled
* when we took the interrupt. If they were, we can wake stuff up
* immediately; otherwise we'll have do the wakeup when interrupts
* get soft-enabled.
*/
if (test_perf_counter_pending() && regs->softe) {
irq_enter();
clear_perf_counter_pending();
perf_counter_do_pending();
if (nmi)
nmi_exit();
else
irq_exit();
}
}

void hw_perf_counter_setup(int cpu)
Expand Down

0 comments on commit f6daace

Please sign in to comment.