<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On 21 March 2014 04:21, Mathieu Desnoyers <span dir="ltr"><<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><hr><blockquote style="padding-left:5px;font-size:12pt;font-style:normal;margin-left:5px;font-family:Helvetica,Arial,sans-serif;text-decoration:none;font-weight:normal;border-left:2px solid #1010ff">
<b>From: </b>"Hongbo Zhang" <<a href="mailto:hongbo.zhang@linaro.org" target="_blank">hongbo.zhang@linaro.org</a>><br><b>To: </b>"mathieu desnoyers" <<a href="mailto:mathieu.desnoyers@efficios.com" target="_blank">mathieu.desnoyers@efficios.com</a>>, <a href="mailto:lttng-dev@lists.lttng.org" target="_blank">lttng-dev@lists.lttng.org</a><br>
<b>Sent: </b>Tuesday, March 18, 2014 4:07:19 AM<br><b>Subject: </b>Regarding LTTng Support for ARM NO-HZ<div class=""><br><div><br></div><div dir="ltr">Hi Mathieu Desnoyers and all LTTng developers,</div></div></blockquote>
<div><br></div><div>Hi,<br></div><div class=""><div><br></div><blockquote style="padding-left:5px;font-size:12pt;font-style:normal;margin-left:5px;font-family:Helvetica,Arial,sans-serif;text-decoration:none;font-weight:normal;border-left:2px solid #1010ff">
<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">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><div>This is an old LTTng 0.x link, and does not apply to LTTng 2.x.<br></div><div class=""><div><br></div><blockquote style="padding-left:5px;font-size:12pt;font-style:normal;margin-left:5px;font-family:Helvetica,Arial,sans-serif;text-decoration:none;font-weight:normal;border-left:2px solid #1010ff">
<div dir="ltr"><div>I think the the LTTng doesn't support ARM NO-HZ, right?</div></div></blockquote><div><br></div></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 class=""><div><br></div><blockquote style="padding-left:5px;font-size:12pt;font-style:normal;margin-left:5px;font-family:Helvetica,Arial,sans-serif;text-decoration:none;font-weight:normal;border-left:2px solid #1010ff">
<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><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 class=""><div><br></div><blockquote style="padding-left:5px;font-size:12pt;font-style:normal;margin-left:5px;font-family:Helvetica,Arial,sans-serif;text-decoration:none;font-weight:normal;border-left:2px solid #1010ff">
<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><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 class=""><div><br></div><blockquote style="padding-left:5px;font-size:12pt;font-style:normal;margin-left:5px;font-family:Helvetica,Arial,sans-serif;text-decoration:none;font-weight:normal;border-left:2px solid #1010ff">
<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><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></div></blockquote><div><br></div><div>
Thank you Mathieu very much, I will look into the codes and raise questions about further details/solutions if(likely) I have.</div><div><br></div><div>But quick questions for now:</div><div>I see there was an attempt to unify ring buffer for lttng, ftrace and perf, but nowadays they are still using their own ring buffer respectively, am I right? no further effort to unify it any more?</div>
<div><br></div><div>And by the way, do you have any idea about ftrace and perf, do they relies on kernel ticks?</div><div>Thanks.</div><div><br></div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div></div><div>Thanks,<br></div><div><br></div><div>Mathieu<br></div><div><br></div><blockquote style="padding-left:5px;font-size:12pt;font-style:normal;margin-left:5px;font-family:Helvetica,Arial,sans-serif;text-decoration:none;font-weight:normal;border-left:2px solid #1010ff">
<div dir="ltr"><div><br></div><div>Thanks.</div></div></blockquote><span class="HOEnZb"><font color="#888888"><div><br><br></div><div><br></div><div>-- <br></div><div><span name="x"></span>Mathieu Desnoyers<br>EfficiOS Inc.<br>
<a href="http://www.efficios.com" target="_blank">http://www.efficios.com</a><span name="x"></span><br></div></font></span></div></div></blockquote></div><br></div></div>