# HG changeset patch # User yamahata@xxxxxxxxxxxxx # Date 1197515834 -32400 # Node ID 45c190e23dab1b37da1490af90002e1367a856a5 # Parent 5445a8208b7c8bff114934c64f6d9338d943cd50 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. PATCHNAME: xenoprof_flush_samples Signed-off-by: Isaku Yamahata diff -r 5445a8208b7c -r 45c190e23dab xen/common/xenoprof.c --- a/xen/common/xenoprof.c Tue Dec 11 17:38:21 2007 +0900 +++ b/xen/common/xenoprof.c Thu Dec 13 12:17:14 2007 +0900 @@ -12,6 +12,7 @@ #ifndef COMPAT #include #include +#include /* for send_guest_vcpu_virq() */ #include #include #include @@ -747,14 +748,30 @@ int do_xenoprof_op(int op, XEN_GUEST_HAN break; case XENOPROF_stop: + { + int i; if ( xenoprof_state != XENOPROF_PROFILING ) { ret = -EPERM; break; } xenoprof_arch_stop(); + + /* flush remaining samples */ + for ( i = 0; i < adomains; i++ ) + { + struct domain *d; + struct vcpu *v; + + 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: {