diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-02-03 09:35:56 +0000 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-02-03 09:35:56 +0000 |
commit | 7a223440b71e664b31505eba0a064566d03d7e2d (patch) | |
tree | 04f8a4fff275806f3b9bc8b7ae02f8dd29da377c /xen/common/trace.c | |
parent | eddd8e39554e06e792d5fe5bb5dbeed8dbeceaf6 (diff) | |
download | xen-7a223440b71e664b31505eba0a064566d03d7e2d.tar.gz xen-7a223440b71e664b31505eba0a064566d03d7e2d.tar.bz2 xen-7a223440b71e664b31505eba0a064566d03d7e2d.zip |
xentrace: Clear lost records when disabling tracing
This patch clears the "lost records" flag on each cpu when tracing is
disabled.
Without this patch, the next time tracing starts, cpus with lost
records will generate lost record traces, even though buffers are
empty and no tracing has recently happened.
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
Diffstat (limited to 'xen/common/trace.c')
-rw-r--r-- | xen/common/trace.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/xen/common/trace.c b/xen/common/trace.c index d8eaf669ff..44cc8341d0 100644 --- a/xen/common/trace.c +++ b/xen/common/trace.c @@ -316,11 +316,26 @@ int tb_control(xen_sysctl_tbuf_op_t *tbc) tb_init_done = 1; break; case XEN_SYSCTL_TBUFOP_disable: + { /* * Disable trace buffers. Just stops new records from being written, * does not deallocate any memory. */ + int i; + tb_init_done = 0; + wmb(); + /* Clear any lost-record info so we don't get phantom lost records next time we + * start tracing. Grab the lock to make sure we're not racing anyone. After this + * hypercall returns, no more records should be placed into the buffers. */ + for_each_online_cpu(i) + { + int flags; + spin_lock_irqsave(&per_cpu(t_lock, i), flags); + per_cpu(lost_records, i)=0; + spin_unlock_irqrestore(&per_cpu(t_lock, i), flags); + } + } break; default: rc = -EINVAL; |