[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] xenbaked: Fix access to trace buffer after xentrace changes



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1209027597 -3600
# Node ID e382c13fab2b3192d64db71d63f4babd28f4e8f2
# Parent  f73b9a286ee4e0abe27036c55f3a81e35c6ea300
xenbaked: Fix access to trace buffer after xentrace changes

Signed-off-by: Naoki Nishiguchi <nisiguti@xxxxxxxxxxxxxx>
---
 tools/xenmon/xenbaked.c |   32 +++++++++++++++++++++++++++-----
 1 files changed, 27 insertions(+), 5 deletions(-)

diff -r f73b9a286ee4 -r e382c13fab2b tools/xenmon/xenbaked.c
--- a/tools/xenmon/xenbaked.c   Thu Apr 24 09:58:29 2008 +0100
+++ b/tools/xenmon/xenbaked.c   Thu Apr 24 09:59:57 2008 +0100
@@ -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-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.