Commit 40a96350 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'perf-fixes-for-linus' of...

Merge branch 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'perf-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  perf, x86, nmi: Move LVT un-masking into irq handlers
  perf events, x86: Work around the Nehalem AAJ80 erratum
  perf, x86: Fix BTS condition
  ftrace: Build without frame pointers on Microblaze
parents fcc4dc71 2bce5dac
...@@ -613,8 +613,8 @@ static int x86_setup_perfctr(struct perf_event *event) ...@@ -613,8 +613,8 @@ static int x86_setup_perfctr(struct perf_event *event)
/* /*
* Branch tracing: * Branch tracing:
*/ */
if ((attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS) && if (attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS &&
(hwc->sample_period == 1)) { !attr->freq && hwc->sample_period == 1) {
/* BTS is not supported by this architecture. */ /* BTS is not supported by this architecture. */
if (!x86_pmu.bts_active) if (!x86_pmu.bts_active)
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -1288,6 +1288,16 @@ static int x86_pmu_handle_irq(struct pt_regs *regs) ...@@ -1288,6 +1288,16 @@ static int x86_pmu_handle_irq(struct pt_regs *regs)
cpuc = &__get_cpu_var(cpu_hw_events); cpuc = &__get_cpu_var(cpu_hw_events);
/*
* Some chipsets need to unmask the LVTPC in a particular spot
* inside the nmi handler. As a result, the unmasking was pushed
* into all the nmi handlers.
*
* This generic handler doesn't seem to have any issues where the
* unmasking occurs so it was left at the top.
*/
apic_write(APIC_LVTPC, APIC_DM_NMI);
for (idx = 0; idx < x86_pmu.num_counters; idx++) { for (idx = 0; idx < x86_pmu.num_counters; idx++) {
if (!test_bit(idx, cpuc->active_mask)) { if (!test_bit(idx, cpuc->active_mask)) {
/* /*
...@@ -1374,8 +1384,6 @@ perf_event_nmi_handler(struct notifier_block *self, ...@@ -1374,8 +1384,6 @@ perf_event_nmi_handler(struct notifier_block *self,
return NOTIFY_DONE; return NOTIFY_DONE;
} }
apic_write(APIC_LVTPC, APIC_DM_NMI);
handled = x86_pmu.handle_irq(args->regs); handled = x86_pmu.handle_irq(args->regs);
if (!handled) if (!handled)
return NOTIFY_DONE; return NOTIFY_DONE;
......
...@@ -25,7 +25,7 @@ struct intel_percore { ...@@ -25,7 +25,7 @@ struct intel_percore {
/* /*
* Intel PerfMon, used on Core and later. * Intel PerfMon, used on Core and later.
*/ */
static const u64 intel_perfmon_event_map[] = static u64 intel_perfmon_event_map[PERF_COUNT_HW_MAX] __read_mostly =
{ {
[PERF_COUNT_HW_CPU_CYCLES] = 0x003c, [PERF_COUNT_HW_CPU_CYCLES] = 0x003c,
[PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0,
...@@ -933,6 +933,16 @@ static int intel_pmu_handle_irq(struct pt_regs *regs) ...@@ -933,6 +933,16 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)
cpuc = &__get_cpu_var(cpu_hw_events); cpuc = &__get_cpu_var(cpu_hw_events);
/*
* Some chipsets need to unmask the LVTPC in a particular spot
* inside the nmi handler. As a result, the unmasking was pushed
* into all the nmi handlers.
*
* This handler doesn't seem to have any issues with the unmasking
* so it was left at the top.
*/
apic_write(APIC_LVTPC, APIC_DM_NMI);
intel_pmu_disable_all(); intel_pmu_disable_all();
handled = intel_pmu_drain_bts_buffer(); handled = intel_pmu_drain_bts_buffer();
status = intel_pmu_get_status(); status = intel_pmu_get_status();
...@@ -998,6 +1008,9 @@ intel_bts_constraints(struct perf_event *event) ...@@ -998,6 +1008,9 @@ intel_bts_constraints(struct perf_event *event)
struct hw_perf_event *hwc = &event->hw; struct hw_perf_event *hwc = &event->hw;
unsigned int hw_event, bts_event; unsigned int hw_event, bts_event;
if (event->attr.freq)
return NULL;
hw_event = hwc->config & INTEL_ARCH_EVENT_MASK; hw_event = hwc->config & INTEL_ARCH_EVENT_MASK;
bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS); bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS);
...@@ -1305,7 +1318,7 @@ static void intel_clovertown_quirks(void) ...@@ -1305,7 +1318,7 @@ static void intel_clovertown_quirks(void)
* AJ106 could possibly be worked around by not allowing LBR * AJ106 could possibly be worked around by not allowing LBR
* usage from PEBS, including the fixup. * usage from PEBS, including the fixup.
* AJ68 could possibly be worked around by always programming * AJ68 could possibly be worked around by always programming
* a pebs_event_reset[0] value and coping with the lost events. * a pebs_event_reset[0] value and coping with the lost events.
* *
* But taken together it might just make sense to not enable PEBS on * But taken together it might just make sense to not enable PEBS on
* these chips. * these chips.
...@@ -1409,6 +1422,18 @@ static __init int intel_pmu_init(void) ...@@ -1409,6 +1422,18 @@ static __init int intel_pmu_init(void)
x86_pmu.percore_constraints = intel_nehalem_percore_constraints; x86_pmu.percore_constraints = intel_nehalem_percore_constraints;
x86_pmu.enable_all = intel_pmu_nhm_enable_all; x86_pmu.enable_all = intel_pmu_nhm_enable_all;
x86_pmu.extra_regs = intel_nehalem_extra_regs; x86_pmu.extra_regs = intel_nehalem_extra_regs;
if (ebx & 0x40) {
/*
* Erratum AAJ80 detected, we work it around by using
* the BR_MISP_EXEC.ANY event. This will over-count
* branch-misses, but it's still much better than the
* architectural event which is often completely bogus:
*/
intel_perfmon_event_map[PERF_COUNT_HW_BRANCH_MISSES] = 0x7f89;
pr_cont("erratum AAJ80 worked around, ");
}
pr_cont("Nehalem events, "); pr_cont("Nehalem events, ");
break; break;
......
...@@ -950,11 +950,20 @@ static int p4_pmu_handle_irq(struct pt_regs *regs) ...@@ -950,11 +950,20 @@ static int p4_pmu_handle_irq(struct pt_regs *regs)
x86_pmu_stop(event, 0); x86_pmu_stop(event, 0);
} }
if (handled) { if (handled)
/* p4 quirk: unmask it again */
apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED);
inc_irq_stat(apic_perf_irqs); inc_irq_stat(apic_perf_irqs);
}
/*
* When dealing with the unmasking of the LVTPC on P4 perf hw, it has
* been observed that the OVF bit flag has to be cleared first _before_
* the LVTPC can be unmasked.
*
* The reason is the NMI line will continue to be asserted while the OVF
* bit is set. This causes a second NMI to generate if the LVTPC is
* unmasked before the OVF bit is cleared, leading to unknown NMI
* messages.
*/
apic_write(APIC_LVTPC, APIC_DM_NMI);
return handled; return handled;
} }
......
...@@ -141,7 +141,7 @@ if FTRACE ...@@ -141,7 +141,7 @@ if FTRACE
config FUNCTION_TRACER config FUNCTION_TRACER
bool "Kernel Function Tracer" bool "Kernel Function Tracer"
depends on HAVE_FUNCTION_TRACER depends on HAVE_FUNCTION_TRACER
select FRAME_POINTER if !ARM_UNWIND && !S390 select FRAME_POINTER if !ARM_UNWIND && !S390 && !MICROBLAZE
select KALLSYMS select KALLSYMS
select GENERIC_TRACER select GENERIC_TRACER
select CONTEXT_SWITCH_TRACER select CONTEXT_SWITCH_TRACER
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment