Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 147389
b: refs/heads/master
c: 4a06bd8
h: refs/heads/master
i:
  147387: 3c30862
v: v3
  • Loading branch information
Robert Richter authored and Ingo Molnar committed Apr 29, 2009
1 parent 7e7b968 commit e31aa0f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 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: 72eae04d3a3075c26d39e1e685acfc8e8c29db64
refs/heads/master: 4a06bd8508f65ad1dd5cd2046b85694813fa36a2
50 changes: 25 additions & 25 deletions trunk/arch/x86/kernel/cpu/perf_counter.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct x86_pmu {
int max_events;
};

static struct x86_pmu *x86_pmu __read_mostly;
static struct x86_pmu x86_pmu __read_mostly;

static DEFINE_PER_CPU(struct cpu_hw_counters, cpu_hw_counters) = {
.enabled = 1,
Expand Down Expand Up @@ -184,26 +184,26 @@ static bool reserve_pmc_hardware(void)
disable_lapic_nmi_watchdog();

for (i = 0; i < nr_counters_generic; i++) {
if (!reserve_perfctr_nmi(x86_pmu->perfctr + i))
if (!reserve_perfctr_nmi(x86_pmu.perfctr + i))
goto perfctr_fail;
}

for (i = 0; i < nr_counters_generic; i++) {
if (!reserve_evntsel_nmi(x86_pmu->eventsel + i))
if (!reserve_evntsel_nmi(x86_pmu.eventsel + i))
goto eventsel_fail;
}

return true;

eventsel_fail:
for (i--; i >= 0; i--)
release_evntsel_nmi(x86_pmu->eventsel + i);
release_evntsel_nmi(x86_pmu.eventsel + i);

i = nr_counters_generic;

perfctr_fail:
for (i--; i >= 0; i--)
release_perfctr_nmi(x86_pmu->perfctr + i);
release_perfctr_nmi(x86_pmu.perfctr + i);

if (nmi_watchdog == NMI_LOCAL_APIC)
enable_lapic_nmi_watchdog();
Expand All @@ -216,8 +216,8 @@ static void release_pmc_hardware(void)
int i;

for (i = 0; i < nr_counters_generic; i++) {
release_perfctr_nmi(x86_pmu->perfctr + i);
release_evntsel_nmi(x86_pmu->eventsel + i);
release_perfctr_nmi(x86_pmu.perfctr + i);
release_evntsel_nmi(x86_pmu.eventsel + i);
}

if (nmi_watchdog == NMI_LOCAL_APIC)
Expand Down Expand Up @@ -297,14 +297,14 @@ static int __hw_perf_counter_init(struct perf_counter *counter)
* Raw event type provide the config in the event structure
*/
if (perf_event_raw(hw_event)) {
hwc->config |= x86_pmu->raw_event(perf_event_config(hw_event));
hwc->config |= x86_pmu.raw_event(perf_event_config(hw_event));
} else {
if (perf_event_id(hw_event) >= x86_pmu->max_events)
if (perf_event_id(hw_event) >= x86_pmu.max_events)
return -EINVAL;
/*
* The generic map:
*/
hwc->config |= x86_pmu->event_map(perf_event_id(hw_event));
hwc->config |= x86_pmu.event_map(perf_event_id(hw_event));
}

counter->destroy = hw_perf_counter_destroy;
Expand Down Expand Up @@ -356,7 +356,7 @@ u64 hw_perf_save_disable(void)
if (unlikely(!perf_counters_initialized))
return 0;

return x86_pmu->save_disable_all();
return x86_pmu.save_disable_all();
}
/*
* Exported because of ACPI idle
Expand Down Expand Up @@ -396,7 +396,7 @@ void hw_perf_restore(u64 ctrl)
if (unlikely(!perf_counters_initialized))
return;

x86_pmu->restore_all(ctrl);
x86_pmu.restore_all(ctrl);
}
/*
* Exported because of ACPI idle
Expand Down Expand Up @@ -441,7 +441,7 @@ static void hw_perf_enable(int idx, u64 config)
if (unlikely(!perf_counters_initialized))
return;

x86_pmu->enable(idx, config);
x86_pmu.enable(idx, config);
}

static void intel_pmu_disable_counter(int idx, u64 config)
Expand All @@ -463,7 +463,7 @@ static void hw_perf_disable(int idx, u64 config)
if (unlikely(!perf_counters_initialized))
return;

x86_pmu->disable(idx, config);
x86_pmu.disable(idx, config);
}

static inline void
Expand Down Expand Up @@ -580,11 +580,11 @@ fixed_mode_idx(struct perf_counter *counter, struct hw_perf_counter *hwc)

event = hwc->config & ARCH_PERFMON_EVENT_MASK;

if (unlikely(event == x86_pmu->event_map(PERF_COUNT_INSTRUCTIONS)))
if (unlikely(event == x86_pmu.event_map(PERF_COUNT_INSTRUCTIONS)))
return X86_PMC_IDX_FIXED_INSTRUCTIONS;
if (unlikely(event == x86_pmu->event_map(PERF_COUNT_CPU_CYCLES)))
if (unlikely(event == x86_pmu.event_map(PERF_COUNT_CPU_CYCLES)))
return X86_PMC_IDX_FIXED_CPU_CYCLES;
if (unlikely(event == x86_pmu->event_map(PERF_COUNT_BUS_CYCLES)))
if (unlikely(event == x86_pmu.event_map(PERF_COUNT_BUS_CYCLES)))
return X86_PMC_IDX_FIXED_BUS_CYCLES;

return -1;
Expand Down Expand Up @@ -628,8 +628,8 @@ static int x86_pmu_enable(struct perf_counter *counter)
set_bit(idx, cpuc->used);
hwc->idx = idx;
}
hwc->config_base = x86_pmu->eventsel;
hwc->counter_base = x86_pmu->perfctr;
hwc->config_base = x86_pmu.eventsel;
hwc->counter_base = x86_pmu.perfctr;
}

perf_counters_lapic_init(hwc->nmi);
Expand Down Expand Up @@ -677,8 +677,8 @@ void perf_counter_print_debug(void)
pr_info("CPU#%d: used: %016llx\n", cpu, *(u64 *)cpuc->used);

for (idx = 0; idx < nr_counters_generic; idx++) {
rdmsrl(x86_pmu->eventsel + idx, pmc_ctrl);
rdmsrl(x86_pmu->perfctr + idx, pmc_count);
rdmsrl(x86_pmu.eventsel + idx, pmc_ctrl);
rdmsrl(x86_pmu.perfctr + idx, pmc_count);

prev_left = per_cpu(prev_left[idx], cpu);

Expand Down Expand Up @@ -819,7 +819,7 @@ void smp_perf_counter_interrupt(struct pt_regs *regs)
irq_enter();
apic_write(APIC_LVTPC, LOCAL_PERF_VECTOR);
ack_APIC_irq();
x86_pmu->handle_irq(regs, 0);
x86_pmu.handle_irq(regs, 0);
irq_exit();
}

Expand Down Expand Up @@ -876,7 +876,7 @@ perf_counter_nmi_handler(struct notifier_block *self,
regs = args->regs;

apic_write(APIC_LVTPC, APIC_DM_NMI);
ret = x86_pmu->handle_irq(regs, 1);
ret = x86_pmu.handle_irq(regs, 1);

return ret ? NOTIFY_STOP : NOTIFY_OK;
}
Expand Down Expand Up @@ -940,7 +940,7 @@ static int intel_pmu_init(void)
pr_info("... bit width: %d\n", eax.split.bit_width);
pr_info("... mask length: %d\n", eax.split.mask_length);

x86_pmu = &intel_pmu;
x86_pmu = intel_pmu;

nr_counters_generic = eax.split.num_counters;
nr_counters_fixed = edx.split.num_counters_fixed;
Expand All @@ -951,7 +951,7 @@ static int intel_pmu_init(void)

static int amd_pmu_init(void)
{
x86_pmu = &amd_pmu;
x86_pmu = amd_pmu;

nr_counters_generic = 4;
nr_counters_fixed = 0;
Expand Down

0 comments on commit e31aa0f

Please sign in to comment.