Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147505
b: refs/heads/master
c: 48e22d5
h: refs/heads/master
i:
  147503: 1ea3c8f
v: v3
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed May 25, 2009
1 parent e844e7c commit 0075d24
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 47 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: ff99be573e02e9f7edc23b472c7f9a5ddba12795
refs/heads/master: 48e22d56ecdeddd1ffb42a02fccba5c6ef42b133
2 changes: 0 additions & 2 deletions trunk/arch/x86/kernel/apic/apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,8 +763,6 @@ static void local_apic_timer_interrupt(void)
inc_irq_stat(apic_timer_irqs);

evt->event_handler(evt);

perf_counter_unthrottle();
}

/*
Expand Down
47 changes: 5 additions & 42 deletions trunk/arch/x86/kernel/cpu/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -718,11 +718,6 @@ static void intel_pmu_save_and_restart(struct perf_counter *counter)
intel_pmu_enable_counter(hwc, idx);
}

/*
* Maximum interrupt frequency of 100KHz per CPU
*/
#define PERFMON_MAX_INTERRUPTS (100000/HZ)

/*
* This handler is triggered by the local APIC, so the APIC IRQ handling
* rules apply:
Expand Down Expand Up @@ -775,15 +770,14 @@ static int intel_pmu_handle_irq(struct pt_regs *regs, int nmi)
if (status)
goto again;

if (++cpuc->interrupts != PERFMON_MAX_INTERRUPTS)
perf_enable();
perf_enable();

return 1;
}

static int amd_pmu_handle_irq(struct pt_regs *regs, int nmi)
{
int cpu, idx, throttle = 0, handled = 0;
int cpu, idx, handled = 0;
struct cpu_hw_counters *cpuc;
struct perf_counter *counter;
struct hw_perf_counter *hwc;
Expand All @@ -792,62 +786,31 @@ static int amd_pmu_handle_irq(struct pt_regs *regs, int nmi)
cpu = smp_processor_id();
cpuc = &per_cpu(cpu_hw_counters, cpu);

if (++cpuc->interrupts == PERFMON_MAX_INTERRUPTS) {
throttle = 1;
__perf_disable();
cpuc->enabled = 0;
barrier();
}

for (idx = 0; idx < x86_pmu.num_counters; idx++) {
int disable = 0;

if (!test_bit(idx, cpuc->active_mask))
continue;

counter = cpuc->counters[idx];
hwc = &counter->hw;

if (counter->hw_event.nmi != nmi)
goto next;
continue;

val = x86_perf_counter_update(counter, hwc, idx);
if (val & (1ULL << (x86_pmu.counter_bits - 1)))
goto next;
continue;

/* counter overflow */
x86_perf_counter_set_period(counter, hwc, idx);
handled = 1;
inc_irq_stat(apic_perf_irqs);
disable = perf_counter_overflow(counter, nmi, regs, 0);

next:
if (disable || throttle)
if (perf_counter_overflow(counter, nmi, regs, 0))
amd_pmu_disable_counter(hwc, idx);
}

return handled;
}

void perf_counter_unthrottle(void)
{
struct cpu_hw_counters *cpuc;

if (!x86_pmu_initialized())
return;

cpuc = &__get_cpu_var(cpu_hw_counters);
if (cpuc->interrupts >= PERFMON_MAX_INTERRUPTS) {
/*
* Clear them before re-enabling irqs/NMIs again:
*/
cpuc->interrupts = 0;
perf_enable();
} else {
cpuc->interrupts = 0;
}
}

void smp_perf_counter_interrupt(struct pt_regs *regs)
{
irq_enter();
Expand Down
2 changes: 0 additions & 2 deletions trunk/include/linux/perf_counter.h
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,6 @@ extern int perf_counter_init_task(struct task_struct *child);
extern void perf_counter_exit_task(struct task_struct *child);
extern void perf_counter_do_pending(void);
extern void perf_counter_print_debug(void);
extern void perf_counter_unthrottle(void);
extern void __perf_disable(void);
extern bool __perf_enable(void);
extern void perf_disable(void);
Expand Down Expand Up @@ -635,7 +634,6 @@ static inline int perf_counter_init_task(struct task_struct *child) { }
static inline void perf_counter_exit_task(struct task_struct *child) { }
static inline void perf_counter_do_pending(void) { }
static inline void perf_counter_print_debug(void) { }
static inline void perf_counter_unthrottle(void) { }
static inline void perf_disable(void) { }
static inline void perf_enable(void) { }
static inline int perf_counter_task_disable(void) { return -EINVAL; }
Expand Down

0 comments on commit 0075d24

Please sign in to comment.