All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gleb Natapov <gleb@redhat.com>
To: Glauber Costa <glommer@redhat.com>
Cc: aliguori@us.ibm.com, kvm@vger.kernel.org, qemu-devel@nongnu.org,
	jan kiszka <jan.kiszka@siemens.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Ulrich Obergfell <uobergfe@redhat.com>,
	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: Wed, 4 May 2011 16:55:34 +0300	[thread overview]
Message-ID: <20110504135534.GA2265@redhat.com> (raw)
In-Reply-To: <1304516860.4737.19.camel@mothafucka.localdomain>

On Wed, May 04, 2011 at 10:47:40AM -0300, Glauber Costa wrote:
> On Wed, 2011-05-04 at 16:46 +0300, Gleb Natapov wrote:
> > On Wed, May 04, 2011 at 10:36:12AM -0300, Glauber Costa wrote:
> > > On Wed, 2011-05-04 at 06:09 -0300, Marcelo Tosatti wrote:
> > > > On Wed, May 04, 2011 at 04:06:59AM -0400, Ulrich Obergfell wrote:
> > > > > 
> > > > > Hi Marcelo,
> > > > >  
> > > > > > Whats prev_period for, since in practice the period will not change
> > > > > > between interrupts (OS programs comparator once, or perhaps twice
> > > > > > during bootup) ?
> > > > > 
> > > > > 'prev_period' is needed if a guest o/s changes the comparator period
> > > > > 'on the fly' (without stopping and restarting the timer).
> > > > > 
> > > > > 
> > > > >              guest o/s changes period
> > > > >                |
> > > > >   ti(n-1)      |        ti(n)                          ti(n+1)
> > > > >     |          v          |                              |
> > > > >     +---------------------+------------------------------+
> > > > > 
> > > > >      <--- prev_period ---> <---------- period ---------->
> > > > > 
> > > > > 
> > > > > The idea is that each timer interrupt represents a certain quantum
> > > > > of time (the comparator period). If a guest o/s changes the period
> > > > > between timer interrupt 'n-1' and timer interrupt 'n', I think the
> > > > > new value should not take effect before timer interrupt 'n'. Timer
> > > > > interrupt 'n' still represents the old/previous quantum, and timer
> > > > > interrupt 'n+1' represents the new quantum.
> > > > > 
> > > > > Hence, the patch decrements 'ticks_not_accounted' by 'prev_period'
> > > > > and sets 'prev_period' to 'period' when an interrupt was delivered
> > > > > to the guest o/s.
> > > > > 
> > > > > +            irq_delivered = update_irq(t, 1);
> > > > > +            if (irq_delivered) {
> > > > > +                t->ticks_not_accounted -= t->prev_period;
> > > > > +                t->prev_period = t->period;
> > > > > +            } else {
> > > > > 
> > > > > Most of the time 'prev_period' is equal to 'period'. It should only
> > > > > be different in the scenario shown above.
> > > > 
> > > > OK, makes sense. You should probably reset ticks_not_accounted to zero
> > > > on HPET initialization (for example, to avoid miscalibration when
> > > > kexec'ing a new kernel).
> > > 
> > > Everybody resetting the machine in anyway is expected to force devices
> > > to be reinitialized, right ?
> > > I may be wrong, but I was under the impression that kexec would do this
> > > as well. In this case, the reset function should be enough.
> > > 
> > kexec does not reset a machine. That's the whole point of kexec in
> > fact.
> Sure thing, but doesn't it force the initialization routine of the devices themselves, without
> going through the bios ?
> 
It just starts new kernel. New kernel's init runs as usual and
re-initialize everything. No it doesn't go through the BIOS. What for?
Actually I happily use kexec on IBM blade server where BIOS run takes no
less then 5 minutes and kexec reboots instantly.

--
			Gleb.

WARNING: multiple messages have this Message-ID (diff)
From: Gleb Natapov <gleb@redhat.com>
To: Glauber Costa <glommer@redhat.com>
Cc: aliguori@us.ibm.com, kvm@vger.kernel.org, qemu-devel@nongnu.org,
	jan kiszka <jan.kiszka@siemens.com>,
	Marcelo Tosatti <mtosatti@redhat.com>,
	Ulrich Obergfell <uobergfe@redhat.com>,
	gcosta@redhat.com, avi@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 5/5] hpet 'driftfix': add code in hpet_timer() to compensate delayed callbacks and coalesced interrupts
Date: Wed, 4 May 2011 16:55:34 +0300	[thread overview]
Message-ID: <20110504135534.GA2265@redhat.com> (raw)
In-Reply-To: <1304516860.4737.19.camel@mothafucka.localdomain>

On Wed, May 04, 2011 at 10:47:40AM -0300, Glauber Costa wrote:
> On Wed, 2011-05-04 at 16:46 +0300, Gleb Natapov wrote:
> > On Wed, May 04, 2011 at 10:36:12AM -0300, Glauber Costa wrote:
> > > On Wed, 2011-05-04 at 06:09 -0300, Marcelo Tosatti wrote:
> > > > On Wed, May 04, 2011 at 04:06:59AM -0400, Ulrich Obergfell wrote:
> > > > > 
> > > > > Hi Marcelo,
> > > > >  
> > > > > > Whats prev_period for, since in practice the period will not change
> > > > > > between interrupts (OS programs comparator once, or perhaps twice
> > > > > > during bootup) ?
> > > > > 
> > > > > 'prev_period' is needed if a guest o/s changes the comparator period
> > > > > 'on the fly' (without stopping and restarting the timer).
> > > > > 
> > > > > 
> > > > >              guest o/s changes period
> > > > >                |
> > > > >   ti(n-1)      |        ti(n)                          ti(n+1)
> > > > >     |          v          |                              |
> > > > >     +---------------------+------------------------------+
> > > > > 
> > > > >      <--- prev_period ---> <---------- period ---------->
> > > > > 
> > > > > 
> > > > > The idea is that each timer interrupt represents a certain quantum
> > > > > of time (the comparator period). If a guest o/s changes the period
> > > > > between timer interrupt 'n-1' and timer interrupt 'n', I think the
> > > > > new value should not take effect before timer interrupt 'n'. Timer
> > > > > interrupt 'n' still represents the old/previous quantum, and timer
> > > > > interrupt 'n+1' represents the new quantum.
> > > > > 
> > > > > Hence, the patch decrements 'ticks_not_accounted' by 'prev_period'
> > > > > and sets 'prev_period' to 'period' when an interrupt was delivered
> > > > > to the guest o/s.
> > > > > 
> > > > > +            irq_delivered = update_irq(t, 1);
> > > > > +            if (irq_delivered) {
> > > > > +                t->ticks_not_accounted -= t->prev_period;
> > > > > +                t->prev_period = t->period;
> > > > > +            } else {
> > > > > 
> > > > > Most of the time 'prev_period' is equal to 'period'. It should only
> > > > > be different in the scenario shown above.
> > > > 
> > > > OK, makes sense. You should probably reset ticks_not_accounted to zero
> > > > on HPET initialization (for example, to avoid miscalibration when
> > > > kexec'ing a new kernel).
> > > 
> > > Everybody resetting the machine in anyway is expected to force devices
> > > to be reinitialized, right ?
> > > I may be wrong, but I was under the impression that kexec would do this
> > > as well. In this case, the reset function should be enough.
> > > 
> > kexec does not reset a machine. That's the whole point of kexec in
> > fact.
> Sure thing, but doesn't it force the initialization routine of the devices themselves, without
> going through the bios ?
> 
It just starts new kernel. New kernel's init runs as usual and
re-initialize everything. No it doesn't go through the BIOS. What for?
Actually I happily use kexec on IBM blade server where BIOS run takes no
less then 5 minutes and kexec reboots instantly.

--
			Gleb.

  reply	other threads:[~2011-05-04 13:55 UTC|newest]

Thread overview: 44+ 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 ` [Qemu-devel] " 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 14:24   ` [Qemu-devel] " Ulrich Obergfell
2011-04-28 18:51   ` Blue Swirl
2011-04-28 18:51     ` Blue Swirl
2011-04-28 22:50     ` Jan Kiszka
2011-04-28 22:50       ` Jan Kiszka
2011-04-29  9:45       ` Ulrich Obergfell
2011-04-29  9:45         ` Ulrich Obergfell
2011-04-29 10:15         ` Jan Kiszka
2011-04-29 10:15           ` [Qemu-devel] " Jan Kiszka
2011-04-29 21:44         ` Blue Swirl
2011-04-29 21:44           ` 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   ` [Qemu-devel] " 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   ` [Qemu-devel] " 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:24   ` [Qemu-devel] " 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-04-28 14:25   ` [Qemu-devel] " Ulrich Obergfell
2011-05-03 19:03   ` Marcelo Tosatti
2011-05-03 19:03     ` [Qemu-devel] " Marcelo Tosatti
2011-05-03 22:08     ` Glauber Costa
2011-05-03 22:08       ` [Qemu-devel] " Glauber Costa
2011-05-03 22:55       ` Marcelo Tosatti
2011-05-03 22:55         ` [Qemu-devel] " Marcelo Tosatti
2011-05-04  8:06     ` Ulrich Obergfell
2011-05-04  8:06       ` [Qemu-devel] " Ulrich Obergfell
2011-05-04  9:09       ` Marcelo Tosatti
2011-05-04  9:09         ` [Qemu-devel] " Marcelo Tosatti
2011-05-04 13:36         ` Glauber Costa
2011-05-04 13:36           ` [Qemu-devel] " Glauber Costa
2011-05-04 13:46           ` Gleb Natapov
2011-05-04 13:46             ` [Qemu-devel] " Gleb Natapov
2011-05-04 13:47             ` Glauber Costa
2011-05-04 13:47               ` [Qemu-devel] " Glauber Costa
2011-05-04 13:55               ` Gleb Natapov [this message]
2011-05-04 13:55                 ` Gleb Natapov
2011-05-05  8:07     ` Ulrich Obergfell
2011-05-05  8:07       ` [Qemu-devel] " Ulrich Obergfell
2011-05-06 14:39       ` Marcelo Tosatti
2011-05-06 14:39         ` [Qemu-devel] " 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=20110504135534.GA2265@redhat.com \
    --to=gleb@redhat.com \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=gcosta@redhat.com \
    --cc=glommer@redhat.com \
    --cc=jan.kiszka@siemens.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=uobergfe@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.