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

+53 -11
+12 -4
arch/x86/kernel/cpu/perf_event.c
··· 613 /* 614 * Branch tracing: 615 */ 616 - if ((attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS) && 617 - (hwc->sample_period == 1)) { 618 /* BTS is not supported by this architecture. */ 619 if (!x86_pmu.bts_active) 620 return -EOPNOTSUPP; ··· 1288 1289 cpuc = &__get_cpu_var(cpu_hw_events); 1290 1291 for (idx = 0; idx < x86_pmu.num_counters; idx++) { 1292 if (!test_bit(idx, cpuc->active_mask)) { 1293 /* ··· 1383 default: 1384 return NOTIFY_DONE; 1385 } 1386 - 1387 - apic_write(APIC_LVTPC, APIC_DM_NMI); 1388 1389 handled = x86_pmu.handle_irq(args->regs); 1390 if (!handled)
··· 613 /* 614 * Branch tracing: 615 */ 616 + if (attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS && 617 + !attr->freq && hwc->sample_period == 1) { 618 /* BTS is not supported by this architecture. */ 619 if (!x86_pmu.bts_active) 620 return -EOPNOTSUPP; ··· 1288 1289 cpuc = &__get_cpu_var(cpu_hw_events); 1290 1291 + /* 1292 + * Some chipsets need to unmask the LVTPC in a particular spot 1293 + * inside the nmi handler. As a result, the unmasking was pushed 1294 + * into all the nmi handlers. 1295 + * 1296 + * This generic handler doesn't seem to have any issues where the 1297 + * unmasking occurs so it was left at the top. 1298 + */ 1299 + apic_write(APIC_LVTPC, APIC_DM_NMI); 1300 + 1301 for (idx = 0; idx < x86_pmu.num_counters; idx++) { 1302 if (!test_bit(idx, cpuc->active_mask)) { 1303 /* ··· 1373 default: 1374 return NOTIFY_DONE; 1375 } 1376 1377 handled = x86_pmu.handle_irq(args->regs); 1378 if (!handled)
+27 -2
arch/x86/kernel/cpu/perf_event_intel.c
··· 25 /* 26 * Intel PerfMon, used on Core and later. 27 */ 28 - static const u64 intel_perfmon_event_map[] = 29 { 30 [PERF_COUNT_HW_CPU_CYCLES] = 0x003c, 31 [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, ··· 933 934 cpuc = &__get_cpu_var(cpu_hw_events); 935 936 intel_pmu_disable_all(); 937 handled = intel_pmu_drain_bts_buffer(); 938 status = intel_pmu_get_status(); ··· 1007 { 1008 struct hw_perf_event *hwc = &event->hw; 1009 unsigned int hw_event, bts_event; 1010 1011 hw_event = hwc->config & INTEL_ARCH_EVENT_MASK; 1012 bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS); ··· 1318 * AJ106 could possibly be worked around by not allowing LBR 1319 * usage from PEBS, including the fixup. 1320 * AJ68 could possibly be worked around by always programming 1321 - * a pebs_event_reset[0] value and coping with the lost events. 1322 * 1323 * But taken together it might just make sense to not enable PEBS on 1324 * these chips. ··· 1422 x86_pmu.percore_constraints = intel_nehalem_percore_constraints; 1423 x86_pmu.enable_all = intel_pmu_nhm_enable_all; 1424 x86_pmu.extra_regs = intel_nehalem_extra_regs; 1425 pr_cont("Nehalem events, "); 1426 break; 1427
··· 25 /* 26 * Intel PerfMon, used on Core and later. 27 */ 28 + static u64 intel_perfmon_event_map[PERF_COUNT_HW_MAX] __read_mostly = 29 { 30 [PERF_COUNT_HW_CPU_CYCLES] = 0x003c, 31 [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, ··· 933 934 cpuc = &__get_cpu_var(cpu_hw_events); 935 936 + /* 937 + * Some chipsets need to unmask the LVTPC in a particular spot 938 + * inside the nmi handler. As a result, the unmasking was pushed 939 + * into all the nmi handlers. 940 + * 941 + * This handler doesn't seem to have any issues with the unmasking 942 + * so it was left at the top. 943 + */ 944 + apic_write(APIC_LVTPC, APIC_DM_NMI); 945 + 946 intel_pmu_disable_all(); 947 handled = intel_pmu_drain_bts_buffer(); 948 status = intel_pmu_get_status(); ··· 997 { 998 struct hw_perf_event *hwc = &event->hw; 999 unsigned int hw_event, bts_event; 1000 + 1001 + if (event->attr.freq) 1002 + return NULL; 1003 1004 hw_event = hwc->config & INTEL_ARCH_EVENT_MASK; 1005 bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS); ··· 1305 * AJ106 could possibly be worked around by not allowing LBR 1306 * usage from PEBS, including the fixup. 1307 * AJ68 could possibly be worked around by always programming 1308 + * a pebs_event_reset[0] value and coping with the lost events. 1309 * 1310 * But taken together it might just make sense to not enable PEBS on 1311 * these chips. ··· 1409 x86_pmu.percore_constraints = intel_nehalem_percore_constraints; 1410 x86_pmu.enable_all = intel_pmu_nhm_enable_all; 1411 x86_pmu.extra_regs = intel_nehalem_extra_regs; 1412 + 1413 + if (ebx & 0x40) { 1414 + /* 1415 + * Erratum AAJ80 detected, we work it around by using 1416 + * the BR_MISP_EXEC.ANY event. This will over-count 1417 + * branch-misses, but it's still much better than the 1418 + * architectural event which is often completely bogus: 1419 + */ 1420 + intel_perfmon_event_map[PERF_COUNT_HW_BRANCH_MISSES] = 0x7f89; 1421 + 1422 + pr_cont("erratum AAJ80 worked around, "); 1423 + } 1424 pr_cont("Nehalem events, "); 1425 break; 1426
+13 -4
arch/x86/kernel/cpu/perf_event_p4.c
··· 950 x86_pmu_stop(event, 0); 951 } 952 953 - if (handled) { 954 - /* p4 quirk: unmask it again */ 955 - apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED); 956 inc_irq_stat(apic_perf_irqs); 957 - } 958 959 return handled; 960 }
··· 950 x86_pmu_stop(event, 0); 951 } 952 953 + if (handled) 954 inc_irq_stat(apic_perf_irqs); 955 + 956 + /* 957 + * When dealing with the unmasking of the LVTPC on P4 perf hw, it has 958 + * been observed that the OVF bit flag has to be cleared first _before_ 959 + * the LVTPC can be unmasked. 960 + * 961 + * The reason is the NMI line will continue to be asserted while the OVF 962 + * bit is set. This causes a second NMI to generate if the LVTPC is 963 + * unmasked before the OVF bit is cleared, leading to unknown NMI 964 + * messages. 965 + */ 966 + apic_write(APIC_LVTPC, APIC_DM_NMI); 967 968 return handled; 969 }
+1 -1
kernel/trace/Kconfig
··· 141 config FUNCTION_TRACER 142 bool "Kernel Function Tracer" 143 depends on HAVE_FUNCTION_TRACER 144 - select FRAME_POINTER if !ARM_UNWIND && !S390 145 select KALLSYMS 146 select GENERIC_TRACER 147 select CONTEXT_SWITCH_TRACER
··· 141 config FUNCTION_TRACER 142 bool "Kernel Function Tracer" 143 depends on HAVE_FUNCTION_TRACER 144 + select FRAME_POINTER if !ARM_UNWIND && !S390 && !MICROBLAZE 145 select KALLSYMS 146 select GENERIC_TRACER 147 select CONTEXT_SWITCH_TRACER