kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulrich Obergfell <uobergfe@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: aliguori@us.ibm.com, kvm@vger.kernel.org,
	jan kiszka <jan.kiszka@siemens.com>,
	qemu-devel@nongnu.org, gcosta@redhat.com, avi@redhat.com
Subject: Re: [PATCH v3 5/5] hpet 'driftfix': add code in hpet_timer() to compensate delayed callbacks and coalesced interrupts
Date: Thu, 5 May 2011 04:07:19 -0400 (EDT)	[thread overview]
Message-ID: <388629436.349154.1304582839092.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com> (raw)
In-Reply-To: <20110503190357.GA10617@amt.cnet>


Hi Marcelo,
 
> Other than that, shouldnt reset accounting variables to init state on
> write to GLOBAL_ENABLE_CFG / writes to main counter?

I'd suggest to initialize/reset the driftfix-related fields in the
'HPETTimer' structure (including the backlog of unaccounted ticks)
in the following situations.


- When the guest o/s sets the 'CFG_ENABLE' bit (overall enable) in
  the General Configuration Register.

  This is the place in hpet_ram_writel():

        case HPET_CFG:
            ...
            if (activating_bit(old_val, new_val, HPET_CFG_ENABLE)) {
                ...
                for (i = 0; i < s->num_timers; i++) {
                    if ((&s->timer[i])->cmp != ~0ULL) {
                        // initialize / reset fields here
                        hpet_set_timer(&s->timer[i]);


- When the guest o/s sets the 'TN_ENABLE' bit (timer N interrupt
  enable) in the Timer N Configuration and Capabilities Register.

  This is the place in hpet_ram_writel():

        case HPET_TN_CFG:
            ...
            if (activating_bit(old_val, new_val, HPET_TN_ENABLE)) {
                // initialize / reset fields here
                hpet_set_timer(timer);


This should cover cases such as ...

- first time initialization of HPET & timers during guest o/s boot.
  (includes kexec and reboot)

- if a guest o/s stops and restarts the timer.
  (for example, to change the comparator register value or
   to switch a timer between periodic mode and non-periodic mode)


Regards,

Uli

  parent reply	other threads:[~2011-05-05  8:07 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-28 14:24 [PATCH v3 0/5] hpet 'driftfix': alleviate time drift with HPET periodic timers Ulrich Obergfell
2011-04-28 14:24 ` [PATCH v3 1/5] hpet 'driftfix': add hooks required to detect coalesced interrupts (x86 apic only) Ulrich Obergfell
2011-04-28 18:51   ` [Qemu-devel] " Blue Swirl
2011-04-28 22:50     ` Jan Kiszka
2011-04-29  9:45       ` Ulrich Obergfell
2011-04-29 10:15         ` Jan Kiszka
2011-04-29 21:44         ` [Qemu-devel] " Blue Swirl
2011-04-28 14:24 ` [PATCH v3 2/5] hpet 'driftfix': add driftfix property to HPETState and DeviceInfo Ulrich Obergfell
2011-04-28 14:24 ` [PATCH v3 3/5] hpet 'driftfix': add fields to HPETTimer and VMStateDescription Ulrich Obergfell
2011-04-28 14:24 ` [PATCH v3 4/5] hpet 'driftfix': add code in update_irq() to detect coalesced interrupts (x86 apic only) Ulrich Obergfell
2011-04-28 14:25 ` [PATCH v3 5/5] hpet 'driftfix': add code in hpet_timer() to compensate delayed callbacks and coalesced interrupts Ulrich Obergfell
2011-05-03 19:03   ` Marcelo Tosatti
2011-05-03 22:08     ` Glauber Costa
2011-05-03 22:55       ` Marcelo Tosatti
2011-05-04  8:06     ` Ulrich Obergfell
2011-05-04  9:09       ` Marcelo Tosatti
2011-05-04 13:36         ` Glauber Costa
2011-05-04 13:46           ` Gleb Natapov
2011-05-04 13:47             ` Glauber Costa
2011-05-04 13:55               ` Gleb Natapov
2011-05-05  8:07     ` Ulrich Obergfell [this message]
2011-05-06 14:39       ` Marcelo Tosatti

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=388629436.349154.1304582839092.JavaMail.root@zmail07.collab.prod.int.phx2.redhat.com \
    --to=uobergfe@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=gcosta@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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;
as well as URLs for NNTP newsgroup(s).