diff options
author | Zhang, Yanmin <yanmin_zhang@linux.intel.com> | 2010-04-19 05:32:41 (GMT) |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-04-19 09:35:33 (GMT) |
commit | 39447b386c846bbf1c56f6403c5282837486200f (patch) | |
tree | 5ceaf9900919e4bd269b92c55df15e33039fefd1 /kernel/perf_event.c | |
parent | b5a80b7e91d6c067339e4d81a0176a835e9bf910 (diff) | |
download | linux-39447b386c846bbf1c56f6403c5282837486200f.tar.xz |
perf: Enhance perf to allow for guest statistic collection from host
Below patch introduces perf_guest_info_callbacks and related
register/unregister functions. Add more PERF_RECORD_MISC_XXX bits
meaning guest kernel and guest user space.
Signed-off-by: Zhang Yanmin <yanmin_zhang@linux.intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Diffstat (limited to 'kernel/perf_event.c')
-rw-r--r-- | kernel/perf_event.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/kernel/perf_event.c b/kernel/perf_event.c index 07b7a43..9dbe8cd 100644 --- a/kernel/perf_event.c +++ b/kernel/perf_event.c @@ -2798,6 +2798,27 @@ void perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int ski /* + * We assume there is only KVM supporting the callbacks. + * Later on, we might change it to a list if there is + * another virtualization implementation supporting the callbacks. + */ +struct perf_guest_info_callbacks *perf_guest_cbs; + +int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs) +{ + perf_guest_cbs = cbs; + return 0; +} +EXPORT_SYMBOL_GPL(perf_register_guest_info_callbacks); + +int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs) +{ + perf_guest_cbs = NULL; + return 0; +} +EXPORT_SYMBOL_GPL(perf_unregister_guest_info_callbacks); + +/* * Output */ static bool perf_output_space(struct perf_mmap_data *data, unsigned long tail, @@ -3749,7 +3770,7 @@ void __perf_event_mmap(struct vm_area_struct *vma) .event_id = { .header = { .type = PERF_RECORD_MMAP, - .misc = 0, + .misc = PERF_RECORD_MISC_USER, /* .size */ }, /* .pid */ |