diff options
author | Zhang, Yanmin <yanmin_zhang@linux.intel.com> | 2010-04-19 01:32:41 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2010-04-19 05:35:33 -0400 |
commit | 39447b386c846bbf1c56f6403c5282837486200f (patch) | |
tree | 5ceaf9900919e4bd269b92c55df15e33039fefd1 /kernel/perf_event.c | |
parent | b5a80b7e91d6c067339e4d81a0176a835e9bf910 (diff) |
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 07b7a435bf03..9dbe8cdaf145 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 | |||
2798 | 2798 | ||
2799 | 2799 | ||
2800 | /* | 2800 | /* |
2801 | * We assume there is only KVM supporting the callbacks. | ||
2802 | * Later on, we might change it to a list if there is | ||
2803 | * another virtualization implementation supporting the callbacks. | ||
2804 | */ | ||
2805 | struct perf_guest_info_callbacks *perf_guest_cbs; | ||
2806 | |||
2807 | int perf_register_guest_info_callbacks(struct perf_guest_info_callbacks *cbs) | ||
2808 | { | ||
2809 | perf_guest_cbs = cbs; | ||
2810 | return 0; | ||
2811 | } | ||
2812 | EXPORT_SYMBOL_GPL(perf_register_guest_info_callbacks); | ||
2813 | |||
2814 | int perf_unregister_guest_info_callbacks(struct perf_guest_info_callbacks *cbs) | ||
2815 | { | ||
2816 | perf_guest_cbs = NULL; | ||
2817 | return 0; | ||
2818 | } | ||
2819 | EXPORT_SYMBOL_GPL(perf_unregister_guest_info_callbacks); | ||
2820 | |||
2821 | /* | ||
2801 | * Output | 2822 | * Output |
2802 | */ | 2823 | */ |
2803 | static bool perf_output_space(struct perf_mmap_data *data, unsigned long tail, | 2824 | 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) | |||
3749 | .event_id = { | 3770 | .event_id = { |
3750 | .header = { | 3771 | .header = { |
3751 | .type = PERF_RECORD_MMAP, | 3772 | .type = PERF_RECORD_MMAP, |
3752 | .misc = 0, | 3773 | .misc = PERF_RECORD_MISC_USER, |
3753 | /* .size */ | 3774 | /* .size */ |
3754 | }, | 3775 | }, |
3755 | /* .pid */ | 3776 | /* .pid */ |