diff options
| author | Ingo Molnar <mingo@kernel.org> | 2012-12-01 05:56:03 -0500 |
|---|---|---|
| committer | Ingo Molnar <mingo@kernel.org> | 2012-12-01 05:56:03 -0500 |
| commit | fd6da696f38b00ffeae1185d6f0ec5d4ab3b472d (patch) | |
| tree | 27a52ff8c74ec62f604f72e68255df884ec5c112 /tools/perf | |
| parent | 18423d3562f396206e0928a71177eeb2edfed077 (diff) | |
| parent | 7321090f6751c9987c26a8c81c63680d16a614d7 (diff) | |
Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
- Don't build 'perf kvm stat" on non-x86 arches, fix from Xiao Guangrong.
- UAPI fixes to get perf building again in non-x86 arches, from David Howells.
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/perf')
| -rw-r--r-- | tools/perf/Makefile | 29 | ||||
| -rw-r--r-- | tools/perf/arch/x86/include/perf_regs.h | 2 | ||||
| -rw-r--r-- | tools/perf/builtin-kvm.c | 121 | ||||
| -rw-r--r-- | tools/perf/builtin-test.c | 2 | ||||
| -rw-r--r-- | tools/perf/perf.h | 16 | ||||
| -rw-r--r-- | tools/perf/util/evsel.c | 4 | ||||
| -rw-r--r-- | tools/perf/util/evsel.h | 3 | ||||
| -rw-r--r-- | tools/perf/util/header.h | 2 | ||||
| -rw-r--r-- | tools/perf/util/parse-events-test.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/parse-events.c | 2 | ||||
| -rw-r--r-- | tools/perf/util/parse-events.h | 2 | ||||
| -rw-r--r-- | tools/perf/util/pmu.h | 2 | ||||
| -rw-r--r-- | tools/perf/util/session.h | 2 |
13 files changed, 110 insertions, 79 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 00deed4d6159..0a619af5be43 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
| @@ -169,7 +169,34 @@ endif | |||
| 169 | 169 | ||
| 170 | ### --- END CONFIGURATION SECTION --- | 170 | ### --- END CONFIGURATION SECTION --- |
| 171 | 171 | ||
| 172 | BASIC_CFLAGS = -Iutil/include -Iarch/$(ARCH)/include -I$(OUTPUT)util -I$(TRACE_EVENT_DIR) -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE | 172 | ifeq ($(srctree),) |
| 173 | srctree := $(patsubst %/,%,$(dir $(shell pwd))) | ||
| 174 | srctree := $(patsubst %/,%,$(dir $(srctree))) | ||
| 175 | #$(info Determined 'srctree' to be $(srctree)) | ||
| 176 | endif | ||
| 177 | |||
| 178 | ifneq ($(objtree),) | ||
| 179 | #$(info Determined 'objtree' to be $(objtree)) | ||
| 180 | endif | ||
| 181 | |||
| 182 | ifneq ($(OUTPUT),) | ||
| 183 | #$(info Determined 'OUTPUT' to be $(OUTPUT)) | ||
| 184 | endif | ||
| 185 | |||
| 186 | BASIC_CFLAGS = \ | ||
| 187 | -Iutil/include \ | ||
| 188 | -Iarch/$(ARCH)/include \ | ||
| 189 | $(if $(objtree),-I$(objtree)/arch/$(ARCH)/include/generated/uapi) \ | ||
| 190 | -I$(srctree)/arch/$(ARCH)/include/uapi \ | ||
| 191 | -I$(srctree)/arch/$(ARCH)/include \ | ||
| 192 | $(if $(objtree),-I$(objtree)/include/generated/uapi) \ | ||
| 193 | -I$(srctree)/include/uapi \ | ||
| 194 | -I$(srctree)/include \ | ||
| 195 | -I$(OUTPUT)util \ | ||
| 196 | -Iutil \ | ||
| 197 | -I. \ | ||
| 198 | -I$(TRACE_EVENT_DIR) \ | ||
| 199 | -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE | ||
| 173 | BASIC_LDFLAGS = | 200 | BASIC_LDFLAGS = |
| 174 | 201 | ||
| 175 | # Guard against environment variables | 202 | # Guard against environment variables |
diff --git a/tools/perf/arch/x86/include/perf_regs.h b/tools/perf/arch/x86/include/perf_regs.h index 46fc9f15c6b3..7fcdcdbee917 100644 --- a/tools/perf/arch/x86/include/perf_regs.h +++ b/tools/perf/arch/x86/include/perf_regs.h | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
| 5 | #include "../../util/types.h" | 5 | #include "../../util/types.h" |
| 6 | #include "../../../../../arch/x86/include/asm/perf_regs.h" | 6 | #include <asm/perf_regs.h> |
| 7 | 7 | ||
| 8 | #ifndef ARCH_X86_64 | 8 | #ifndef ARCH_X86_64 |
| 9 | #define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1) | 9 | #define PERF_REGS_MASK ((1ULL << PERF_REG_X86_32_MAX) - 1) |
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c index 260abc535b5b..283b4397e397 100644 --- a/tools/perf/builtin-kvm.c +++ b/tools/perf/builtin-kvm.c | |||
| @@ -22,9 +22,10 @@ | |||
| 22 | #include <pthread.h> | 22 | #include <pthread.h> |
| 23 | #include <math.h> | 23 | #include <math.h> |
| 24 | 24 | ||
| 25 | #include "../../arch/x86/include/asm/svm.h" | 25 | #if defined(__i386__) || defined(__x86_64__) |
| 26 | #include "../../arch/x86/include/asm/vmx.h" | 26 | #include <asm/svm.h> |
| 27 | #include "../../arch/x86/include/asm/kvm.h" | 27 | #include <asm/vmx.h> |
| 28 | #include <asm/kvm.h> | ||
| 28 | 29 | ||
| 29 | struct event_key { | 30 | struct event_key { |
| 30 | #define INVALID_KEY (~0ULL) | 31 | #define INVALID_KEY (~0ULL) |
| @@ -58,7 +59,7 @@ struct kvm_event_key { | |||
| 58 | }; | 59 | }; |
| 59 | 60 | ||
| 60 | 61 | ||
| 61 | struct perf_kvm; | 62 | struct perf_kvm_stat; |
| 62 | 63 | ||
| 63 | struct kvm_events_ops { | 64 | struct kvm_events_ops { |
| 64 | bool (*is_begin_event)(struct perf_evsel *evsel, | 65 | bool (*is_begin_event)(struct perf_evsel *evsel, |
| @@ -66,7 +67,7 @@ struct kvm_events_ops { | |||
| 66 | struct event_key *key); | 67 | struct event_key *key); |
| 67 | bool (*is_end_event)(struct perf_evsel *evsel, | 68 | bool (*is_end_event)(struct perf_evsel *evsel, |
| 68 | struct perf_sample *sample, struct event_key *key); | 69 | struct perf_sample *sample, struct event_key *key); |
| 69 | void (*decode_key)(struct perf_kvm *kvm, struct event_key *key, | 70 | void (*decode_key)(struct perf_kvm_stat *kvm, struct event_key *key, |
| 70 | char decode[20]); | 71 | char decode[20]); |
| 71 | const char *name; | 72 | const char *name; |
| 72 | }; | 73 | }; |
| @@ -79,7 +80,7 @@ struct exit_reasons_table { | |||
| 79 | #define EVENTS_BITS 12 | 80 | #define EVENTS_BITS 12 |
| 80 | #define EVENTS_CACHE_SIZE (1UL << EVENTS_BITS) | 81 | #define EVENTS_CACHE_SIZE (1UL << EVENTS_BITS) |
| 81 | 82 | ||
| 82 | struct perf_kvm { | 83 | struct perf_kvm_stat { |
| 83 | struct perf_tool tool; | 84 | struct perf_tool tool; |
| 84 | struct perf_session *session; | 85 | struct perf_session *session; |
| 85 | 86 | ||
| @@ -146,7 +147,7 @@ static struct exit_reasons_table svm_exit_reasons[] = { | |||
| 146 | SVM_EXIT_REASONS | 147 | SVM_EXIT_REASONS |
| 147 | }; | 148 | }; |
| 148 | 149 | ||
| 149 | static const char *get_exit_reason(struct perf_kvm *kvm, u64 exit_code) | 150 | static const char *get_exit_reason(struct perf_kvm_stat *kvm, u64 exit_code) |
| 150 | { | 151 | { |
| 151 | int i = kvm->exit_reasons_size; | 152 | int i = kvm->exit_reasons_size; |
| 152 | struct exit_reasons_table *tbl = kvm->exit_reasons; | 153 | struct exit_reasons_table *tbl = kvm->exit_reasons; |
| @@ -162,7 +163,7 @@ static const char *get_exit_reason(struct perf_kvm *kvm, u64 exit_code) | |||
| 162 | return "UNKNOWN"; | 163 | return "UNKNOWN"; |
| 163 | } | 164 | } |
| 164 | 165 | ||
| 165 | static void exit_event_decode_key(struct perf_kvm *kvm, | 166 | static void exit_event_decode_key(struct perf_kvm_stat *kvm, |
| 166 | struct event_key *key, | 167 | struct event_key *key, |
| 167 | char decode[20]) | 168 | char decode[20]) |
| 168 | { | 169 | { |
| @@ -228,7 +229,7 @@ static bool mmio_event_end(struct perf_evsel *evsel, struct perf_sample *sample, | |||
| 228 | return false; | 229 | return false; |
| 229 | } | 230 | } |
| 230 | 231 | ||
| 231 | static void mmio_event_decode_key(struct perf_kvm *kvm __maybe_unused, | 232 | static void mmio_event_decode_key(struct perf_kvm_stat *kvm __maybe_unused, |
| 232 | struct event_key *key, | 233 | struct event_key *key, |
| 233 | char decode[20]) | 234 | char decode[20]) |
| 234 | { | 235 | { |
| @@ -271,7 +272,7 @@ static bool ioport_event_end(struct perf_evsel *evsel, | |||
| 271 | return kvm_entry_event(evsel); | 272 | return kvm_entry_event(evsel); |
| 272 | } | 273 | } |
| 273 | 274 | ||
| 274 | static void ioport_event_decode_key(struct perf_kvm *kvm __maybe_unused, | 275 | static void ioport_event_decode_key(struct perf_kvm_stat *kvm __maybe_unused, |
| 275 | struct event_key *key, | 276 | struct event_key *key, |
| 276 | char decode[20]) | 277 | char decode[20]) |
| 277 | { | 278 | { |
| @@ -286,7 +287,7 @@ static struct kvm_events_ops ioport_events = { | |||
| 286 | .name = "IO Port Access" | 287 | .name = "IO Port Access" |
| 287 | }; | 288 | }; |
| 288 | 289 | ||
| 289 | static bool register_kvm_events_ops(struct perf_kvm *kvm) | 290 | static bool register_kvm_events_ops(struct perf_kvm_stat *kvm) |
| 290 | { | 291 | { |
| 291 | bool ret = true; | 292 | bool ret = true; |
| 292 | 293 | ||
| @@ -311,7 +312,7 @@ struct vcpu_event_record { | |||
| 311 | }; | 312 | }; |
| 312 | 313 | ||
| 313 | 314 | ||
| 314 | static void init_kvm_event_record(struct perf_kvm *kvm) | 315 | static void init_kvm_event_record(struct perf_kvm_stat *kvm) |
| 315 | { | 316 | { |
| 316 | int i; | 317 | int i; |
| 317 | 318 | ||
| @@ -360,7 +361,7 @@ static struct kvm_event *kvm_alloc_init_event(struct event_key *key) | |||
| 360 | return event; | 361 | return event; |
| 361 | } | 362 | } |
| 362 | 363 | ||
| 363 | static struct kvm_event *find_create_kvm_event(struct perf_kvm *kvm, | 364 | static struct kvm_event *find_create_kvm_event(struct perf_kvm_stat *kvm, |
| 364 | struct event_key *key) | 365 | struct event_key *key) |
| 365 | { | 366 | { |
| 366 | struct kvm_event *event; | 367 | struct kvm_event *event; |
| @@ -381,7 +382,7 @@ static struct kvm_event *find_create_kvm_event(struct perf_kvm *kvm, | |||
| 381 | return event; | 382 | return event; |
| 382 | } | 383 | } |
| 383 | 384 | ||
| 384 | static bool handle_begin_event(struct perf_kvm *kvm, | 385 | static bool handle_begin_event(struct perf_kvm_stat *kvm, |
| 385 | struct vcpu_event_record *vcpu_record, | 386 | struct vcpu_event_record *vcpu_record, |
| 386 | struct event_key *key, u64 timestamp) | 387 | struct event_key *key, u64 timestamp) |
| 387 | { | 388 | { |
| @@ -425,7 +426,7 @@ static bool update_kvm_event(struct kvm_event *event, int vcpu_id, | |||
| 425 | return true; | 426 | return true; |
| 426 | } | 427 | } |
| 427 | 428 | ||
| 428 | static bool handle_end_event(struct perf_kvm *kvm, | 429 | static bool handle_end_event(struct perf_kvm_stat *kvm, |
| 429 | struct vcpu_event_record *vcpu_record, | 430 | struct vcpu_event_record *vcpu_record, |
| 430 | struct event_key *key, | 431 | struct event_key *key, |
| 431 | u64 timestamp) | 432 | u64 timestamp) |
| @@ -486,7 +487,7 @@ struct vcpu_event_record *per_vcpu_record(struct thread *thread, | |||
| 486 | return thread->priv; | 487 | return thread->priv; |
| 487 | } | 488 | } |
| 488 | 489 | ||
| 489 | static bool handle_kvm_event(struct perf_kvm *kvm, | 490 | static bool handle_kvm_event(struct perf_kvm_stat *kvm, |
| 490 | struct thread *thread, | 491 | struct thread *thread, |
| 491 | struct perf_evsel *evsel, | 492 | struct perf_evsel *evsel, |
| 492 | struct perf_sample *sample) | 493 | struct perf_sample *sample) |
| @@ -541,7 +542,7 @@ static struct kvm_event_key keys[] = { | |||
| 541 | { NULL, NULL } | 542 | { NULL, NULL } |
| 542 | }; | 543 | }; |
| 543 | 544 | ||
| 544 | static bool select_key(struct perf_kvm *kvm) | 545 | static bool select_key(struct perf_kvm_stat *kvm) |
| 545 | { | 546 | { |
| 546 | int i; | 547 | int i; |
| 547 | 548 | ||
| @@ -577,7 +578,8 @@ static void insert_to_result(struct rb_root *result, struct kvm_event *event, | |||
| 577 | rb_insert_color(&event->rb, result); | 578 | rb_insert_color(&event->rb, result); |
| 578 | } | 579 | } |
| 579 | 580 | ||
| 580 | static void update_total_count(struct perf_kvm *kvm, struct kvm_event *event) | 581 | static void |
| 582 | update_total_count(struct perf_kvm_stat *kvm, struct kvm_event *event) | ||
| 581 | { | 583 | { |
| 582 | int vcpu = kvm->trace_vcpu; | 584 | int vcpu = kvm->trace_vcpu; |
| 583 | 585 | ||
| @@ -590,7 +592,7 @@ static bool event_is_valid(struct kvm_event *event, int vcpu) | |||
| 590 | return !!get_event_count(event, vcpu); | 592 | return !!get_event_count(event, vcpu); |
| 591 | } | 593 | } |
| 592 | 594 | ||
| 593 | static void sort_result(struct perf_kvm *kvm) | 595 | static void sort_result(struct perf_kvm_stat *kvm) |
| 594 | { | 596 | { |
| 595 | unsigned int i; | 597 | unsigned int i; |
| 596 | int vcpu = kvm->trace_vcpu; | 598 | int vcpu = kvm->trace_vcpu; |
| @@ -627,7 +629,7 @@ static void print_vcpu_info(int vcpu) | |||
| 627 | pr_info("VCPU %d:\n\n", vcpu); | 629 | pr_info("VCPU %d:\n\n", vcpu); |
| 628 | } | 630 | } |
| 629 | 631 | ||
| 630 | static void print_result(struct perf_kvm *kvm) | 632 | static void print_result(struct perf_kvm_stat *kvm) |
| 631 | { | 633 | { |
| 632 | char decode[20]; | 634 | char decode[20]; |
| 633 | struct kvm_event *event; | 635 | struct kvm_event *event; |
| @@ -670,7 +672,8 @@ static int process_sample_event(struct perf_tool *tool, | |||
| 670 | struct machine *machine) | 672 | struct machine *machine) |
| 671 | { | 673 | { |
| 672 | struct thread *thread = machine__findnew_thread(machine, sample->tid); | 674 | struct thread *thread = machine__findnew_thread(machine, sample->tid); |
| 673 | struct perf_kvm *kvm = container_of(tool, struct perf_kvm, tool); | 675 | struct perf_kvm_stat *kvm = container_of(tool, struct perf_kvm_stat, |
| 676 | tool); | ||
| 674 | 677 | ||
| 675 | if (thread == NULL) { | 678 | if (thread == NULL) { |
| 676 | pr_debug("problem processing %d event, skipping it.\n", | 679 | pr_debug("problem processing %d event, skipping it.\n", |
| @@ -701,7 +704,7 @@ static int get_cpu_isa(struct perf_session *session) | |||
| 701 | return isa; | 704 | return isa; |
| 702 | } | 705 | } |
| 703 | 706 | ||
| 704 | static int read_events(struct perf_kvm *kvm) | 707 | static int read_events(struct perf_kvm_stat *kvm) |
| 705 | { | 708 | { |
| 706 | int ret; | 709 | int ret; |
| 707 | 710 | ||
| @@ -750,7 +753,7 @@ static bool verify_vcpu(int vcpu) | |||
| 750 | return true; | 753 | return true; |
| 751 | } | 754 | } |
| 752 | 755 | ||
| 753 | static int kvm_events_report_vcpu(struct perf_kvm *kvm) | 756 | static int kvm_events_report_vcpu(struct perf_kvm_stat *kvm) |
| 754 | { | 757 | { |
| 755 | int ret = -EINVAL; | 758 | int ret = -EINVAL; |
| 756 | int vcpu = kvm->trace_vcpu; | 759 | int vcpu = kvm->trace_vcpu; |
| @@ -798,7 +801,8 @@ static const char * const record_args[] = { | |||
| 798 | _p; \ | 801 | _p; \ |
| 799 | }) | 802 | }) |
| 800 | 803 | ||
| 801 | static int kvm_events_record(struct perf_kvm *kvm, int argc, const char **argv) | 804 | static int |
| 805 | kvm_events_record(struct perf_kvm_stat *kvm, int argc, const char **argv) | ||
| 802 | { | 806 | { |
| 803 | unsigned int rec_argc, i, j; | 807 | unsigned int rec_argc, i, j; |
| 804 | const char **rec_argv; | 808 | const char **rec_argv; |
| @@ -821,7 +825,8 @@ static int kvm_events_record(struct perf_kvm *kvm, int argc, const char **argv) | |||
| 821 | return cmd_record(i, rec_argv, NULL); | 825 | return cmd_record(i, rec_argv, NULL); |
| 822 | } | 826 | } |
| 823 | 827 | ||
| 824 | static int kvm_events_report(struct perf_kvm *kvm, int argc, const char **argv) | 828 | static int |
| 829 | kvm_events_report(struct perf_kvm_stat *kvm, int argc, const char **argv) | ||
| 825 | { | 830 | { |
| 826 | const struct option kvm_events_report_options[] = { | 831 | const struct option kvm_events_report_options[] = { |
| 827 | OPT_STRING(0, "event", &kvm->report_event, "report event", | 832 | OPT_STRING(0, "event", &kvm->report_event, "report event", |
| @@ -864,24 +869,37 @@ static void print_kvm_stat_usage(void) | |||
| 864 | printf("\nOtherwise, it is the alias of 'perf stat':\n"); | 869 | printf("\nOtherwise, it is the alias of 'perf stat':\n"); |
| 865 | } | 870 | } |
| 866 | 871 | ||
| 867 | static int kvm_cmd_stat(struct perf_kvm *kvm, int argc, const char **argv) | 872 | static int kvm_cmd_stat(const char *file_name, int argc, const char **argv) |
| 868 | { | 873 | { |
| 874 | struct perf_kvm_stat kvm = { | ||
| 875 | .file_name = file_name, | ||
| 876 | |||
| 877 | .trace_vcpu = -1, | ||
| 878 | .report_event = "vmexit", | ||
| 879 | .sort_key = "sample", | ||
| 880 | |||
| 881 | .exit_reasons = svm_exit_reasons, | ||
| 882 | .exit_reasons_size = ARRAY_SIZE(svm_exit_reasons), | ||
| 883 | .exit_reasons_isa = "SVM", | ||
| 884 | }; | ||
| 885 | |||
| 869 | if (argc == 1) { | 886 | if (argc == 1) { |
| 870 | print_kvm_stat_usage(); | 887 | print_kvm_stat_usage(); |
| 871 | goto perf_stat; | 888 | goto perf_stat; |
| 872 | } | 889 | } |
| 873 | 890 | ||
| 874 | if (!strncmp(argv[1], "rec", 3)) | 891 | if (!strncmp(argv[1], "rec", 3)) |
| 875 | return kvm_events_record(kvm, argc - 1, argv + 1); | 892 | return kvm_events_record(&kvm, argc - 1, argv + 1); |
| 876 | 893 | ||
| 877 | if (!strncmp(argv[1], "rep", 3)) | 894 | if (!strncmp(argv[1], "rep", 3)) |
| 878 | return kvm_events_report(kvm, argc - 1 , argv + 1); | 895 | return kvm_events_report(&kvm, argc - 1 , argv + 1); |
| 879 | 896 | ||
| 880 | perf_stat: | 897 | perf_stat: |
| 881 | return cmd_stat(argc, argv, NULL); | 898 | return cmd_stat(argc, argv, NULL); |
| 882 | } | 899 | } |
| 900 | #endif | ||
| 883 | 901 | ||
| 884 | static int __cmd_record(struct perf_kvm *kvm, int argc, const char **argv) | 902 | static int __cmd_record(const char *file_name, int argc, const char **argv) |
| 885 | { | 903 | { |
| 886 | int rec_argc, i = 0, j; | 904 | int rec_argc, i = 0, j; |
| 887 | const char **rec_argv; | 905 | const char **rec_argv; |
| @@ -890,7 +908,7 @@ static int __cmd_record(struct perf_kvm *kvm, int argc, const char **argv) | |||
| 890 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); | 908 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); |
| 891 | rec_argv[i++] = strdup("record"); | 909 | rec_argv[i++] = strdup("record"); |
| 892 | rec_argv[i++] = strdup("-o"); | 910 | rec_argv[i++] = strdup("-o"); |
| 893 | rec_argv[i++] = strdup(kvm->file_name); | 911 | rec_argv[i++] = strdup(file_name); |
| 894 | for (j = 1; j < argc; j++, i++) | 912 | for (j = 1; j < argc; j++, i++) |
| 895 | rec_argv[i] = argv[j]; | 913 | rec_argv[i] = argv[j]; |
| 896 | 914 | ||
| @@ -899,7 +917,7 @@ static int __cmd_record(struct perf_kvm *kvm, int argc, const char **argv) | |||
| 899 | return cmd_record(i, rec_argv, NULL); | 917 | return cmd_record(i, rec_argv, NULL); |
| 900 | } | 918 | } |
| 901 | 919 | ||
| 902 | static int __cmd_report(struct perf_kvm *kvm, int argc, const char **argv) | 920 | static int __cmd_report(const char *file_name, int argc, const char **argv) |
| 903 | { | 921 | { |
| 904 | int rec_argc, i = 0, j; | 922 | int rec_argc, i = 0, j; |
| 905 | const char **rec_argv; | 923 | const char **rec_argv; |
| @@ -908,7 +926,7 @@ static int __cmd_report(struct perf_kvm *kvm, int argc, const char **argv) | |||
| 908 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); | 926 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); |
| 909 | rec_argv[i++] = strdup("report"); | 927 | rec_argv[i++] = strdup("report"); |
| 910 | rec_argv[i++] = strdup("-i"); | 928 | rec_argv[i++] = strdup("-i"); |
| 911 | rec_argv[i++] = strdup(kvm->file_name); | 929 | rec_argv[i++] = strdup(file_name); |
| 912 | for (j = 1; j < argc; j++, i++) | 930 | for (j = 1; j < argc; j++, i++) |
| 913 | rec_argv[i] = argv[j]; | 931 | rec_argv[i] = argv[j]; |
| 914 | 932 | ||
| @@ -917,7 +935,8 @@ static int __cmd_report(struct perf_kvm *kvm, int argc, const char **argv) | |||
| 917 | return cmd_report(i, rec_argv, NULL); | 935 | return cmd_report(i, rec_argv, NULL); |
| 918 | } | 936 | } |
| 919 | 937 | ||
| 920 | static int __cmd_buildid_list(struct perf_kvm *kvm, int argc, const char **argv) | 938 | static int |
| 939 | __cmd_buildid_list(const char *file_name, int argc, const char **argv) | ||
| 921 | { | 940 | { |
| 922 | int rec_argc, i = 0, j; | 941 | int rec_argc, i = 0, j; |
| 923 | const char **rec_argv; | 942 | const char **rec_argv; |
| @@ -926,7 +945,7 @@ static int __cmd_buildid_list(struct perf_kvm *kvm, int argc, const char **argv) | |||
| 926 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); | 945 | rec_argv = calloc(rec_argc + 1, sizeof(char *)); |
| 927 | rec_argv[i++] = strdup("buildid-list"); | 946 | rec_argv[i++] = strdup("buildid-list"); |
| 928 | rec_argv[i++] = strdup("-i"); | 947 | rec_argv[i++] = strdup("-i"); |
| 929 | rec_argv[i++] = strdup(kvm->file_name); | 948 | rec_argv[i++] = strdup(file_name); |
| 930 | for (j = 1; j < argc; j++, i++) | 949 | for (j = 1; j < argc; j++, i++) |
| 931 | rec_argv[i] = argv[j]; | 950 | rec_argv[i] = argv[j]; |
| 932 | 951 | ||
| @@ -937,20 +956,12 @@ static int __cmd_buildid_list(struct perf_kvm *kvm, int argc, const char **argv) | |||
| 937 | 956 | ||
| 938 | int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused) | 957 | int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused) |
| 939 | { | 958 | { |
| 940 | struct perf_kvm kvm = { | 959 | const char *file_name; |
| 941 | .trace_vcpu = -1, | ||
| 942 | .report_event = "vmexit", | ||
| 943 | .sort_key = "sample", | ||
| 944 | |||
| 945 | .exit_reasons = svm_exit_reasons, | ||
| 946 | .exit_reasons_size = ARRAY_SIZE(svm_exit_reasons), | ||
| 947 | .exit_reasons_isa = "SVM", | ||
| 948 | }; | ||
| 949 | 960 | ||
| 950 | const struct option kvm_options[] = { | 961 | const struct option kvm_options[] = { |
| 951 | OPT_STRING('i', "input", &kvm.file_name, "file", | 962 | OPT_STRING('i', "input", &file_name, "file", |
| 952 | "Input file name"), | 963 | "Input file name"), |
| 953 | OPT_STRING('o', "output", &kvm.file_name, "file", | 964 | OPT_STRING('o', "output", &file_name, "file", |
| 954 | "Output file name"), | 965 | "Output file name"), |
| 955 | OPT_BOOLEAN(0, "guest", &perf_guest, | 966 | OPT_BOOLEAN(0, "guest", &perf_guest, |
| 956 | "Collect guest os data"), | 967 | "Collect guest os data"), |
| @@ -985,32 +996,34 @@ int cmd_kvm(int argc, const char **argv, const char *prefix __maybe_unused) | |||
| 985 | if (!perf_host) | 996 | if (!perf_host) |
| 986 | perf_guest = 1; | 997 | perf_guest = 1; |
| 987 | 998 | ||
| 988 | if (!kvm.file_name) { | 999 | if (!file_name) { |
| 989 | if (perf_host && !perf_guest) | 1000 | if (perf_host && !perf_guest) |
| 990 | kvm.file_name = strdup("perf.data.host"); | 1001 | file_name = strdup("perf.data.host"); |
| 991 | else if (!perf_host && perf_guest) | 1002 | else if (!perf_host && perf_guest) |
| 992 | kvm.file_name = strdup("perf.data.guest"); | 1003 | file_name = strdup("perf.data.guest"); |
| 993 | else | 1004 | else |
| 994 | kvm.file_name = strdup("perf.data.kvm"); | 1005 | file_name = strdup("perf.data.kvm"); |
| 995 | 1006 | ||
| 996 | if (!kvm.file_name) { | 1007 | if (!file_name) { |
| 997 | pr_err("Failed to allocate memory for filename\n"); | 1008 | pr_err("Failed to allocate memory for filename\n"); |
| 998 | return -ENOMEM; | 1009 | return -ENOMEM; |
| 999 | } | 1010 | } |
| 1000 | } | 1011 | } |
| 1001 | 1012 | ||
| 1002 | if (!strncmp(argv[0], "rec", 3)) | 1013 | if (!strncmp(argv[0], "rec", 3)) |
| 1003 | return __cmd_record(&kvm, argc, argv); | 1014 | return __cmd_record(file_name, argc, argv); |
| 1004 | else if (!strncmp(argv[0], "rep", 3)) | 1015 | else if (!strncmp(argv[0], "rep", 3)) |
| 1005 | return __cmd_report(&kvm, argc, argv); | 1016 | return __cmd_report(file_name, argc, argv); |
| 1006 | else if (!strncmp(argv[0], "diff", 4)) | 1017 | else if (!strncmp(argv[0], "diff", 4)) |
| 1007 | return cmd_diff(argc, argv, NULL); | 1018 | return cmd_diff(argc, argv, NULL); |
| 1008 | else if (!strncmp(argv[0], "top", 3)) | 1019 | else if (!strncmp(argv[0], "top", 3)) |
| 1009 | return cmd_top(argc, argv, NULL); | 1020 | return cmd_top(argc, argv, NULL); |
| 1010 | else if (!strncmp(argv[0], "buildid-list", 12)) | 1021 | else if (!strncmp(argv[0], "buildid-list", 12)) |
| 1011 | return __cmd_buildid_list(&kvm, argc, argv); | 1022 | return __cmd_buildid_list(file_name, argc, argv); |
| 1023 | #if defined(__i386__) || defined(__x86_64__) | ||
| 1012 | else if (!strncmp(argv[0], "stat", 4)) | 1024 | else if (!strncmp(argv[0], "stat", 4)) |
| 1013 | return kvm_cmd_stat(&kvm, argc, argv); | 1025 | return kvm_cmd_stat(file_name, argc, argv); |
| 1026 | #endif | ||
| 1014 | else | 1027 | else |
| 1015 | usage_with_options(kvm_usage, kvm_options); | 1028 | usage_with_options(kvm_usage, kvm_options); |
| 1016 | 1029 | ||
diff --git a/tools/perf/builtin-test.c b/tools/perf/builtin-test.c index 484f26cc0c00..5acd6e8e658b 100644 --- a/tools/perf/builtin-test.c +++ b/tools/perf/builtin-test.c | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | #include "util/thread_map.h" | 15 | #include "util/thread_map.h" |
| 16 | #include "util/pmu.h" | 16 | #include "util/pmu.h" |
| 17 | #include "event-parse.h" | 17 | #include "event-parse.h" |
| 18 | #include "../../include/linux/hw_breakpoint.h" | 18 | #include <linux/hw_breakpoint.h> |
| 19 | 19 | ||
| 20 | #include <sys/mman.h> | 20 | #include <sys/mman.h> |
| 21 | 21 | ||
diff --git a/tools/perf/perf.h b/tools/perf/perf.h index c50985eaec41..238f923f2218 100644 --- a/tools/perf/perf.h +++ b/tools/perf/perf.h | |||
| @@ -5,8 +5,9 @@ struct winsize; | |||
| 5 | 5 | ||
| 6 | void get_term_dimensions(struct winsize *ws); | 6 | void get_term_dimensions(struct winsize *ws); |
| 7 | 7 | ||
| 8 | #include <asm/unistd.h> | ||
| 9 | |||
| 8 | #if defined(__i386__) | 10 | #if defined(__i386__) |
| 9 | #include "../../arch/x86/include/asm/unistd.h" | ||
| 10 | #define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") | 11 | #define rmb() asm volatile("lock; addl $0,0(%%esp)" ::: "memory") |
| 11 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); | 12 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); |
| 12 | #define CPUINFO_PROC "model name" | 13 | #define CPUINFO_PROC "model name" |
| @@ -16,7 +17,6 @@ void get_term_dimensions(struct winsize *ws); | |||
| 16 | #endif | 17 | #endif |
| 17 | 18 | ||
| 18 | #if defined(__x86_64__) | 19 | #if defined(__x86_64__) |
| 19 | #include "../../arch/x86/include/asm/unistd.h" | ||
| 20 | #define rmb() asm volatile("lfence" ::: "memory") | 20 | #define rmb() asm volatile("lfence" ::: "memory") |
| 21 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); | 21 | #define cpu_relax() asm volatile("rep; nop" ::: "memory"); |
| 22 | #define CPUINFO_PROC "model name" | 22 | #define CPUINFO_PROC "model name" |
| @@ -26,20 +26,17 @@ void get_term_dimensions(struct winsize *ws); | |||
| 26 | #endif | 26 | #endif |
| 27 | 27 | ||
| 28 | #ifdef __powerpc__ | 28 | #ifdef __powerpc__ |
| 29 | #include "../../arch/powerpc/include/asm/unistd.h" | ||
| 30 | #define rmb() asm volatile ("sync" ::: "memory") | 29 | #define rmb() asm volatile ("sync" ::: "memory") |
| 31 | #define cpu_relax() asm volatile ("" ::: "memory"); | 30 | #define cpu_relax() asm volatile ("" ::: "memory"); |
| 32 | #define CPUINFO_PROC "cpu" | 31 | #define CPUINFO_PROC "cpu" |
| 33 | #endif | 32 | #endif |
| 34 | 33 | ||
| 35 | #ifdef __s390__ | 34 | #ifdef __s390__ |
| 36 | #include "../../arch/s390/include/asm/unistd.h" | ||
| 37 | #define rmb() asm volatile("bcr 15,0" ::: "memory") | 35 | #define rmb() asm volatile("bcr 15,0" ::: "memory") |
| 38 | #define cpu_relax() asm volatile("" ::: "memory"); | 36 | #define cpu_relax() asm volatile("" ::: "memory"); |
| 39 | #endif | 37 | #endif |
| 40 | 38 | ||
| 41 | #ifdef __sh__ | 39 | #ifdef __sh__ |
| 42 | #include "../../arch/sh/include/asm/unistd.h" | ||
| 43 | #if defined(__SH4A__) || defined(__SH5__) | 40 | #if defined(__SH4A__) || defined(__SH5__) |
| 44 | # define rmb() asm volatile("synco" ::: "memory") | 41 | # define rmb() asm volatile("synco" ::: "memory") |
| 45 | #else | 42 | #else |
| @@ -50,35 +47,30 @@ void get_term_dimensions(struct winsize *ws); | |||
| 50 | #endif | 47 | #endif |
| 51 | 48 | ||
| 52 | #ifdef __hppa__ | 49 | #ifdef __hppa__ |
| 53 | #include "../../arch/parisc/include/asm/unistd.h" | ||
| 54 | #define rmb() asm volatile("" ::: "memory") | 50 | #define rmb() asm volatile("" ::: "memory") |
| 55 | #define cpu_relax() asm volatile("" ::: "memory"); | 51 | #define cpu_relax() asm volatile("" ::: "memory"); |
| 56 | #define CPUINFO_PROC "cpu" | 52 | #define CPUINFO_PROC "cpu" |
| 57 | #endif | 53 | #endif |
| 58 | 54 | ||
| 59 | #ifdef __sparc__ | 55 | #ifdef __sparc__ |
| 60 | #include "../../arch/sparc/include/uapi/asm/unistd.h" | ||
| 61 | #define rmb() asm volatile("":::"memory") | 56 | #define rmb() asm volatile("":::"memory") |
| 62 | #define cpu_relax() asm volatile("":::"memory") | 57 | #define cpu_relax() asm volatile("":::"memory") |
| 63 | #define CPUINFO_PROC "cpu" | 58 | #define CPUINFO_PROC "cpu" |
| 64 | #endif | 59 | #endif |
| 65 | 60 | ||
| 66 | #ifdef __alpha__ | 61 | #ifdef __alpha__ |
| 67 | #include "../../arch/alpha/include/asm/unistd.h" | ||
| 68 | #define rmb() asm volatile("mb" ::: "memory") | 62 | #define rmb() asm volatile("mb" ::: "memory") |
| 69 | #define cpu_relax() asm volatile("" ::: "memory") | 63 | #define cpu_relax() asm volatile("" ::: "memory") |
| 70 | #define CPUINFO_PROC "cpu model" | 64 | #define CPUINFO_PROC "cpu model" |
| 71 | #endif | 65 | #endif |
| 72 | 66 | ||
| 73 | #ifdef __ia64__ | 67 | #ifdef __ia64__ |
| 74 | #include "../../arch/ia64/include/asm/unistd.h" | ||
| 75 | #define rmb() asm volatile ("mf" ::: "memory") | 68 | #define rmb() asm volatile ("mf" ::: "memory") |
| 76 | #define cpu_relax() asm volatile ("hint @pause" ::: "memory") | 69 | #define cpu_relax() asm volatile ("hint @pause" ::: "memory") |
| 77 | #define CPUINFO_PROC "model name" | 70 | #define CPUINFO_PROC "model name" |
| 78 | #endif | 71 | #endif |
| 79 | 72 | ||
| 80 | #ifdef __arm__ | 73 | #ifdef __arm__ |
| 81 | #include "../../arch/arm/include/asm/unistd.h" | ||
| 82 | /* | 74 | /* |
| 83 | * Use the __kuser_memory_barrier helper in the CPU helper page. See | 75 | * Use the __kuser_memory_barrier helper in the CPU helper page. See |
| 84 | * arch/arm/kernel/entry-armv.S in the kernel source for details. | 76 | * arch/arm/kernel/entry-armv.S in the kernel source for details. |
| @@ -89,13 +81,11 @@ void get_term_dimensions(struct winsize *ws); | |||
| 89 | #endif | 81 | #endif |
| 90 | 82 | ||
| 91 | #ifdef __aarch64__ | 83 | #ifdef __aarch64__ |
| 92 | #include "../../arch/arm64/include/asm/unistd.h" | ||
| 93 | #define rmb() asm volatile("dmb ld" ::: "memory") | 84 | #define rmb() asm volatile("dmb ld" ::: "memory") |
| 94 | #define cpu_relax() asm volatile("yield" ::: "memory") | 85 | #define cpu_relax() asm volatile("yield" ::: "memory") |
| 95 | #endif | 86 | #endif |
| 96 | 87 | ||
| 97 | #ifdef __mips__ | 88 | #ifdef __mips__ |
| 98 | #include "../../arch/mips/include/asm/unistd.h" | ||
| 99 | #define rmb() asm volatile( \ | 89 | #define rmb() asm volatile( \ |
| 100 | ".set mips2\n\t" \ | 90 | ".set mips2\n\t" \ |
| 101 | "sync\n\t" \ | 91 | "sync\n\t" \ |
| @@ -112,7 +102,7 @@ void get_term_dimensions(struct winsize *ws); | |||
| 112 | #include <sys/types.h> | 102 | #include <sys/types.h> |
| 113 | #include <sys/syscall.h> | 103 | #include <sys/syscall.h> |
| 114 | 104 | ||
| 115 | #include "../../include/uapi/linux/perf_event.h" | 105 | #include <linux/perf_event.h> |
| 116 | #include "util/types.h" | 106 | #include "util/types.h" |
| 117 | #include <stdbool.h> | 107 | #include <stdbool.h> |
| 118 | 108 | ||
diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 618d41140abd..d144d464ce39 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c | |||
| @@ -18,8 +18,8 @@ | |||
| 18 | #include "cpumap.h" | 18 | #include "cpumap.h" |
| 19 | #include "thread_map.h" | 19 | #include "thread_map.h" |
| 20 | #include "target.h" | 20 | #include "target.h" |
| 21 | #include "../../../include/linux/hw_breakpoint.h" | 21 | #include <linux/hw_breakpoint.h> |
| 22 | #include "../../../include/uapi/linux/perf_event.h" | 22 | #include <linux/perf_event.h> |
| 23 | #include "perf_regs.h" | 23 | #include "perf_regs.h" |
| 24 | 24 | ||
| 25 | #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) | 25 | #define FD(e, x, y) (*(int *)xyarray__entry(e->fd, x, y)) |
diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 6f94d6dea00f..d99b476ef37c 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h | |||
| @@ -3,7 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
| 5 | #include <stdbool.h> | 5 | #include <stdbool.h> |
| 6 | #include "../../../include/uapi/linux/perf_event.h" | 6 | #include <stddef.h> |
| 7 | #include <linux/perf_event.h> | ||
| 7 | #include "types.h" | 8 | #include "types.h" |
| 8 | #include "xyarray.h" | 9 | #include "xyarray.h" |
| 9 | #include "cgroup.h" | 10 | #include "cgroup.h" |
diff --git a/tools/perf/util/header.h b/tools/perf/util/header.h index 879d215cdac9..9bc00783f24f 100644 --- a/tools/perf/util/header.h +++ b/tools/perf/util/header.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef __PERF_HEADER_H | 1 | #ifndef __PERF_HEADER_H |
| 2 | #define __PERF_HEADER_H | 2 | #define __PERF_HEADER_H |
| 3 | 3 | ||
| 4 | #include "../../../include/uapi/linux/perf_event.h" | 4 | #include <linux/perf_event.h> |
| 5 | #include <sys/types.h> | 5 | #include <sys/types.h> |
| 6 | #include <stdbool.h> | 6 | #include <stdbool.h> |
| 7 | #include "types.h" | 7 | #include "types.h" |
diff --git a/tools/perf/util/parse-events-test.c b/tools/perf/util/parse-events-test.c index 516ecd9ddd6e..6ef213b35ecd 100644 --- a/tools/perf/util/parse-events-test.c +++ b/tools/perf/util/parse-events-test.c | |||
| @@ -3,7 +3,7 @@ | |||
| 3 | #include "evsel.h" | 3 | #include "evsel.h" |
| 4 | #include "evlist.h" | 4 | #include "evlist.h" |
| 5 | #include "sysfs.h" | 5 | #include "sysfs.h" |
| 6 | #include "../../../include/linux/hw_breakpoint.h" | 6 | #include <linux/hw_breakpoint.h> |
| 7 | 7 | ||
| 8 | #define TEST_ASSERT_VAL(text, cond) \ | 8 | #define TEST_ASSERT_VAL(text, cond) \ |
| 9 | do { \ | 9 | do { \ |
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c index 75c7b0fca6d9..6b6d03e93c3d 100644 --- a/tools/perf/util/parse-events.c +++ b/tools/perf/util/parse-events.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | #include "../../../include/linux/hw_breakpoint.h" | 1 | #include <linux/hw_breakpoint.h> |
| 2 | #include "util.h" | 2 | #include "util.h" |
| 3 | #include "../perf.h" | 3 | #include "../perf.h" |
| 4 | #include "evlist.h" | 4 | #include "evlist.h" |
diff --git a/tools/perf/util/parse-events.h b/tools/perf/util/parse-events.h index 839230ceb18b..2820c407adb2 100644 --- a/tools/perf/util/parse-events.h +++ b/tools/perf/util/parse-events.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include <linux/list.h> | 7 | #include <linux/list.h> |
| 8 | #include <stdbool.h> | 8 | #include <stdbool.h> |
| 9 | #include "types.h" | 9 | #include "types.h" |
| 10 | #include "../../../include/uapi/linux/perf_event.h" | 10 | #include <linux/perf_event.h> |
| 11 | #include "types.h" | 11 | #include "types.h" |
| 12 | 12 | ||
| 13 | struct list_head; | 13 | struct list_head; |
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h index 39f3abac7744..fdeb8ac7c5d2 100644 --- a/tools/perf/util/pmu.h +++ b/tools/perf/util/pmu.h | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | #define __PMU_H | 2 | #define __PMU_H |
| 3 | 3 | ||
| 4 | #include <linux/bitops.h> | 4 | #include <linux/bitops.h> |
| 5 | #include "../../../include/uapi/linux/perf_event.h" | 5 | #include <linux/perf_event.h> |
| 6 | 6 | ||
| 7 | enum { | 7 | enum { |
| 8 | PERF_PMU_FORMAT_VALUE_CONFIG, | 8 | PERF_PMU_FORMAT_VALUE_CONFIG, |
diff --git a/tools/perf/util/session.h b/tools/perf/util/session.h index dd6426163ba6..0eae00ad5fe7 100644 --- a/tools/perf/util/session.h +++ b/tools/perf/util/session.h | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | #include "symbol.h" | 7 | #include "symbol.h" |
| 8 | #include "thread.h" | 8 | #include "thread.h" |
| 9 | #include <linux/rbtree.h> | 9 | #include <linux/rbtree.h> |
| 10 | #include "../../../include/uapi/linux/perf_event.h" | 10 | #include <linux/perf_event.h> |
| 11 | 11 | ||
| 12 | struct sample_queue; | 12 | struct sample_queue; |
| 13 | struct ip_callchain; | 13 | struct ip_callchain; |
