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: Fix bug in logic for bytes_to_w

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] xentrace: Fix bug in logic for bytes_to_wrap in trace buffer.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Feb 2008 07:10:07 -0800
Delivery-date: Mon, 11 Feb 2008 07:10:06 -0800
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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1202723136 0
# Node ID 7d03c0b0750482ec96ec9fcf93c2b585f7740af5
# Parent  1b750b9cf4319c076bb831d26dcdcffbd5cfb913
xentrace: Fix bug in logic for bytes_to_wrap in trace buffer.
Admittedly, the bug could only be manifest with much larger trace
records than are currently allowed (or equivalently, much smaller
trace buffers), but the old code was harder to read, and thus hid the
logic bug well, too.

Signed-off-by: Michael A Fetterman <Michael.Fetterman@xxxxxxxxxxxx>
---
 xen/common/trace.c |   29 ++++++++++-------------------
 1 files changed, 10 insertions(+), 19 deletions(-)

diff -r 1b750b9cf431 -r 7d03c0b07504 xen/common/trace.c
--- a/xen/common/trace.c        Thu Feb 07 19:30:36 2008 +0000
+++ b/xen/common/trace.c        Mon Feb 11 09:45:36 2008 +0000
@@ -425,25 +425,18 @@ void __trace_var(u32 event, int cycles, 
             total_size += bytes_to_wrap;
             bytes_to_wrap = data_size;
         } 
-        else
-        {
-            bytes_to_wrap -= LOST_REC_SIZE;
-            if ( bytes_to_wrap == 0 )
-                bytes_to_wrap = data_size;
-        }
         total_size += LOST_REC_SIZE;
+        bytes_to_wrap -= LOST_REC_SIZE;
+
+        /* LOST_REC might line up perfectly with the buffer wrap */
+        if ( bytes_to_wrap == 0 )
+            bytes_to_wrap = data_size;
     }
 
     if ( rec_size > bytes_to_wrap )
     {
         total_size += bytes_to_wrap;
-        bytes_to_wrap = data_size;
     } 
-    else
-    {
-        bytes_to_wrap -= rec_size;
-    }
-
     total_size += rec_size;
 
     /* Do we have enough space for everything? */
@@ -466,14 +459,12 @@ void __trace_var(u32 event, int cycles, 
             insert_wrap_record(buf, LOST_REC_SIZE);
             bytes_to_wrap = data_size;
         } 
-        else
-        {
-            bytes_to_wrap -= LOST_REC_SIZE;
-            /* LOST_REC might line up perfectly with the buffer wrap */
-            if ( bytes_to_wrap == 0 )
-                bytes_to_wrap = data_size;
-        }
         insert_lost_records(buf);
+        bytes_to_wrap -= LOST_REC_SIZE;
+
+        /* LOST_REC might line up perfectly with the buffer wrap */
+        if ( bytes_to_wrap == 0 )
+            bytes_to_wrap = data_size;
     }
 
     if ( rec_size > bytes_to_wrap )

_______________________________________________
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: Fix bug in logic for bytes_to_wrap in trace buffer., Xen patchbot-unstable <=