From: Keir Fraser Date: Fri, 14 Dec 2007 10:25:00 +0000 (+0000) Subject: xenoprof: flush remaining smples when sampling is stopped. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14613^2~6 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=29070efe2046543429dddf92a6b36c19f974c7f2;p=xen.git 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 --- 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 #include +#include #include #include #include @@ -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: {