Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1216631

Re: [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations

From "Michael S. Tsirkin" <mst@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations
Date 2015-09-01 09:00 +0200
Message-ID <q3NHY-7p5-3@gated-at.bofh.it> (permalink)
References <q36Wl-4GE-1@gated-at.bofh.it> <q36Wm-4GE-5@gated-at.bofh.it> <q3KAq-2Z8-5@gated-at.bofh.it> <q3Lwt-4lF-7@gated-at.bofh.it> <q3LGa-4x7-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Sep 01, 2015 at 12:49:19PM +0800, Jason Wang wrote:
> 
> 
> 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?

I don't think there's an issue: that one's only handling slow-path events ATM.

-- 
MST

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH RFC 0/3] kvm add ioeventfd pf capability "Michael S. Tsirkin" <mst@redhat.com> - 2015-08-30 11:20 +0200
  [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations "Michael S. Tsirkin" <mst@redhat.com> - 2015-08-30 11:20 +0200
    Re: [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-08-31 05:10 +0200
      Re: [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations "Michael S. Tsirkin" <mst@redhat.com> - 2015-08-31 09:50 +0200
        Re: [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-08-31 10:40 +0200
          Re: [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations "Michael S. Tsirkin" <mst@redhat.com> - 2015-08-31 13:30 +0200
            Re: [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2015-08-31 15:30 +0200
              Re: [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations "Michael S. Tsirkin" <mst@redhat.com> - 2015-08-31 17:00 +0200
    Re: [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations Jason Wang <jasowang@redhat.com> - 2015-09-01 05:40 +0200
      Re: [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations "Michael S. Tsirkin" <mst@redhat.com> - 2015-09-01 06:40 +0200
        Re: [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations Jason Wang <jasowang@redhat.com> - 2015-09-01 06:50 +0200
          Re: [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations "Michael S. Tsirkin" <mst@redhat.com> - 2015-09-01 09:00 +0200
  [PATCH RFC 2/3] svm: allow ioeventfd for NPT page faults "Michael S. Tsirkin" <mst@redhat.com> - 2015-08-30 11:20 +0200
  [PATCH RFC 3/3] kvm: add KVM_CAP_IOEVENTFD_PF capability "Michael S. Tsirkin" <mst@redhat.com> - 2015-08-30 11:20 +0200

csiph-web