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: Tue, 27 Sep 2011 00:44:40 +0000	[thread overview]
Message-ID: <4E811C78.7090706@freescale.com> (raw)
In-Reply-To: <20110826233145.GE30607@schlenkerla.am.freescale.net>

On 09/24/2011 02:27 AM, Alexander Graf wrote:
> I think I'm getting your point. So what we want is:
> 
> in timer handler:
> 
>   set_bit(TSR_DIS, vcpu->arch.tsr);
>   kvm_make_request(KVM_REQ_PPC_TSR_UPDATE, vcpu);
>   kvm_vcpu_kick(vcpu);
> 
> in vcpu entry code:
> 
>   if (vcpu->requests)
>      if (kvm_check_request(KVM_REQ_PPC_TSR_UPDATE, vcpu))
>        kvmppc_update_tsr(vcpu);
> 
>   void kvmppc_update_tsr(struct kvm_vcpu *vcpu)
>   {
>     if (vcpu->arch.tsr & TSR_DIS &&
>         vcpu->arch.tcr & TCR_DIE) {
>       kvmppc_core_queue_dec(vcpu);
>     }
>     // XXX also implement dequeue!
>   }

OK, this avoids the possibility for the guest to clear DIS/DIE after
enqueue but before delivery (which in the current patch is dealt with by
an extra check at delivery), and we only have to check one thing in the
common nothing-requested case (even if more things use this mechanism,
as long as we don't run out of bits).

If we convert external IRQs to using this as well, and expand the timer
case to include non-booke (maybe just use KVM_REQ_PENDING_TIMER?), we
should be able to de-atomicize pending_exceptions (which should be a
bigger win than de-atomicizing arch.tsr).

>   case SPR_TSR:
>     vcpu->arch.tsr &= ~TSR_DIS;
>     kvmppc_update_tsr(vcpu);

Well, we should probably replace TSR_DIS here with the actual value that
the guest wrote. :-)

-Scott


  parent reply	other threads:[~2011-09-27  0:44 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
2011-09-24  7:27 ` Alexander Graf
2011-09-27  0:44 ` Scott Wood [this message]
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=4E811C78.7090706@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.