WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] [XENTRACE] Remember number of lost trace

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XENTRACE] Remember number of lost trace records when
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 12 Jul 2006 16:50:23 +0000
Delivery-date: Wed, 12 Jul 2006 09:53:38 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID e05d60be5adb22afc42d18d631041cc6e2ccbe91
# Parent  3cdb93867f817243f6e770baf72c58a40d33de5c
[XENTRACE] Remember number of lost trace records when
trace buffer is full and write a 'number of lost records'
entry when space becomes available.
From: Rob Gardner <rob.gardner@xxxxxx>
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/common/trace.c         |   23 ++++++++++++++++++++---
 xen/include/public/trace.h |    1 +
 2 files changed, 21 insertions(+), 3 deletions(-)

diff -r 3cdb93867f81 -r e05d60be5adb xen/common/trace.c
--- a/xen/common/trace.c        Mon Jul 10 16:09:20 2006 +0100
+++ b/xen/common/trace.c        Mon Jul 10 17:05:44 2006 +0100
@@ -46,6 +46,8 @@ static int nr_recs;
 /* Send virtual interrupt when buffer level reaches this point */
 static int t_buf_highwater;
 
+/* Number of records lost due to per-CPU trace buffer being full. */
+static DEFINE_PER_CPU(unsigned long, lost_records);
 
 /* a flag recording whether initialization has been done */
 /* or more properly, if the tbuf subsystem is enabled right now */
@@ -234,7 +236,7 @@ void trace(u32 event, unsigned long d1, 
     struct t_buf *buf;
     struct t_rec *rec;
     unsigned long flags;
-
+    
     BUG_ON(!tb_init_done);
 
     if ( (tb_event_mask & event) == 0 )
@@ -259,10 +261,25 @@ void trace(u32 event, unsigned long d1, 
 
     local_irq_save(flags);
 
-    if ( (buf->prod - buf->cons) >= nr_recs )
-    {
+    /* Check if space for two records (we write two if there are lost recs). */
+    if ( (buf->prod - buf->cons) >= (nr_recs - 1) )
+    {
+        this_cpu(lost_records)++;
         local_irq_restore(flags);
         return;
+    }
+
+    if ( unlikely(this_cpu(lost_records) != 0) )
+    {
+        rec = &t_recs[smp_processor_id()][buf->prod % nr_recs];
+        memset(rec, 0, sizeof(*rec));
+        rec->cycles  = (u64)get_cycles();
+        rec->event   = TRC_LOST_RECORDS;
+        rec->data[0] = this_cpu(lost_records);
+        this_cpu(lost_records) = 0;
+
+        wmb();
+        buf->prod++;
     }
 
     rec = &t_recs[smp_processor_id()][buf->prod % nr_recs];
diff -r 3cdb93867f81 -r e05d60be5adb xen/include/public/trace.h
--- a/xen/include/public/trace.h        Mon Jul 10 16:09:20 2006 +0100
+++ b/xen/include/public/trace.h        Mon Jul 10 17:05:44 2006 +0100
@@ -26,6 +26,7 @@
 #define TRC_VMXIO    0x00088000   /* VMX io emulation trace  */
 
 /* Trace events per class */
+#define TRC_LOST_RECORDS        (TRC_GEN + 1)
 
 #define TRC_SCHED_DOM_ADD       (TRC_SCHED +  1)
 #define TRC_SCHED_DOM_REM       (TRC_SCHED +  2)

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] [XENTRACE] Remember number of lost trace records when, Xen patchbot-unstable <=