public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Marcelo Tosatti <mtosatti@redhat.com>
Cc: kvm@vger.kernel.org
Subject: Re: [PATCH 2/3] KVM: VMX: Short circuit STI; HLT while an interrupt is pending
Date: Thu, 17 Feb 2011 11:12:43 +0200	[thread overview]
Message-ID: <4D5CE68B.6000709@redhat.com> (raw)
In-Reply-To: <20110216165101.GA15973@amt.cnet>

On 02/16/2011 06:51 PM, Marcelo Tosatti wrote:
> On Wed, Feb 16, 2011 at 11:01:47AM +0200, Avi Kivity wrote:
> >  On 02/15/2011 10:36 PM, Marcelo Tosatti wrote:
> >  >On Mon, Feb 14, 2011 at 04:42:16PM +0200, Avi Kivity wrote:
> >  >>   Short-circuit an STI; HLT sequence while an interrupt is pending:
> >  >>   instead of halting, re-entering the guest, and exiting immediately
> >  >>   on an interrupt window exit, go directly to the last step.
> >  >>
> >  >>   Saves a vmexit on workloads where interrupts are received synchronously;
> >  >>   an example is a disk backed by the host page cache where there is no
> >  >>   latency (from the guest's point of view) between the request and fulfilment.
> >  >>
> >  >>   Signed-off-by: Avi Kivity<avi@redhat.com>
> >  >>   ---
> >  >>    arch/x86/kvm/vmx.c |    9 +++++++++
> >  >>    1 files changed, 9 insertions(+), 0 deletions(-)
> >  >>
> >  >>   diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> >  >>   index ee1cd1a..541da0e 100644
> >  >>   --- a/arch/x86/kvm/vmx.c
> >  >>   +++ b/arch/x86/kvm/vmx.c
> >  >>   @@ -3437,6 +3437,15 @@ static int handle_interrupt_window(struct kvm_vcpu *vcpu)
> >  >>    static int handle_halt(struct kvm_vcpu *vcpu)
> >  >>    {
> >  >>    	skip_emulated_instruction(vcpu);
> >  >>   +	/*
> >  >>   +	 * Short-circuit an STI; HLT sequence while an interrupt is pending:
> >  >>   +	 * instead of halting, re-entering the guest, and exiting immediately
> >  >>   +	 * on an interrupt window exit, go directly to the last step.
> >  >>   +	 */
> >  >>   +	if ((to_vmx(vcpu)->cpu_based_vm_exec_control
> >  >>   +	&   CPU_BASED_VIRTUAL_INTR_PENDING)
> >  >>   +	&&   (kvm_get_rflags(vcpu)&   X86_EFLAGS_IF))
> >  >>   +		return handle_interrupt_window(vcpu);
> >  >>    	return kvm_emulate_halt(vcpu);
> >  >>    }
> >  >
> >  >Why does the normal vcpu entry path fails to inject the interrupt? Because after halt,
> >  >KVM_REQ_EVENT is not set?
> >
> >  Yes.  Also, we want to clear CPU_BASED_VIRTUAL_INTR_PENDING.
>
> Is there a reason why it cannot be handled in the main loop?

Don't follow.  What are you suggesting?

-- 
error compiling committee.c: too many arguments to function


  reply	other threads:[~2011-02-17  9:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-14 14:42 [PATCH 0/3] Optimize STI; HLT while an interrupt is pending Avi Kivity
2011-02-14 14:42 ` [PATCH 1/3] KVM: VMX: Cache CPU_BASED_VM_EXEC_CONTROL VMCS field Avi Kivity
2011-02-14 14:42 ` [PATCH 2/3] KVM: VMX: Short circuit STI; HLT while an interrupt is pending Avi Kivity
2011-02-15 20:36   ` Marcelo Tosatti
2011-02-16  9:01     ` Avi Kivity
2011-02-16 16:51       ` Marcelo Tosatti
2011-02-17  9:12         ` Avi Kivity [this message]
2011-02-17 16:16           ` Marcelo Tosatti
2011-02-20  9:04             ` Avi Kivity
2011-02-14 14:42 ` [PATCH 3/3] KVM: SVM: " Avi Kivity

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=4D5CE68B.6000709@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox