From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753273AbbIAEtZ (ORCPT ); Tue, 1 Sep 2015 00:49:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37647 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753054AbbIAEtX (ORCPT ); Tue, 1 Sep 2015 00:49:23 -0400 Message-ID: <55E52E4F.2010404@redhat.com> Date: Tue, 01 Sep 2015 12:49:19 +0800 From: Jason Wang User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: "Michael S. Tsirkin" CC: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini Subject: Re: [PATCH RFC 1/3] vmx: allow ioeventfd for EPT violations References: <1440925898-23440-1-git-send-email-mst@redhat.com> <1440925898-23440-2-git-send-email-mst@redhat.com> <55E51D69.2010303@redhat.com> <20150901073305-mutt-send-email-mst@redhat.com> In-Reply-To: <20150901073305-mutt-send-email-mst@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >>> > > --- >>> > > 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?