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-devel

[Xen-devel] [PATCH] xenbaked: Fix access to trace buffer after xentrace

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] xenbaked: Fix access to trace buffer after xentrace changes
From: NISHIGUCHI Naoki <nisiguti@xxxxxxxxxxxxxx>
Date: Thu, 24 Apr 2008 13:38:10 +0900
Delivery-date: Wed, 23 Apr 2008 21:38:43 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.12 (Windows/20080213)
Hi,

Xenmon does not work correctlly after xentrace changes in cs 17000.

Attached patch fixes this problem.
This patch modifies access to trace buffer same as tools/xentrace.

Signed-off-by: Naoki Nishiguchi <nisiguti@xxxxxxxxxxxxxx>

Regards,
Naoki Nishiguchi
diff -r 77dec8732cde tools/xenmon/xenbaked.c
--- a/tools/xenmon/xenbaked.c   Wed Apr 23 16:58:44 2008 +0100
+++ b/tools/xenmon/xenbaked.c   Thu Apr 24 11:19:41 2008 +0900
@@ -509,14 +509,36 @@ int monitor_tbufs(void)
     {
         for ( i = 0; (i < num) && !interrupted; i++ )
         {
-            while ( meta[i]->cons != meta[i]->prod )
+            unsigned long start_offset, end_offset, cons, prod;
+
+            cons = meta[i]->cons;
+            prod = meta[i]->prod;
+            xen_rmb(); /* read prod, then read item. */
+
+            if ( cons == prod )
+                continue;
+
+            start_offset = cons % data_size;
+            end_offset = prod % data_size;
+
+            if ( start_offset >= end_offset )
             {
-                xen_rmb(); /* read prod, then read item. */
+                while ( start_offset != data_size )
+                {
+                    rec_size = process_record(
+                        i, (struct t_rec *)(data[i] + start_offset));
+                    start_offset += rec_size;
+                }
+                start_offset = 0;
+            }
+            while ( start_offset != end_offset )
+            {
                 rec_size = process_record(
-                    i, (struct t_rec *)(data[i] + meta[i]->cons % data_size));
-                xen_mb(); /* read item, then update cons. */
-                meta[i]->cons += rec_size;
+                    i, (struct t_rec *)(data[i] + start_offset));
+                start_offset += rec_size;
             }
+            xen_mb(); /* read item, then update cons. */
+            meta[i]->cons = prod;
         }
 
        wait_for_event();
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] xenbaked: Fix access to trace buffer after xentrace changes, NISHIGUCHI Naoki <=