debuggers.hg

changeset 20925:2a07df55c08a

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>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Feb 03 09:35:56 2010 +0000 (2010-02-03)
parents 6ade83cb21ca
children 0e453e4d932d
files xen/common/trace.c
line diff
     1.1 --- a/xen/common/trace.c	Wed Feb 03 09:35:23 2010 +0000
     1.2 +++ b/xen/common/trace.c	Wed Feb 03 09:35:56 2010 +0000
     1.3 @@ -316,11 +316,26 @@ int tb_control(xen_sysctl_tbuf_op_t *tbc
     1.4              tb_init_done = 1;
     1.5          break;
     1.6      case XEN_SYSCTL_TBUFOP_disable:
     1.7 +    {
     1.8          /*
     1.9           * Disable trace buffers. Just stops new records from being written,
    1.10           * does not deallocate any memory.
    1.11           */
    1.12 +        int i;
    1.13 +
    1.14          tb_init_done = 0;
    1.15 +        wmb();
    1.16 +        /* Clear any lost-record info so we don't get phantom lost records next time we
    1.17 +         * start tracing.  Grab the lock to make sure we're not racing anyone.  After this
    1.18 +         * hypercall returns, no more records should be placed into the buffers. */
    1.19 +        for_each_online_cpu(i)
    1.20 +        {
    1.21 +            int flags;
    1.22 +            spin_lock_irqsave(&per_cpu(t_lock, i), flags);
    1.23 +            per_cpu(lost_records, i)=0;
    1.24 +            spin_unlock_irqrestore(&per_cpu(t_lock, i), flags);
    1.25 +        }
    1.26 +    }
    1.27          break;
    1.28      default:
    1.29          rc = -EINVAL;