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: Gleb Natapov <gleb@redhat.com>, kvm <kvm@vger.kernel.org>
Subject: Re: KVM: VMX: optimize APIC EOI
Date: Tue, 15 Jun 2010 07:33:11 +0300	[thread overview]
Message-ID: <4C170287.4040002@redhat.com> (raw)
In-Reply-To: <20100614223004.GA9594@amt.cnet>

On 06/15/2010 01:30 AM, Marcelo Tosatti wrote:
> Use information provided in exit_qualification to shortcut EOI path.
>
> Reduces EOI latency from 4k to 2k cycles on Nehalem.
>
>    

This already came up once - IIRC from Eddie Dong.
>
>   static int handle_apic_access(struct kvm_vcpu *vcpu)
>   {
> +	unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
> +	int access_type, offset;
> +
> +	access_type = (exit_qualification>>  12)&  0xf;
> +	offset = exit_qualification&  0xfff;
> +	if (access_type == 1&&  offset == APIC_EOI) {
> +		kvm_lapic_set_eoi(vcpu);
> +		skip_emulated_instruction(vcpu);
> +		return 1;
> +	}
> +
>   	return emulate_instruction(vcpu, 0, 0, 0) == EMULATE_DONE;
>   }
>
>    

This fails if the instruction is STOS, MOVS, or a RMW instruction as it 
doesn't update registers and flags.

We could try to do tricks to detect this, but we already have x2apic for 
Linux and the corresponding Hyper-V extension, which improve a lot of 
other stuff, at least for newer guests.

\

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


      reply	other threads:[~2010-06-15  4:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-14 22:30 KVM: VMX: optimize APIC EOI Marcelo Tosatti
2010-06-15  4:33 ` Avi Kivity [this message]

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=4C170287.4040002@redhat.com \
    --to=avi@redhat.com \
    --cc=gleb@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