From: "Thomas Friebel" Subject: [PATCH] xentrace_format: use low 32 bit of 'event' field Date: Tue, 06 Feb 2007 19:11:53 +0100 Message-ID: <1170785513.15736.58.camel@flosshilde.osrc.amd.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1119949601==" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Mime-version: 1.0 Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org --===============1119949601== Content-Type: multipart/signed; boundary="=-G4UJRZRiHpT2AiVfZr+d"; micalg=pgp-sha1; protocol="application/pgp-signature" --=-G4UJRZRiHpT2AiVfZr+d Content-Type: text/plain Content-Transfer-Encoding: quoted-printable 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 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) =3D struct.unpack(TRCREC, line) + # gcc aligns struct members when compiling for 64 bit + # so only use the lowest 32 bit of event + event &=3D 0xffffffff + #tsc =3D (tscH<<32) | tscL #print i, tsc --=-G4UJRZRiHpT2AiVfZr+d Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQBFyMTpc333wEHy1T8RAom0AJ9eIfpHIKGUDddoAx9I7wIBNoO/egCbBqvb kqIrzvJXPnm5+WrDKhtu+zI= =lcZi -----END PGP SIGNATURE----- --=-G4UJRZRiHpT2AiVfZr+d-- --===============1119949601== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1119949601==--