diff options
author | Hemant Kumar <hemant@linux.vnet.ibm.com> | 2016-01-28 01:33:04 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-01-29 15:49:48 -0500 |
commit | 162607ea20fafb4a76234ebe4314cd733345482e (patch) | |
tree | 608663febfdeadf330b0020e6262c63a448b6d56 /tools/perf/arch | |
parent | d2db9a98c3058a45780f7fcd0cc8584858cf6b29 (diff) |
perf kvm/{x86,s390}: Remove dependency on uapi/kvm_perf.h
Its better to remove the dependency on uapi/kvm_perf.h to allow dynamic
discovery of kvm events (if its needed). To do this, some extern
variables have been introduced with which we can keep the generic
functions generic.
Signed-off-by: Hemant Kumar <hemant@linux.vnet.ibm.com>
Acked-by: Alexander Yarygin <yarygin@linux.vnet.ibm.com>
Acked-by: David Ahern <dsahern@gmail.com>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org
Link: http://lkml.kernel.org/r/1453962787-15376-1-git-send-email-hemant@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/arch')
-rw-r--r-- | tools/perf/arch/s390/util/kvm-stat.c | 8 | ||||
-rw-r--r-- | tools/perf/arch/x86/util/kvm-stat.c | 14 |
2 files changed, 18 insertions, 4 deletions
diff --git a/tools/perf/arch/s390/util/kvm-stat.c b/tools/perf/arch/s390/util/kvm-stat.c index a5dbc07ec9dc..b85a94b19c25 100644 --- a/tools/perf/arch/s390/util/kvm-stat.c +++ b/tools/perf/arch/s390/util/kvm-stat.c | |||
@@ -10,7 +10,7 @@ | |||
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include "../../util/kvm-stat.h" | 12 | #include "../../util/kvm-stat.h" |
13 | #include <asm/kvm_perf.h> | 13 | #include <asm/sie.h> |
14 | 14 | ||
15 | define_exit_reasons_table(sie_exit_reasons, sie_intercept_code); | 15 | define_exit_reasons_table(sie_exit_reasons, sie_intercept_code); |
16 | define_exit_reasons_table(sie_icpt_insn_codes, icpt_insn_codes); | 16 | define_exit_reasons_table(sie_icpt_insn_codes, icpt_insn_codes); |
@@ -18,6 +18,12 @@ define_exit_reasons_table(sie_sigp_order_codes, sigp_order_codes); | |||
18 | define_exit_reasons_table(sie_diagnose_codes, diagnose_codes); | 18 | define_exit_reasons_table(sie_diagnose_codes, diagnose_codes); |
19 | define_exit_reasons_table(sie_icpt_prog_codes, icpt_prog_codes); | 19 | define_exit_reasons_table(sie_icpt_prog_codes, icpt_prog_codes); |
20 | 20 | ||
21 | const char *vcpu_id_str = "id"; | ||
22 | const int decode_str_len = 40; | ||
23 | const char *kvm_exit_reason = "icptcode"; | ||
24 | const char *kvm_entry_trace = "kvm:kvm_s390_sie_enter"; | ||
25 | const char *kvm_exit_trace = "kvm:kvm_s390_sie_exit"; | ||
26 | |||
21 | static void event_icpt_insn_get_key(struct perf_evsel *evsel, | 27 | static void event_icpt_insn_get_key(struct perf_evsel *evsel, |
22 | struct perf_sample *sample, | 28 | struct perf_sample *sample, |
23 | struct event_key *key) | 29 | struct event_key *key) |
diff --git a/tools/perf/arch/x86/util/kvm-stat.c b/tools/perf/arch/x86/util/kvm-stat.c index 14e4e668fad7..babefda4c862 100644 --- a/tools/perf/arch/x86/util/kvm-stat.c +++ b/tools/perf/arch/x86/util/kvm-stat.c | |||
@@ -1,5 +1,7 @@ | |||
1 | #include "../../util/kvm-stat.h" | 1 | #include "../../util/kvm-stat.h" |
2 | #include <asm/kvm_perf.h> | 2 | #include <asm/svm.h> |
3 | #include <asm/vmx.h> | ||
4 | #include <asm/kvm.h> | ||
3 | 5 | ||
4 | define_exit_reasons_table(vmx_exit_reasons, VMX_EXIT_REASONS); | 6 | define_exit_reasons_table(vmx_exit_reasons, VMX_EXIT_REASONS); |
5 | define_exit_reasons_table(svm_exit_reasons, SVM_EXIT_REASONS); | 7 | define_exit_reasons_table(svm_exit_reasons, SVM_EXIT_REASONS); |
@@ -11,6 +13,12 @@ static struct kvm_events_ops exit_events = { | |||
11 | .name = "VM-EXIT" | 13 | .name = "VM-EXIT" |
12 | }; | 14 | }; |
13 | 15 | ||
16 | const char *vcpu_id_str = "vcpu_id"; | ||
17 | const int decode_str_len = 20; | ||
18 | const char *kvm_exit_reason = "exit_reason"; | ||
19 | const char *kvm_entry_trace = "kvm:kvm_entry"; | ||
20 | const char *kvm_exit_trace = "kvm:kvm_exit"; | ||
21 | |||
14 | /* | 22 | /* |
15 | * For the mmio events, we treat: | 23 | * For the mmio events, we treat: |
16 | * the time of MMIO write: kvm_mmio(KVM_TRACE_MMIO_WRITE...) -> kvm_entry | 24 | * the time of MMIO write: kvm_mmio(KVM_TRACE_MMIO_WRITE...) -> kvm_entry |
@@ -65,7 +73,7 @@ static void mmio_event_decode_key(struct perf_kvm_stat *kvm __maybe_unused, | |||
65 | struct event_key *key, | 73 | struct event_key *key, |
66 | char *decode) | 74 | char *decode) |
67 | { | 75 | { |
68 | scnprintf(decode, DECODE_STR_LEN, "%#lx:%s", | 76 | scnprintf(decode, decode_str_len, "%#lx:%s", |
69 | (unsigned long)key->key, | 77 | (unsigned long)key->key, |
70 | key->info == KVM_TRACE_MMIO_WRITE ? "W" : "R"); | 78 | key->info == KVM_TRACE_MMIO_WRITE ? "W" : "R"); |
71 | } | 79 | } |
@@ -109,7 +117,7 @@ static void ioport_event_decode_key(struct perf_kvm_stat *kvm __maybe_unused, | |||
109 | struct event_key *key, | 117 | struct event_key *key, |
110 | char *decode) | 118 | char *decode) |
111 | { | 119 | { |
112 | scnprintf(decode, DECODE_STR_LEN, "%#llx:%s", | 120 | scnprintf(decode, decode_str_len, "%#llx:%s", |
113 | (unsigned long long)key->key, | 121 | (unsigned long long)key->key, |
114 | key->info ? "POUT" : "PIN"); | 122 | key->info ? "POUT" : "PIN"); |
115 | } | 123 | } |