Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: mbligh@google.com (Martin Bligh)
Subject: [ltt-dev] LTTng specialized probes
Date: Thu, 9 Oct 2008 09:28:22 -0700	[thread overview]
Message-ID: <33307c790810090928m721dbfcbjf3ece72e81305989@mail.gmail.com> (raw)
In-Reply-To: <20081009161533.GA20624@Krystal>

> Yes, there is the problem of separation of the two layers, but there is
> more than that : if we use a separate event to write the extended TSC
> value, we will have to do this when writing an event in a lockless
> scheme :
>
> - Do
>  - read write offset
>  - Read TSC, compare to per-buffer "last_tsc"
>  - If 27-bit overflow, write large TSC event
>    - Do
>      - read write offset
>      - read TSC
>      - compute event size
>    - while cmpxchg write offset fails
>    - write per-buffer "last-tsc"
>    - continue (restart loop)
>  - compute event size
> - while cmpxchg write offset fails
> - write per-buffer "last-tsc"
>
> By doing this, we actually have to do 3 TSC reads when we detect an
> overflow intead of a single one.

OK. TSC read is cheap

> Also, we open the window for an
> infinite loop if for some weird reason the TSC read becomes slower than
> a 27-bits overflow (with virtualization you never know what will bite
> you...).

Umm. if it takes that long to read the TSC, I'd say your machine
is utterly useless.  I think you're worrying too much about REALLY
obscure corner cases. Either tracing is not supported on those
platforms, or we shift the TSC eventually by 10 bits right and forgo
any hope of resolution (since your timing is *completely* screwed
at this point anyway.

> However, I like your idea of using this "ext. TSC" bit as an event bit.
> We could do :
>
> (32-bits alignment)
> 27-bits TSC
> 5-bits event ID
>  ID #31 reserved to specify extended event ID
>  ID #30 reserved to specify both ext. event ID and event size
>  ID #29 reserved to specify ext. event ID, event size and ext. TSC
> <ext.>
> 16-bits event ID (opt)
> 16-bits event size (opt) size = 65535 to specify large event size
> 64-bits TSC (opt) (aligned on sizeof (void *))
> 32-bits large event size (opt) (aligned on 32-bits)
> (event payload aligned on sizeof(void *))
>
> Which lets us put the extended TSC in the same event header by using the
> ext. event ID in that case to encode the event ID. This would leave us
> 29 IDs available (0-28) and would not require any 3-TSC reads algorithm
> (which could cause an infinite loop) to deal with overflow.
>
> Mathieu
>
> --
> Mathieu Desnoyers
> OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
>




  reply	other threads:[~2008-10-09 16:28 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <5df78e1d0809231814i4b9b98eeyfb9746e5dbb9eb72@mail.gmail.com>
     [not found] ` <20080924072503.GA15570@bolzano.suse.de>
     [not found]   ` <532480950809240032t644448f7lc4fdc0dffca69b9@mail.gmail.com>
2008-10-06 14:11     ` Mathieu Desnoyers
2008-10-06 15:14       ` Martin Bligh
2008-10-06 15:26         ` Mathieu Desnoyers
2008-10-06 15:37           ` Martin Bligh
2008-10-06 15:56             ` Mathieu Desnoyers
2008-10-06 17:55       ` Jiaying Zhang
2008-10-06 17:55         ` Jiaying Zhang
2008-10-06 17:55         ` Jiaying Zhang
     [not found]         ` <5df78e1d0810071116i2e9790cdx8d5854dbfa50cfaf@mail.gmail.com>
2008-10-07 21:28           ` Michael Davidson
2008-10-07 21:28             ` Michael Davidson
2008-10-07 21:28             ` Michael Davidson
2008-10-08  0:07             ` Mathieu Desnoyers
2008-10-08 15:56               ` Jan Kiszka
2008-10-08 15:56                 ` Jan Kiszka
2008-10-08 15:56                 ` Jan Kiszka
2008-10-08 16:06                 ` Martin Bligh
2008-10-09  2:43                   ` Mathieu Desnoyers
2008-10-09  2:24                 ` Mathieu Desnoyers
2008-10-09  2:24                   ` Mathieu Desnoyers
2008-10-09  2:24                   ` Mathieu Desnoyers
2008-10-09  3:04               ` Michael Davidson
2008-10-09  3:04                 ` Michael Davidson
2008-10-09  3:04                 ` Michael Davidson
2008-10-09 15:28                 ` Mathieu Desnoyers
2008-10-09 15:39                   ` Martin Bligh
2008-10-09 16:15                     ` Mathieu Desnoyers
2008-10-09 16:28                       ` Martin Bligh [this message]
2008-10-09 16:55                         ` Mathieu Desnoyers
2008-10-08  0:26         ` Mathieu Desnoyers

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=33307c790810090928m721dbfcbjf3ece72e81305989@mail.gmail.com \
    --to=mbligh@google.com \
    /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