mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Kevin Hao <haokexin@gmail.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>, mingo@redhat.com
Subject: Re: [x86] apic timer tick interval is not so accurate in periodic mode
Date: Wed, 27 Aug 2008 11:24:19 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.1.10.0808271103180.3243@apollo.tec.linutronix.de> (raw)
In-Reply-To: <8dd980de0808200236g1c77f4e6n1e97339fb3c27e6@mail.gmail.com>

On Wed, 20 Aug 2008, Kevin Hao wrote:
> Hi all,
> 
> I found the apic timer tick interval is not so accurate when it works
> in periodic mode(CONFIG_HIGH_RES_TIMERS=N).
> But in one-shot mode(CONFIG_HIGH_RES_TIMERS=Y)  it works well.
> I tested it on a Dell390 pc. HZ is 250. Kernel version is 2.6.27-rc3.
> The following is the result:
> 
> In periodic mode:
> tick = 1, apic tick timer interval is 4020211
> tick = 1, apic tick timer interval is 4020233
> tick = 1, apic tick timer interval is 4020233
> tick = 1, apic tick timer interval is 4020199
> tick = 1, apic tick timer interval is 4020267
> tick = 1, apic tick timer interval is 4020218
> tick = 1, apic tick timer interval is 4020278
> tick = 1, apic tick timer interval is 4020173
> 
> 
> In one-shot mode:
> tick = 1, apic tick timer interval is 3999930
> tick = 1, apic tick timer interval is 4000035
> tick = 1, apic tick timer interval is 3999998
> tick = 1, apic tick timer interval is 4000005
> tick = 1, apic tick timer interval is 4000001
> tick = 1, apic tick timer interval is 4000009
> tick = 1, apic tick timer interval is 3999945
> tick = 1, apic tick timer interval is 4000024
> tick = 1, apic tick timer interval is 4000005
> 
> Why is there so big difference between these two mode?
> The attachment is my test program and config file.
> Any comments is appreciated .

The periodic mode uses a reload value which is calculated during
system startup and never touched again. At this point we do not have
the full timekeeping infrastructure working and your test code uses
the working infrastructure as reference.

In high resolution timer mode we reprogramm the local apic timer for
the next hrtimer instance which is enqueued. We calculate the delta
against the system time and then convert it to the local apic counter
value. 

But yes, it's surprising that the obvious calibration deviation of the
local apic timer, which results in longer times is not showing up in
one shot mode. It would be interesting to see the absolute time line
in terms of ktime_get() of those events versus the expiry value of the
hrtimer which drives the tick emulation in tick_sched_timer().

Thanks,

	tglx

      reply	other threads:[~2008-08-27  9:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-20  9:36 Kevin Hao
2008-08-27  9:24 ` Thomas Gleixner [this message]

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=alpine.LFD.1.10.0808271103180.3243@apollo.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=haokexin@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.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

all inboxes | Powered by JetHome®