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: Mon, 19 Sep 2011 19:12:03 +0000	[thread overview]
Message-ID: <4E779403.4000105@freescale.com> (raw)
In-Reply-To: <20110826233145.GE30607@schlenkerla.am.freescale.net>

On 09/19/2011 04:32 AM, Alexander Graf wrote:
> 
> On 15.09.2011, at 22:52, Scott Wood wrote:
> 
>> 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?
> 
> Well, whatever we do we have to kvm_vcpu_kick() the receiving vcpu
> out of context.

Yes, the point is how the information about the event is communicated.

> So we can just as well tell it to inject its own interrupt
> and don't have to deal with atomic operations in most cases then, no?

Either we use atomics, or we split each event into its own variable.  We
already use atomics for injecting other interrupts.

It seems simpler to just use the architected format rather than invent
something new.  And if we do something non-architected, that makes it
more likely that injection of the interrupt triggered by qemu setting
the bit with sregs is broken (untested special case).

>> 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()?
> 
> It keeps guest visible registers vcpu private. I want the vcpu thread to own all vcpu registers - and TSR is a vcpu register.

It is private to the vcpu implementation.  I don't get why it should be
private to the thread just because it's an architected register -- would
it be any different if we called it "not_tsr" (or "pending_timers")
whose field "not_dis" (or a bit called BOOKE_TIMER_DECR) happened to be
at the right location, and we happen to be able to very easily turn it
into tsr when the guest wants to read it? :-)

-Scott


  parent reply	other threads:[~2011-09-19 19:12 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
2011-09-19  9:32 ` Alexander Graf
2011-09-19 19:12 ` Scott Wood [this message]
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=4E779403.4000105@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.