mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations
Date: Tue, 01 Sep 2015 12:49:19 +0800	[thread overview]
Message-ID: <55E52E4F.2010404@redhat.com> (raw)
In-Reply-To: <20150901073305-mutt-send-email-mst@redhat.com>



On 09/01/2015 12:36 PM, Michael S. Tsirkin wrote:
> On Tue, Sep 01, 2015 at 11:37:13AM +0800, Jason Wang wrote:
>> > 
>> > 
>> > On 08/30/2015 05:12 PM, Michael S. Tsirkin wrote:
>>> > > Even when we skip data decoding, MMIO is slightly slower
>>> > > than port IO because it uses the page-tables, so the CPU
>>> > > must do a pagewalk on each access.
>>> > >
>>> > > This overhead is normally masked by using the TLB cache:
>>> > > but not so for KVM MMIO, where PTEs are marked as reserved
>>> > > and so are never cached.
>>> > >
>>> > > As ioeventfd memory is never read, make it possible to use
>>> > > RO pages on the host for ioeventfds, instead.
>>> > > The result is that TLBs are cached, which finally makes MMIO
>>> > > as fast as port IO.
>>> > >
>>> > > Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
>>> > > ---
>>> > >  arch/x86/kvm/vmx.c | 5 +++++
>>> > >  1 file changed, 5 insertions(+)
>>> > >
>>> > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
>>> > > index 9d1bfd3..ed44026 100644
>>> > > --- a/arch/x86/kvm/vmx.c
>>> > > +++ b/arch/x86/kvm/vmx.c
>>> > > @@ -5745,6 +5745,11 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
>>> > >  		vmcs_set_bits(GUEST_INTERRUPTIBILITY_INFO, GUEST_INTR_STATE_NMI);
>>> > >  
>>> > >  	gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS);
>>> > > +	if (!kvm_io_bus_write(vcpu, KVM_FAST_MMIO_BUS, gpa, 0, NULL)) {
>>> > > +		skip_emulated_instruction(vcpu);
>>> > > +		return 1;
>>> > > +	}
>>> > > +
>>> > >  	trace_kvm_page_fault(gpa, exit_qualification);
>>> > >  
>>> > >  	/* It is a write fault? */
>> > 
>> > Just notice that vcpu_mmio_write() tries lapic first. Should we do the
>> > same here? Otherwise we may slow down apic access consider we may have
>> > hundreds of eventfds.
> IIUC this does not affect mmio at all: for mmio we set
> reserved page flag, so they trigger an EPT misconfiguration,
> not an EPT violation.

I see, so the question could be asked for current misconfiguration
handler instead?

  reply	other threads:[~2015-09-01  4:49 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-30  9:12 [PATCH RFC 0/3] kvm add ioeventfd pf capability Michael S. Tsirkin
2015-08-30  9:12 ` [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations Michael S. Tsirkin
2015-08-31  2:53   ` Xiao Guangrong
2015-08-31  7:46     ` Michael S. Tsirkin
2015-08-31  8:32       ` Xiao Guangrong
2015-08-31 11:27         ` Michael S. Tsirkin
2015-08-31 13:23           ` Xiao Guangrong
2015-08-31 14:57             ` Michael S. Tsirkin
2015-09-01  3:37   ` Jason Wang
2015-09-01  4:36     ` Michael S. Tsirkin
2015-09-01  4:49       ` Jason Wang [this message]
2015-09-01  6:55         ` Michael S. Tsirkin
2015-08-30  9:12 ` [PATCH RFC 2/3] svm: allow ioeventfd for NPT page faults Michael S. Tsirkin
2015-08-30  9:12 ` [PATCH RFC 3/3] kvm: add KVM_CAP_IOEVENTFD_PF capability Michael S. Tsirkin

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=55E52E4F.2010404@redhat.com \
    --to=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=pbonzini@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

Powered by JetHome