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] The xentrace_format script doesn't work on x86/64. Pytho

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] The xentrace_format script doesn't work on x86/64. Python pads the input
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 18 Nov 2005 20:14:17 +0000
Delivery-date: Fri, 18 Nov 2005 20:15:55 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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 kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 378e1c58bcd20a1622977796af39dcf8030e1588
# Parent  0970a2fdbee95d74d47d6489a8262814a0d2b3c5
The xentrace_format script doesn't work on x86/64. Python pads the input 
structure because the first field is 32 bits and the next is 64 bits, 
whereas x86-32 doesn't pad. The quick fix is to read the cpu id 
separately as a 32bit value, then read the rest of the trace record. 
Here is a little patch that does that. Tested on x86/32 SMP and x86/64.


Signed-off-by: Rob Gardner <rob.gardner@xxxxxx>

diff -r 0970a2fdbee9 -r 378e1c58bcd2 tools/xentrace/xentrace_format
--- a/tools/xentrace/xentrace_format    Fri Nov 18 16:50:25 2005
+++ b/tools/xentrace/xentrace_format    Fri Nov 18 16:54:23 2005
@@ -85,7 +85,9 @@
 
 # structure of trace record + prepended CPU id (as output by xentrace):
 # CPU(I) TSC(Q) EVENT(L) D1(L) D2(L) D3(L) D4(L) D5(L)
-TRCREC = "IQLLLLLL"
+# read CPU id separately to avoid structure packing problems on 64-bit arch.
+CPUREC = "I"
+TRCREC = "QLLLLLL"
 
 last_tsc = [0,0,0,0,0,0,0,0]
 
@@ -94,11 +96,16 @@
 while not interrupted:
     try:
        i=i+1
+        line = sys.stdin.read(struct.calcsize(CPUREC))
+        if not line:
+            break
+        cpu = struct.unpack(CPUREC, line)[0]
+
         line = sys.stdin.read(struct.calcsize(TRCREC))
         if not line:
             break
 
-        (cpu, tsc, event, d1, d2, d3, d4, d5) = struct.unpack(TRCREC, line)
+        (tsc, event, d1, d2, d3, d4, d5) = struct.unpack(TRCREC, line)
 
        #tsc = (tscH<<32) | tscL
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] The xentrace_format script doesn't work on x86/64. Python pads the input, Xen patchbot -unstable <=