Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
From: mmcternan@airvana.com (Mike McTernan)
Subject: [ltt-dev] trace_clock_update() spinning
Date: Tue, 2 Feb 2010 18:52:52 -0000	[thread overview]
Message-ID: <4B3F8896E1733D4787DDB0EA1C7FF91F0108CDD1@ukmail.uk.wirelessworld.airvananet.com> (raw)

Hi,

I'm using Linux 2.6.28.2 + LTTng 0.88 on an ARM Freescale i.MX51 board.


The system works quite well - in fact LTTng is awesome!  But there's a
problem that the output in LTTV shows run_timer_softirq() taking almost
all the time between timer ticks.  HZ is set to 100 so the timer IRQ
runs every 10ms, with run_timer_softirq() typically taking about 9.8ms
as measured in LTTV.

I added some trace_mark() calls to find the consumer of this time to be
trace_clock_update().  Specifically the atomic update:

  n = 0;
  
  do {
    n++;
    
    old_clock = atomic_long_read(&trace_clock);
    new_clock = (old_clock + (ticks << TRACE_CLOCK_SHIFT))
      & (~((1 << TRACE_CLOCK_SHIFT) - 1));             
  } while (atomic_long_cmpxchg(&trace_clock, old_clock, new_clock)
             != old_clock);

  trace_mark(trace_clock_update, exit, "exit %u", n);

This never appears to loop as the "exit" value I added is always 1.
However I notice that on ARM atomic_long_cmpxchg() contains a loop, and
so is presumably racing around in there.

I'm not sure if this something completely unexpected, or normal
behaviour?  Looking through the code I can't see that trace_clock is
updated in many cases, although my grep maybe off.  I wondered if the
ARM atomic_long_cmpxchg() is broken, but didn't find much there either.

Since I'm on a uniprocessor system, could I safely modify the update
function to just atomically update the trace_clock without using the
cmpxchg() operation since it's called in the soft IRQ?
 
Regards,

Mike





             reply	other threads:[~2010-02-02 18:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02 18:52 Mike McTernan [this message]
2010-02-02 19:42 ` Mathieu Desnoyers
2010-02-02 21:12   ` Mike McTernan
2010-02-05  9:37   ` Mike McTernan
2010-02-05 15:16     ` Mathieu Desnoyers
2010-02-05 15:48       ` Josh Boyer
2010-02-05 15:57         ` Mathieu Desnoyers
2010-02-05 17:27       ` Mike McTernan
2010-02-09  0:30         ` Mathieu Desnoyers
2010-02-09 10:19           ` Mike McTernan
2010-02-09 14:42             ` 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=4B3F8896E1733D4787DDB0EA1C7FF91F0108CDD1@ukmail.uk.wirelessworld.airvananet.com \
    --to=mmcternan@airvana.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