aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/cpu
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2011-04-26 13:36:14 -0400
committerIngo Molnar <mingo@elte.hu>2011-04-26 13:36:17 -0400
commit7bd5fafeb414cf00deee32c82834f8bf1426b9ac (patch)
tree1103053fa40576e9f9fc2818ea1910180e09b752 /arch/x86/kernel/cpu
parentfa7b69475a6c192853949ba496dd9c37b497b548 (diff)
parentec75a71634dabe439db91c1ef51d5099f4493808 (diff)
Merge branch 'perf/urgent' into perf/stat
Merge reason: We want to queue up dependent changes. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/cpu')
-rw-r--r--arch/x86/kernel/cpu/perf_event.c10
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c28
-rw-r--r--arch/x86/kernel/cpu/perf_event_p4.c2
3 files changed, 30 insertions, 10 deletions
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 224a84f7080c..dc9e212e31f6 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -593,8 +593,12 @@ static int x86_setup_perfctr(struct perf_event *event)
593 return -EOPNOTSUPP; 593 return -EOPNOTSUPP;
594 } 594 }
595 595
596 /*
597 * Do not allow config1 (extended registers) to propagate,
598 * there's no sane user-space generalization yet:
599 */
596 if (attr->type == PERF_TYPE_RAW) 600 if (attr->type == PERF_TYPE_RAW)
597 return x86_pmu_extra_regs(event->attr.config, event); 601 return 0;
598 602
599 if (attr->type == PERF_TYPE_HW_CACHE) 603 if (attr->type == PERF_TYPE_HW_CACHE)
600 return set_ext_hw_attr(hwc, event); 604 return set_ext_hw_attr(hwc, event);
@@ -616,8 +620,8 @@ static int x86_setup_perfctr(struct perf_event *event)
616 /* 620 /*
617 * Branch tracing: 621 * Branch tracing:
618 */ 622 */
619 if ((attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS) && 623 if (attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS &&
620 (hwc->sample_period == 1)) { 624 !attr->freq && hwc->sample_period == 1) {
621 /* BTS is not supported by this architecture. */ 625 /* BTS is not supported by this architecture. */
622 if (!x86_pmu.bts_active) 626 if (!x86_pmu.bts_active)
623 return -EOPNOTSUPP; 627 return -EOPNOTSUPP;
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 8fc2b2cee1da..9ae4a2aa7398 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -25,7 +25,7 @@ struct intel_percore {
25/* 25/*
26 * Intel PerfMon, used on Core and later. 26 * Intel PerfMon, used on Core and later.
27 */ 27 */
28static const u64 intel_perfmon_event_map[] = 28static u64 intel_perfmon_event_map[PERF_COUNT_HW_MAX] __read_mostly =
29{ 29{
30 [PERF_COUNT_HW_CPU_CYCLES] = 0x003c, 30 [PERF_COUNT_HW_CPU_CYCLES] = 0x003c,
31 [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0, 31 [PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0,
@@ -391,12 +391,12 @@ static __initconst const u64 nehalem_hw_cache_event_ids
391{ 391{
392 [ C(L1D) ] = { 392 [ C(L1D) ] = {
393 [ C(OP_READ) ] = { 393 [ C(OP_READ) ] = {
394 [ C(RESULT_ACCESS) ] = 0x0f40, /* L1D_CACHE_LD.MESI */ 394 [ C(RESULT_ACCESS) ] = 0x010b, /* MEM_INST_RETIRED.LOADS */
395 [ C(RESULT_MISS) ] = 0x0140, /* L1D_CACHE_LD.I_STATE */ 395 [ C(RESULT_MISS) ] = 0x0151, /* L1D.REPL */
396 }, 396 },
397 [ C(OP_WRITE) ] = { 397 [ C(OP_WRITE) ] = {
398 [ C(RESULT_ACCESS) ] = 0x0f41, /* L1D_CACHE_ST.MESI */ 398 [ C(RESULT_ACCESS) ] = 0x020b, /* MEM_INST_RETURED.STORES */
399 [ C(RESULT_MISS) ] = 0x0141, /* L1D_CACHE_ST.I_STATE */ 399 [ C(RESULT_MISS) ] = 0x0251, /* L1D.M_REPL */
400 }, 400 },
401 [ C(OP_PREFETCH) ] = { 401 [ C(OP_PREFETCH) ] = {
402 [ C(RESULT_ACCESS) ] = 0x014e, /* L1D_PREFETCH.REQUESTS */ 402 [ C(RESULT_ACCESS) ] = 0x014e, /* L1D_PREFETCH.REQUESTS */
@@ -998,6 +998,9 @@ intel_bts_constraints(struct perf_event *event)
998 struct hw_perf_event *hwc = &event->hw; 998 struct hw_perf_event *hwc = &event->hw;
999 unsigned int hw_event, bts_event; 999 unsigned int hw_event, bts_event;
1000 1000
1001 if (event->attr.freq)
1002 return NULL;
1003
1001 hw_event = hwc->config & INTEL_ARCH_EVENT_MASK; 1004 hw_event = hwc->config & INTEL_ARCH_EVENT_MASK;
1002 bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS); 1005 bts_event = x86_pmu.event_map(PERF_COUNT_HW_BRANCH_INSTRUCTIONS);
1003 1006
@@ -1305,7 +1308,7 @@ static void intel_clovertown_quirks(void)
1305 * AJ106 could possibly be worked around by not allowing LBR 1308 * AJ106 could possibly be worked around by not allowing LBR
1306 * usage from PEBS, including the fixup. 1309 * usage from PEBS, including the fixup.
1307 * AJ68 could possibly be worked around by always programming 1310 * AJ68 could possibly be worked around by always programming
1308 * a pebs_event_reset[0] value and coping with the lost events. 1311 * a pebs_event_reset[0] value and coping with the lost events.
1309 * 1312 *
1310 * But taken together it might just make sense to not enable PEBS on 1313 * But taken together it might just make sense to not enable PEBS on
1311 * these chips. 1314 * these chips.
@@ -1409,6 +1412,18 @@ static __init int intel_pmu_init(void)
1409 x86_pmu.percore_constraints = intel_nehalem_percore_constraints; 1412 x86_pmu.percore_constraints = intel_nehalem_percore_constraints;
1410 x86_pmu.enable_all = intel_pmu_nhm_enable_all; 1413 x86_pmu.enable_all = intel_pmu_nhm_enable_all;
1411 x86_pmu.extra_regs = intel_nehalem_extra_regs; 1414 x86_pmu.extra_regs = intel_nehalem_extra_regs;
1415
1416 if (ebx & 0x40) {
1417 /*
1418 * Erratum AAJ80 detected, we work it around by using
1419 * the BR_MISP_EXEC.ANY event. This will over-count
1420 * branch-misses, but it's still much better than the
1421 * architectural event which is often completely bogus:
1422 */
1423 intel_perfmon_event_map[PERF_COUNT_HW_BRANCH_MISSES] = 0x7f89;
1424
1425 pr_cont("erratum AAJ80 worked around, ");
1426 }
1412 pr_cont("Nehalem events, "); 1427 pr_cont("Nehalem events, ");
1413 break; 1428 break;
1414 1429
@@ -1425,6 +1440,7 @@ static __init int intel_pmu_init(void)
1425 1440
1426 case 37: /* 32 nm nehalem, "Clarkdale" */ 1441 case 37: /* 32 nm nehalem, "Clarkdale" */
1427 case 44: /* 32 nm nehalem, "Gulftown" */ 1442 case 44: /* 32 nm nehalem, "Gulftown" */
1443 case 47: /* 32 nm Xeon E7 */
1428 memcpy(hw_cache_event_ids, westmere_hw_cache_event_ids, 1444 memcpy(hw_cache_event_ids, westmere_hw_cache_event_ids,
1429 sizeof(hw_cache_event_ids)); 1445 sizeof(hw_cache_event_ids));
1430 memcpy(hw_cache_extra_regs, nehalem_hw_cache_extra_regs, 1446 memcpy(hw_cache_extra_regs, nehalem_hw_cache_extra_regs,
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c
index f4c1da2f9352..44d4383f2b3e 100644
--- a/arch/x86/kernel/cpu/perf_event_p4.c
+++ b/arch/x86/kernel/cpu/perf_event_p4.c
@@ -946,7 +946,7 @@ static int p4_pmu_handle_irq(struct pt_regs *regs)
946 if (!x86_perf_event_set_period(event)) 946 if (!x86_perf_event_set_period(event))
947 continue; 947 continue;
948 if (perf_event_overflow(event, 1, &data, regs)) 948 if (perf_event_overflow(event, 1, &data, regs))
949 p4_pmu_disable_event(event); 949 x86_pmu_stop(event, 0);
950 } 950 }
951 951
952 if (handled) { 952 if (handled) {