diff options
-rw-r--r-- | arch/x86/include/asm/perf_event.h | 1 | ||||
-rw-r--r-- | arch/x86/kernel/cpu/perf_event.c | 7 | ||||
-rw-r--r-- | arch/x86/mm/kmmio.c | 7 | ||||
-rw-r--r-- | include/linux/perf_event.h | 11 | ||||
-rw-r--r-- | kernel/perf_event.c | 9 | ||||
-rw-r--r-- | kernel/timer.c | 3 | ||||
-rw-r--r-- | tools/perf/builtin-kmem.c | 7 | ||||
-rw-r--r-- | tools/perf/builtin-timechart.c | 2 |
8 files changed, 35 insertions, 12 deletions
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h index 8d9f8548a870..1380367dabd9 100644 --- a/arch/x86/include/asm/perf_event.h +++ b/arch/x86/include/asm/perf_event.h | |||
@@ -19,6 +19,7 @@ | |||
19 | #define MSR_ARCH_PERFMON_EVENTSEL1 0x187 | 19 | #define MSR_ARCH_PERFMON_EVENTSEL1 0x187 |
20 | 20 | ||
21 | #define ARCH_PERFMON_EVENTSEL0_ENABLE (1 << 22) | 21 | #define ARCH_PERFMON_EVENTSEL0_ENABLE (1 << 22) |
22 | #define ARCH_PERFMON_EVENTSEL_ANY (1 << 21) | ||
22 | #define ARCH_PERFMON_EVENTSEL_INT (1 << 20) | 23 | #define ARCH_PERFMON_EVENTSEL_INT (1 << 20) |
23 | #define ARCH_PERFMON_EVENTSEL_OS (1 << 17) | 24 | #define ARCH_PERFMON_EVENTSEL_OS (1 << 17) |
24 | #define ARCH_PERFMON_EVENTSEL_USR (1 << 16) | 25 | #define ARCH_PERFMON_EVENTSEL_USR (1 << 16) |
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c index d616c06e99b4..8c1c07073ccc 100644 --- a/arch/x86/kernel/cpu/perf_event.c +++ b/arch/x86/kernel/cpu/perf_event.c | |||
@@ -1343,6 +1343,13 @@ intel_pmu_enable_fixed(struct hw_perf_event *hwc, int __idx) | |||
1343 | bits |= 0x2; | 1343 | bits |= 0x2; |
1344 | if (hwc->config & ARCH_PERFMON_EVENTSEL_OS) | 1344 | if (hwc->config & ARCH_PERFMON_EVENTSEL_OS) |
1345 | bits |= 0x1; | 1345 | bits |= 0x1; |
1346 | |||
1347 | /* | ||
1348 | * ANY bit is supported in v3 and up | ||
1349 | */ | ||
1350 | if (x86_pmu.version > 2 && hwc->config & ARCH_PERFMON_EVENTSEL_ANY) | ||
1351 | bits |= 0x4; | ||
1352 | |||
1346 | bits <<= (idx * 4); | 1353 | bits <<= (idx * 4); |
1347 | mask = 0xfULL << (idx * 4); | 1354 | mask = 0xfULL << (idx * 4); |
1348 | 1355 | ||
diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c index c0f6198565eb..536fb6823366 100644 --- a/arch/x86/mm/kmmio.c +++ b/arch/x86/mm/kmmio.c | |||
@@ -538,14 +538,15 @@ static int | |||
538 | kmmio_die_notifier(struct notifier_block *nb, unsigned long val, void *args) | 538 | kmmio_die_notifier(struct notifier_block *nb, unsigned long val, void *args) |
539 | { | 539 | { |
540 | struct die_args *arg = args; | 540 | struct die_args *arg = args; |
541 | unsigned long* dr6_p = (unsigned long *)ERR_PTR(arg->err); | ||
541 | 542 | ||
542 | if (val == DIE_DEBUG && (arg->err & DR_STEP)) | 543 | if (val == DIE_DEBUG && (*dr6_p & DR_STEP)) |
543 | if (post_kmmio_handler(arg->err, arg->regs) == 1) { | 544 | if (post_kmmio_handler(*dr6_p, arg->regs) == 1) { |
544 | /* | 545 | /* |
545 | * Reset the BS bit in dr6 (pointed by args->err) to | 546 | * Reset the BS bit in dr6 (pointed by args->err) to |
546 | * denote completion of processing | 547 | * denote completion of processing |
547 | */ | 548 | */ |
548 | (*(unsigned long *)ERR_PTR(arg->err)) &= ~DR_STEP; | 549 | *dr6_p &= ~DR_STEP; |
549 | return NOTIFY_STOP; | 550 | return NOTIFY_STOP; |
550 | } | 551 | } |
551 | 552 | ||
diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h index c66b34f75eea..8fa71874113f 100644 --- a/include/linux/perf_event.h +++ b/include/linux/perf_event.h | |||
@@ -814,9 +814,14 @@ extern int perf_event_overflow(struct perf_event *event, int nmi, | |||
814 | */ | 814 | */ |
815 | static inline int is_software_event(struct perf_event *event) | 815 | static inline int is_software_event(struct perf_event *event) |
816 | { | 816 | { |
817 | return (event->attr.type != PERF_TYPE_RAW) && | 817 | switch (event->attr.type) { |
818 | (event->attr.type != PERF_TYPE_HARDWARE) && | 818 | case PERF_TYPE_SOFTWARE: |
819 | (event->attr.type != PERF_TYPE_HW_CACHE); | 819 | case PERF_TYPE_TRACEPOINT: |
820 | /* for now the breakpoint stuff also works as software event */ | ||
821 | case PERF_TYPE_BREAKPOINT: | ||
822 | return 1; | ||
823 | } | ||
824 | return 0; | ||
820 | } | 825 | } |
821 | 826 | ||
822 | extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX]; | 827 | extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX]; |
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 603c0d8b5df1..d27746bd3a06 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c | |||
@@ -3268,6 +3268,9 @@ static void perf_event_task_output(struct perf_event *event, | |||
3268 | 3268 | ||
3269 | static int perf_event_task_match(struct perf_event *event) | 3269 | static int perf_event_task_match(struct perf_event *event) |
3270 | { | 3270 | { |
3271 | if (event->state != PERF_EVENT_STATE_ACTIVE) | ||
3272 | return 0; | ||
3273 | |||
3271 | if (event->cpu != -1 && event->cpu != smp_processor_id()) | 3274 | if (event->cpu != -1 && event->cpu != smp_processor_id()) |
3272 | return 0; | 3275 | return 0; |
3273 | 3276 | ||
@@ -3377,6 +3380,9 @@ static void perf_event_comm_output(struct perf_event *event, | |||
3377 | 3380 | ||
3378 | static int perf_event_comm_match(struct perf_event *event) | 3381 | static int perf_event_comm_match(struct perf_event *event) |
3379 | { | 3382 | { |
3383 | if (event->state != PERF_EVENT_STATE_ACTIVE) | ||
3384 | return 0; | ||
3385 | |||
3380 | if (event->cpu != -1 && event->cpu != smp_processor_id()) | 3386 | if (event->cpu != -1 && event->cpu != smp_processor_id()) |
3381 | return 0; | 3387 | return 0; |
3382 | 3388 | ||
@@ -3494,6 +3500,9 @@ static void perf_event_mmap_output(struct perf_event *event, | |||
3494 | static int perf_event_mmap_match(struct perf_event *event, | 3500 | static int perf_event_mmap_match(struct perf_event *event, |
3495 | struct perf_mmap_event *mmap_event) | 3501 | struct perf_mmap_event *mmap_event) |
3496 | { | 3502 | { |
3503 | if (event->state != PERF_EVENT_STATE_ACTIVE) | ||
3504 | return 0; | ||
3505 | |||
3497 | if (event->cpu != -1 && event->cpu != smp_processor_id()) | 3506 | if (event->cpu != -1 && event->cpu != smp_processor_id()) |
3498 | return 0; | 3507 | return 0; |
3499 | 3508 | ||
diff --git a/kernel/timer.c b/kernel/timer.c index 15533b792397..c61a7949387f 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -1198,6 +1198,7 @@ void update_process_times(int user_tick) | |||
1198 | run_local_timers(); | 1198 | run_local_timers(); |
1199 | rcu_check_callbacks(cpu, user_tick); | 1199 | rcu_check_callbacks(cpu, user_tick); |
1200 | printk_tick(); | 1200 | printk_tick(); |
1201 | perf_event_do_pending(); | ||
1201 | scheduler_tick(); | 1202 | scheduler_tick(); |
1202 | run_posix_cpu_timers(p); | 1203 | run_posix_cpu_timers(p); |
1203 | } | 1204 | } |
@@ -1209,8 +1210,6 @@ static void run_timer_softirq(struct softirq_action *h) | |||
1209 | { | 1210 | { |
1210 | struct tvec_base *base = __get_cpu_var(tvec_bases); | 1211 | struct tvec_base *base = __get_cpu_var(tvec_bases); |
1211 | 1212 | ||
1212 | perf_event_do_pending(); | ||
1213 | |||
1214 | hrtimer_run_pending(); | 1213 | hrtimer_run_pending(); |
1215 | 1214 | ||
1216 | if (time_after_eq(jiffies, base->timer_jiffies)) | 1215 | if (time_after_eq(jiffies, base->timer_jiffies)) |
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index 7ceb7416c316..93c67bf53d2c 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c | |||
@@ -375,7 +375,7 @@ static void __print_result(struct rb_root *root, struct perf_session *session, | |||
375 | 375 | ||
376 | printf("%.102s\n", graph_dotted_line); | 376 | printf("%.102s\n", graph_dotted_line); |
377 | printf(" %-34s |", is_caller ? "Callsite": "Alloc Ptr"); | 377 | printf(" %-34s |", is_caller ? "Callsite": "Alloc Ptr"); |
378 | printf(" Total_alloc/Per | Total_req/Per | Hit | Ping-pong | Frag\n"); | 378 | printf(" Total_alloc/Per | Total_req/Per | Hit | Ping-pong | Frag\n"); |
379 | printf("%.102s\n", graph_dotted_line); | 379 | printf("%.102s\n", graph_dotted_line); |
380 | 380 | ||
381 | next = rb_first(root); | 381 | next = rb_first(root); |
@@ -401,7 +401,7 @@ static void __print_result(struct rb_root *root, struct perf_session *session, | |||
401 | snprintf(buf, sizeof(buf), "%#Lx", addr); | 401 | snprintf(buf, sizeof(buf), "%#Lx", addr); |
402 | printf(" %-34s |", buf); | 402 | printf(" %-34s |", buf); |
403 | 403 | ||
404 | printf(" %9llu/%-5lu | %9llu/%-5lu | %6lu | %8lu | %6.3f%%\n", | 404 | printf(" %9llu/%-5lu | %9llu/%-5lu | %8lu | %8lu | %6.3f%%\n", |
405 | (unsigned long long)data->bytes_alloc, | 405 | (unsigned long long)data->bytes_alloc, |
406 | (unsigned long)data->bytes_alloc / data->hit, | 406 | (unsigned long)data->bytes_alloc / data->hit, |
407 | (unsigned long long)data->bytes_req, | 407 | (unsigned long long)data->bytes_req, |
@@ -784,7 +784,8 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __used) | |||
784 | setup_sorting(&alloc_sort, default_sort_order); | 784 | setup_sorting(&alloc_sort, default_sort_order); |
785 | 785 | ||
786 | return __cmd_kmem(); | 786 | return __cmd_kmem(); |
787 | } | 787 | } else |
788 | usage_with_options(kmem_usage, kmem_options); | ||
788 | 789 | ||
789 | return 0; | 790 | return 0; |
790 | } | 791 | } |
diff --git a/tools/perf/builtin-timechart.c b/tools/perf/builtin-timechart.c index a589a43112d6..3f8bbcfb1e9b 100644 --- a/tools/perf/builtin-timechart.c +++ b/tools/perf/builtin-timechart.c | |||
@@ -280,7 +280,7 @@ static u64 cpus_pstate_state[MAX_CPUS]; | |||
280 | 280 | ||
281 | static int process_comm_event(event_t *event, struct perf_session *session __used) | 281 | static int process_comm_event(event_t *event, struct perf_session *session __used) |
282 | { | 282 | { |
283 | pid_set_comm(event->comm.pid, event->comm.comm); | 283 | pid_set_comm(event->comm.tid, event->comm.comm); |
284 | return 0; | 284 | return 0; |
285 | } | 285 | } |
286 | 286 | ||