diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2007-12-14 10:25:00 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2007-12-14 10:25:00 +0000 |
commit | 29070efe2046543429dddf92a6b36c19f974c7f2 (patch) | |
tree | 900b33f10c81bab46a14c4c9e9aadabd30b1ae30 | |
parent | 53bd75393ffd661479126fc1f6abc27b6892f9f5 (diff) | |
download | xen-29070efe2046543429dddf92a6b36c19f974c7f2.tar.gz xen-29070efe2046543429dddf92a6b36c19f974c7f2.tar.bz2 xen-29070efe2046543429dddf92a6b36c19f974c7f2.zip |
xenoprof: flush remaining smples when sampling is stopped.
Xenoprof notifies guest kernel via VIRQ_XENOPROF when sampled.
But it does coarsly based on heuristic so that sometimes VIRQ_XENOPROF
isn't delivered resulting in that oprofile daemon collects no sample.
To avoid that situation, always send VIRQ_XENOPROF when sampling is
stopped.
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
-rw-r--r-- | xen/common/xenoprof.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/xen/common/xenoprof.c b/xen/common/xenoprof.c index fee2a6556b..741c9f04d3 100644 --- a/xen/common/xenoprof.c +++ b/xen/common/xenoprof.c @@ -12,6 +12,7 @@ #ifndef COMPAT #include <xen/guest_access.h> #include <xen/sched.h> +#include <xen/event.h> #include <public/xenoprof.h> #include <xen/paging.h> #include <xsm/xsm.h> @@ -747,14 +748,30 @@ int do_xenoprof_op(int op, XEN_GUEST_HANDLE(void) arg) break; case XENOPROF_stop: + { + struct domain *d; + struct vcpu *v; + int i; + if ( xenoprof_state != XENOPROF_PROFILING ) { ret = -EPERM; break; } xenoprof_arch_stop(); + + /* Flush remaining samples. */ + for ( i = 0; i < adomains; i++ ) + { + if ( !active_ready[i] ) + continue; + d = active_domains[i]; + for_each_vcpu(d, v) + send_guest_vcpu_virq(v, VIRQ_XENOPROF); + } xenoprof_state = XENOPROF_READY; break; + } case XENOPROF_disable_virq: { |