All of lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: kvm-ppc@vger.kernel.org
Subject: Re: [PATCH 5/5] KVM: PPC: booke: Improve timer register emulation
Date: Thu, 15 Sep 2011 20:52:15 +0000	[thread overview]
Message-ID: <4E72657F.6080800@freescale.com> (raw)
In-Reply-To: <20110826233145.GE30607@schlenkerla.am.freescale.net>

On 09/08/2011 10:39 AM, Alexander Graf wrote:
> 
> On 08.09.2011, at 17:34, Scott Wood wrote:
> 
>> On Wed, Sep 07, 2011 at 12:41:35PM +0200, Alexander Graf wrote:
>>> Yes, but why can't we do this in the vcpu thread's context so we only
>>> ever have a single instance accessing the vcpu struct?  It makes a lot
>>> of things a lot easier.
>>
>> Why?  We don't do it for external interrupts.  It would complicate
>> locking, not simplify it -- we'd need to defer the execution to some
>> context which can block, and then kick the guest out of guest mode, and
>> make sure it doesn't reenter before we get the mutex...
> 
> We need to kick the vcpu thread out of context anyways because we're
> otherwise delaying delivery of the decr interrupt. So we can just as
> well handle it all there then. Being lazy is good, but please not at
> the cost of latency.

That means we need a way to tell the thread to do this.  Instead of
using set_bit(), you want dedicated variables for pending_decr,
pending_fit, pending_watchdog?  And then we check them on every exit?

Besides avoiding the overhead of an atomic operation (premature
optimization), what does this buy us?  The ability to move the
dequeue-after-mask from kvmppc_booke_irqprio_deliver() to
kvmppc_set_tcr() (only to be replaced by the check for pending_foo)?

How is using set_bits() for TSR any different from the set_bit() we use
in kvmppc_booke_queue_irqprio()?

>>> And for the watchdog, we don't have to set the bit unless it's clean,
>>> right?
>>
>> Not sure what you mean by "clean".  We always set the bit when the timer
>> expires.
>>
>> Likewise for the decrementer.
> 
> What I mean is that we don't want to have a timer periodically triggering in the background for watchdog when the guest never clears the watchdog delivered bit.

I suppose we could stop the timer if the watchdog has hit final
expiration with no action configured, and restart it if the bits get
cleared.  It's not really a case that warrants optimization (in the
default case where the guest doesn't use the watchdog, the period will
be so high that the timer will never expire), but we do want to avoid a
situation where the guest sets a period that is too short and ends up
timer-storming the host.

-Scott


  parent reply	other threads:[~2011-09-15 20:52 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-26 23:31 [PATCH 5/5] KVM: PPC: booke: Improve timer register emulation Scott Wood
2011-09-05 22:45 ` Alexander Graf
2011-09-06  3:17 ` Liu Yu-B13201
2011-09-06  8:04 ` Alexander Graf
2011-09-06 19:05 ` Alexander Graf
2011-09-07 10:16 ` Liu Yu-B13201
2011-09-07 10:41 ` Alexander Graf
2011-09-08  2:20 ` Liu Yu-B13201
2011-09-08  9:21 ` Liu Yu-B13201
2011-09-08 15:34 ` Scott Wood
2011-09-08 15:39 ` Alexander Graf
2011-09-15 20:52 ` Scott Wood [this message]
2011-09-19  9:32 ` Alexander Graf
2011-09-19 19:12 ` Scott Wood
2011-09-24  7:27 ` Alexander Graf
2011-09-27  0:44 ` Scott Wood
2011-09-27  8:14 ` Alexander Graf
2011-09-27 16:01 ` Bhushan Bharat-R65777
2011-09-27 16:09 ` Alexander Graf
2011-09-27 16:21 ` Bhushan Bharat-R65777
2011-09-27 16:32 ` Alexander Graf
2011-09-27 16:45 ` Scott Wood

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=4E72657F.6080800@freescale.com \
    --to=scottwood@freescale.com \
    --cc=kvm-ppc@vger.kernel.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 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.