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] xentrace_format: use low 32 bit of 'event' field

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] xentrace_format: use low 32 bit of 'event' field
From: "Thomas Friebel" <thomas.friebel@xxxxxxx>
Date: Tue, 06 Feb 2007 19:11:53 +0100
Delivery-date: Tue, 06 Feb 2007 10:10:29 -0800
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
xentrace and/or xentrace_format does not handle the 'event' field of
trace entries correctly.

'event' is a 32 bit field:
  xen/include/public/trace.h:90:    uint32_t event;

When compiling for 64 bit 'event' gets 64 bit aligned by gcc (I use gcc
4.1.2 by openSUSE 10.2 x86-64). xentrace dumps the data into the trace
file like it is in memory. xentrace_format reads the 'event' field as a
'long' value. So in a 64 bit environment the highest 32 bit contain
bogus data. This patch masks these highest 32 bit in xentrace_format. I
chose to fix this in xentrace_format because it is not on the
performance critical path Xen -> ... -> file.

Signed-off-by: Thomas Friebel <thomas.friebel@xxxxxxx>

Cheers
  Thomas


diff -r 07455edbf4f7 tools/xentrace/xentrace_format
--- a/tools/xentrace/xentrace_format    Tue Feb 06 13:51:29 2007 +0100
+++ b/tools/xentrace/xentrace_format    Tue Feb 06 17:13:15 2007 +0100
@@ -107,6 +107,10 @@ while not interrupted:

         (tsc, event, d1, d2, d3, d4, d5) = struct.unpack(TRCREC, line)

+        # gcc aligns struct members when compiling for 64 bit
+        # so only use the lowest 32 bit of event
+        event &= 0xffffffff
+
        #tsc = (tscH<<32) | tscL

        #print i, tsc

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] xentrace_format: use low 32 bit of 'event' field, Thomas Friebel <=