diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-27 21:48:00 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-10-27 21:48:00 -0400 |
| commit | a042e26137d7674ac04b1cd2d5c06b9ebc1ee2d5 (patch) | |
| tree | c1a7a8bda41b99caa4b4a0fe320fc73278879f7d | |
| parent | f66dd539feb849a3a00f7fac67c026e0935e373a (diff) | |
| parent | e25804a0327dad954f7d43803178fdef2fd35b4e (diff) | |
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: (50 commits)
perf python scripting: Add futex-contention script
perf python scripting: Fixup cut'n'paste error in sctop script
perf scripting: Shut up 'perf record' final status
perf record: Remove newline character from perror() argument
perf python scripting: Support fedora 11 (audit 1.7.17)
perf python scripting: Improve the syscalls-by-pid script
perf python scripting: print the syscall name on sctop
perf python scripting: Improve the syscalls-counts script
perf python scripting: Improve the failed-syscalls-by-pid script
kprobes: Remove redundant text_mutex lock in optimize
x86/oprofile: Fix uninitialized variable use in debug printk
tracing: Fix 'faild' -> 'failed' typo
perf probe: Fix format specified for Dwarf_Off parameter
perf trace: Fix detection of script extension
perf trace: Use $PERF_EXEC_PATH in canned report scripts
perf tools: Document event modifiers
perf tools: Remove direct slang.h include
perf_events: Fix for transaction recovery in group_sched_in()
perf_events: Revert: Fix transaction recovery in group_sched_in()
perf, x86: Use NUMA aware allocations for PEBS/BTS/DS allocations
...
48 files changed, 1501 insertions, 670 deletions
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h index 83c4bb1d917d..3ea3dc487047 100644 --- a/arch/x86/include/asm/msr-index.h +++ b/arch/x86/include/asm/msr-index.h | |||
| @@ -121,6 +121,7 @@ | |||
| 121 | #define MSR_AMD64_IBSDCLINAD 0xc0011038 | 121 | #define MSR_AMD64_IBSDCLINAD 0xc0011038 |
| 122 | #define MSR_AMD64_IBSDCPHYSAD 0xc0011039 | 122 | #define MSR_AMD64_IBSDCPHYSAD 0xc0011039 |
| 123 | #define MSR_AMD64_IBSCTL 0xc001103a | 123 | #define MSR_AMD64_IBSCTL 0xc001103a |
| 124 | #define MSR_AMD64_IBSBRTARGET 0xc001103b | ||
| 124 | 125 | ||
| 125 | /* Fam 10h MSRs */ | 126 | /* Fam 10h MSRs */ |
| 126 | #define MSR_FAM10H_MMIO_CONF_BASE 0xc0010058 | 127 | #define MSR_FAM10H_MMIO_CONF_BASE 0xc0010058 |
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index 6e742cc4251b..550e26b1dbb3 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h | |||
| @@ -111,17 +111,18 @@ union cpuid10_edx { | |||
| 111 | #define X86_PMC_IDX_FIXED_BTS (X86_PMC_IDX_FIXED + 16) | 111 | #define X86_PMC_IDX_FIXED_BTS (X86_PMC_IDX_FIXED + 16) |
| 112 | 112 | ||
| 113 | /* IbsFetchCtl bits/masks */ | 113 | /* IbsFetchCtl bits/masks */ |
| 114 | #define IBS_FETCH_RAND_EN (1ULL<<57) | 114 | #define IBS_FETCH_RAND_EN (1ULL<<57) |
| 115 | #define IBS_FETCH_VAL (1ULL<<49) | 115 | #define IBS_FETCH_VAL (1ULL<<49) |
| 116 | #define IBS_FETCH_ENABLE (1ULL<<48) | 116 | #define IBS_FETCH_ENABLE (1ULL<<48) |
| 117 | #define IBS_FETCH_CNT 0xFFFF0000ULL | 117 | #define IBS_FETCH_CNT 0xFFFF0000ULL |
| 118 | #define IBS_FETCH_MAX_CNT 0x0000FFFFULL | 118 | #define IBS_FETCH_MAX_CNT 0x0000FFFFULL |
| 119 | 119 | ||
| 120 | /* IbsOpCtl bits */ | 120 | /* IbsOpCtl bits */ |
| 121 | #define IBS_OP_CNT_CTL (1ULL<<19) | 121 | #define IBS_OP_CNT_CTL (1ULL<<19) |
| 122 | #define IBS_OP_VAL (1ULL<<18) | 122 | #define IBS_OP_VAL (1ULL<<18) |
| 123 | #define IBS_OP_ENABLE (1ULL<<17) | 123 | #define IBS_OP_ENABLE (1ULL<<17) |
| 124 | #define IBS_OP_MAX_CNT 0x0000FFFFULL | 124 | #define IBS_OP_MAX_CNT 0x0000FFFFULL |
| 125 | #define IBS_OP_MAX_CNT_EXT 0x007FFFFFULL /* not a register bit mask */ | ||
| 125 | 126 | ||
| 126 | #ifdef CONFIG_PERF_EVENTS | 127 | #ifdef CONFIG_PERF_EVENTS |
| 127 | extern void init_hw_perf_events(void); | 128 | extern void init_hw_perf_events(void); |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index c1e8c7a51164..ed6310183efb 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
| @@ -237,6 +237,7 @@ struct x86_pmu { | |||
| 237 | * Intel DebugStore bits | 237 | * Intel DebugStore bits |
| 238 | */ | 238 | */ |
| 239 | int bts, pebs; | 239 | int bts, pebs; |
| 240 | int bts_active, pebs_active; | ||
| 240 | int pebs_record_size; | 241 | int pebs_record_size; |
| 241 | void (*drain_pebs)(struct pt_regs *regs); | 242 | void (*drain_pebs)(struct pt_regs *regs); |
| 242 | struct event_constraint *pebs_constraints; | 243 | struct event_constraint *pebs_constraints; |
| @@ -380,7 +381,7 @@ static void release_pmc_hardware(void) {} | |||
| 380 | 381 | ||
| 381 | #endif | 382 | #endif |
| 382 | 383 | ||
| 383 | static int reserve_ds_buffers(void); | 384 | static void reserve_ds_buffers(void); |
| 384 | static void release_ds_buffers(void); | 385 | static void release_ds_buffers(void); |
| 385 | 386 | ||
| 386 | static void hw_perf_event_destroy(struct perf_event *event) | 387 | static void hw_perf_event_destroy(struct perf_event *event) |
| @@ -477,7 +478,7 @@ static int x86_setup_perfctr(struct perf_event *event) | |||
| 477 | if ((attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS) && | 478 | if ((attr->config == PERF_COUNT_HW_BRANCH_INSTRUCTIONS) && |
| 478 | (hwc->sample_period == 1)) { | 479 | (hwc->sample_period == 1)) { |
| 479 | /* BTS is not supported by this architecture. */ | 480 | /* BTS is not supported by this architecture. */ |
| 480 | if (!x86_pmu.bts) | 481 | if (!x86_pmu.bts_active) |
| 481 | return -EOPNOTSUPP; | 482 | return -EOPNOTSUPP; |
| 482 | 483 | ||
| 483 | /* BTS is currently only allowed for user-mode. */ | 484 | /* BTS is currently only allowed for user-mode. */ |
| @@ -496,12 +497,13 @@ static int x86_pmu_hw_config(struct perf_event *event) | |||
| 496 | int precise = 0; | 497 | int precise = 0; |
| 497 | 498 | ||
| 498 | /* Support for constant skid */ | 499 | /* Support for constant skid */ |
| 499 | if (x86_pmu.pebs) | 500 | if (x86_pmu.pebs_active) { |
| 500 | precise++; | 501 | precise++; |
| 501 | 502 | ||
| 502 | /* Support for IP fixup */ | 503 | /* Support for IP fixup */ |
| 503 | if (x86_pmu.lbr_nr) | 504 | if (x86_pmu.lbr_nr) |
| 504 | precise++; | 505 | precise++; |
| 506 | } | ||
| 505 | 507 | ||
| 506 | if (event->attr.precise_ip > precise) | 508 | if (event->attr.precise_ip > precise) |
| 507 | return -EOPNOTSUPP; | 509 | return -EOPNOTSUPP; |
| @@ -543,11 +545,8 @@ static int __x86_pmu_event_init(struct perf_event *event) | |||
| 543 | if (atomic_read(&active_events) == 0) { | 545 | if (atomic_read(&active_events) == 0) { |
| 544 | if (!reserve_pmc_hardware()) | 546 | if (!reserve_pmc_hardware()) |
| 545 | err = -EBUSY; | 547 | err = -EBUSY; |
| 546 | else { | 548 | else |
| 547 | err = reserve_ds_buffers(); | ||
