Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: mathieu.desnoyers@polymtl.ca (Mathieu Desnoyers)
Subject: [ltt-dev] [PATCH] Fix bug in lttv from 0.12.0 to 0.12.10
Date: Wed, 18 Feb 2009 00:31:31 -0500	[thread overview]
Message-ID: <20090218053131.GA32359@Krystal> (raw)

Hi,

I found a nasty event id / timetamping bug in lttv. Basically, when
enough events were registered in a channel to come up to IDs 29, 30 and
31, there were side-effects on how the timestamp update was done for the
specific event because the event id was overwritten by the case 29: in
the switch() before the test done later in a if() statement. LTTV
0.12.11 fixes this. For reference, here is the diff.

Mathieu, getting back to timestamp-sanity land.

Index: tracefile.c
===================================================================
--- tracefile.c	(revision 3321)
+++ tracefile.c	(working copy)
@@ -1256,6 +1256,7 @@
   void * pos;
   LttEvent *event;
   void *pos_aligned;
+  guint16 packed_evid;	/* event id reader from the 5 bits in header */
  
   event = &tf->event;
   pos = tf->buffer.head + event->offset;
@@ -1267,11 +1268,11 @@
   pos_aligned = pos;
   
   event->timestamp = ltt_get_uint32(LTT_GET_BO(tf), pos);
-  event->event_id = event->timestamp >> tf->tscbits;
+  event->event_id = packed_evid = event->timestamp >> tf->tscbits;
   event->timestamp = event->timestamp & tf->tsc_mask;
   pos += sizeof(guint32);
 
-  switch (event->event_id) {
+  switch (packed_evid) {
   case 29:  /* LTT_RFLAG_ID_SIZE_TSC */
     event->event_id = ltt_get_uint16(LTT_GET_BO(tf), pos);
     pos += sizeof(guint16);
@@ -1305,7 +1306,7 @@
     break;
   }
 
-  if (likely(event->event_id != 29)) {
+  if (likely(packed_evid != 29)) {
       /* No extended timestamp */
       if (event->timestamp < (tf->buffer.tsc & tf->tsc_mask))
         tf->buffer.tsc = ((tf->buffer.tsc & ~tf->tsc_mask)  /* overflow */


-- 
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68




                 reply	other threads:[~2009-02-18  5:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090218053131.GA32359@Krystal \
    --to=mathieu.desnoyers@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox