<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>From: </b>"Hongbo Zhang" <hongbo.zhang@linaro.org><br><b>To: </b>"mathieu desnoyers" <mathieu.desnoyers@efficios.com>, lttng-dev@lists.lttng.org<br><b>Sent: </b>Tuesday, March 18, 2014 4:07:19 AM<br><b>Subject: </b>Regarding LTTng Support for ARM NO-HZ<br><div><br></div><div dir="ltr">Hi Mathieu Desnoyers and all LTTng developers,</div></blockquote><div><br></div><div>Hi,<br></div><div><br></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div>This is Hongbo Zhang, working for Linaro. We have to enable the NO-HZ feature for some special case, and this leads to the question whether the LTTng can work without kernel ticks on ARM or not.</div><div><br></div><div>I found out some clue that LTTng only supports x86 NO-HZ in an old link:</div><div><a href="http://git.lttng.org/?p=lttv.git;a=blob_plain;f=doc/developer/lttng-lttv-roadmap.html" target="_blank" data-mce-href="http://git.lttng.org/?p=lttv.git;a=blob_plain;f=doc/developer/lttng-lttv-roadmap.html">http://git.lttng.org/?p=lttv.git;a=blob_plain;f=doc/developer/lttng-lttv-roadmap.html</a><br></div></div></blockquote><div><br></div><div>This is an old LTTng 0.x link, and does not apply to LTTng 2.x.<br></div><div><br></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div>I think the the LTTng doesn't support ARM NO-HZ, right?</div></div></blockquote><div><br></div><div>While lib ring buffer within lttng-modules has configuration modes to allow<br></div><div>minimizing the impact on NO_HZ systems, the current lttng-modules 2.x<br></div><div>is not setup to use those configuration options, so lttng-modules will wakeup<br></div><div>cpus periodically to flush buffers (when kernel tracing is active).<br></div><div><br></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div>And I am going to add the ARM NO-HZ support to it now, so could you please give me some instructions for quick start?</div></div></blockquote><div><br></div><div>You will probably want to start by looking at the "read timer" option of<br></div><div>channels, and see how it is handled within lttng-modules, and how it impacts<br></div><div>the lib ring buffer client configuration with lttng-modules.<br></div><div><br></div><div>what you probably want is lttng-modules:<br></div><div><br></div><div>lib/ringbuffer/config.h<br></div><div><br></div><div>RING_BUFFER_WAKEUP_BY_TIMER</div><div>RING_BUFFER_WAKEUP_BY_WRITER<br></div><div>(and compare the various wakeup modes)<br></div><div><br></div><div>However, if you use wakeup by writer, this has impacts on the instrumentation<br></div><div>coverage (e.g. you then can trigger issues when instrumenting some core scheduler<br></div><div>code paths, NMIs, etc). So wakeup by timer is really the mode that allows being<br></div><div>called from the entire kernel code base without risking having side-effects due to</div><div>interaction of the wakeup mechanism with the rest of the kernel.<br></div><div><br></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div><br></div><div>1. Which part of LTTng relies on kernel ticks? currently I only find the ring-bugger by "grep NO*HZ -i -r" command.</div></div></blockquote><div>ring_buffer_tick_nohz_callback() was a callback meant to be called by the<br></div><div>in-kernel code that manages no hz. This was implemented when lib ring buffer<br></div><div>was an in-kernel library (a patchset to the Linux kernel) rather than sitting within<br></div><div>lttng-modules.<br></div><div><br></div><div>When it was a in-kernel patchset, we could modify the nohz notifier code from<br></div><div>the Linux kernel to notify the ring buffer that it enters or exits nohz mode. Unfortunately,<br></div><div>there is no such notifier in the kernel today (and Thomas Gleixner refused to add one).<br></div><div><br></div><div>So we need to add this notifier to the Linux kernel if we want to make the "timer-based"<br></div><div>mode of the lib ring buffer work well on nohz kernels (meaning: don't wake up the CPUs</div><div>that entered idle state needlessly).<br></div><div><br></div><div>A possible work-around to try is to change the per-cpu timers within lib ring buffer into</div><div>deferrable timers. This should be attempted too.<br></div><div><br></div><div>Another possible solution would be to implement a global system wide timer rather than<br></div><div>a per-cpu timer. This would lessen the impact of the timers on idle CPUs, at the expense<br></div><div>of scalability. The loss of scalability is the reason why I did not implement this solution.<br></div><div><br></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div>2. How does this part(ring-buffer and maybe others) relies on kernel ticks? can you give some explanations or do you have any document of it/them?</div><div><br></div><div>I will look through the codes, but I think some clear explanations can make me go to the right way and speed up before reading so many codes without any dedicated target.</div></div></blockquote><div><br></div><div>lttng-modules lib ring buffer is the only part of lttng-modules that depends on timers,</div><div>and therefore is the only part that should interact with NO HZ.<br></div><div><br></div><div>Hopefully the above explanations shed some light on the topic.<br></div><div><br></div><div>Please let me know if you have more questions,<br></div><div><br></div><div>Thanks,<br></div><div><br></div><div>Mathieu<br></div><div><br></div><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><div dir="ltr"><div><br></div><div>Thanks.</div></div></blockquote><div><br><br></div><div><br></div><div>-- <br></div><div><span name="x"></span>Mathieu Desnoyers<br>EfficiOS Inc.<br>http://www.efficios.com<span name="x"></span><br></div></div></body></html>