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

[Xen-devel] [PATCH] xentrace_format: use low 32 bit of 'event' field

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>


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



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