Thanks for your reply. Kernel runs on real machine. <div><br><div>Let me introduce my platform first.<div>There are two Intel xeon E5405 in my machine. Each one contains four cores. So, I have eight cores in total.</div><div>
I used LITMUS way to align tick across cores. Then, I add a dummy scheduler module on the top of RT scheduler module like LITMUS. Actually, it is really similar to RT, only allocating X ticks for a process/thread. In my small test case, I utilize the first six core and create six threads, therefore each thread scheduled by dummy scheduler occupies one cpu for x ticks interval (Assume x is large, 10e7)</div>
<div><br></div><div>The purpose of my test case is to test arrival difference of local APIC interrupts across cores under different HZ settings, such as (100, 200, 400, 800, 1000). My arrival difference threshold (ADThres) is set to 300us. And the arrival difference is measure in this way under 1000 HZ:</div>
<div>/kernel/sched.c</div><div><br></div><div><pre class="done" id="0e/e6/9161cd682efd2f04edb9261e36f7f5291a32_3/3000" style="margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;background-color:rgb(255,255,255)">
void <a href="http://lxr.linux.no/linux+v2.6.34/+code=scheduler_tick" class="sref">scheduler_tick</a>(void){</pre><pre class="done" id="0e/e6/9161cd682efd2f04edb9261e36f7f5291a32_3/3000" style="margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;background-color:rgb(255,255,255)">
...</pre><pre class="done" id="0e/e6/9161cd682efd2f04edb9261e36f7f5291a32_3/3000" style="margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;background-color:rgb(255,255,255)"> rq->curr_tick_stamp = <a href="http://lxr.linux.no/linux+v2.6.34/+code=sched_clock" class="sref">sched_clock</a>();</pre>
<pre class="done" id="0e/e6/9161cd682efd2f04edb9261e36f7f5291a32_3/3000" style="margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;background-color:rgb(255,255,255)"> if( rq->curr_tick_stamp > rq->prev_tick_stamp + 1000000(depends on HZ setting) + ADThres ){</pre>
<pre class="done" id="0e/e6/9161cd682efd2f04edb9261e36f7f5291a32_3/3000" style="margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;background-color:rgb(255,255,255)"> error report</pre><pre class="done" id="0e/e6/9161cd682efd2f04edb9261e36f7f5291a32_3/3000" style="margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;background-color:rgb(255,255,255)">
}</pre><pre class="done" id="0e/e6/9161cd682efd2f04edb9261e36f7f5291a32_3/3000" style="margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;background-color:rgb(255,255,255)"> rq->prev_tick_stamp = rq->curr_tick_stamp;</pre>
<pre class="done" id="0e/e6/9161cd682efd2f04edb9261e36f7f5291a32_3/3000" style="margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;background-color:rgb(255,255,255)"><br></pre><pre class="done" id="0e/e6/9161cd682efd2f04edb9261e36f7f5291a32_3/3000" style="margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;background-color:rgb(255,255,255)">
...</pre><pre class="done" id="0e/e6/9161cd682efd2f04edb9261e36f7f5291a32_3/3000" style="margin-top:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;background-color:rgb(255,255,255)">}</pre></div><div><br></div>
<div>Under 1000HZ setting, it is easy to report error. At error tick, the arrival difference is rough 500 us, which means local APIC tick interrupts arrive in the middle of next supposed tick. I am wondering this phenomenon have a big influence on tick based scheduler. However, it rarely reports error under 100 or 200 HZ setting. </div>
<div><br></div><div>Then, I focused on <span style="background-color:rgb(255,255,255);font-family:Tahoma,Arial,Helvetica,sans-serif;font-size:13px">accuracy of local APIC. According to [1], it gives an example in period mode of LAPIC</span></div>
<div><span style="background-color:rgb(255,255,255);font-family:Tahoma,Arial,Helvetica,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:sans-serif;font-size:13px;line-height:19.200000762939453px;background-color:rgb(255,255,255)"><font color="#3366ff">For example, for a 2.4 GHz CPU with an external/bus frequency of 800 MHz, if the Divide Configuration Register is set to "divide by 4" and the initial count is set to 123456; then the local APIC timer would decrement the count at a rate of 200 MHz and generate a timer IRQ every 617.28 us, giving a rate of IRQs of 1620.01 Hz.</font></span></div>
<div><br></div><div>My machine's FSB is 1333 MHZ and it has the capability of providing nanoseconds accuracy.</div><div><br></div><div>[1]. APIC timer, <a href="http://wiki.osdev.org/APIC_timer">http://wiki.osdev.org/APIC_timer</a></div>
<div><br></div><div><br></div><div><br><br><div class="gmail_quote">On Thu, Jan 17, 2013 at 2:14 AM, Björn Brandenburg <span dir="ltr"><<a href="mailto:bbb@mpi-sws.org" target="_blank">bbb@mpi-sws.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On Jan 17, 2013, at 3:42 AM, Hang Su <<a href="mailto:hangsu.cs@gmail.com">hangsu.cs@gmail.com</a>> wrote:<br>
<br>
> Hello everyone:<br>
><br>
> Is there anybody has experienced local APIC timer tick lost under HZ = 1000 and x86?<br>
<br>
</div>On real hardware, no. I suspect this might be possible in QEMU/kvm with lot's of debugging options enabled. Under which scheduler plugin is this happening, and how many cores do you have?<br>
<br>
- Björn<br>
<br>
<br>
<br>
_______________________________________________<br>
litmus-dev mailing list<br>
<a href="mailto:litmus-dev@lists.litmus-rt.org">litmus-dev@lists.litmus-rt.org</a><br>
<a href="https://lists.litmus-rt.org/listinfo/litmus-dev" target="_blank">https://lists.litmus-rt.org/listinfo/litmus-dev</a><br>
</blockquote></div><br></div></div></div>