From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v2 5/9] KVM: MMU: Optimize pte permission checks Date: Wed, 19 Sep 2012 19:06:37 +0300 Message-ID: <5059ED8D.3080103@redhat.com> References: <1347797235-20732-1-git-send-email-avi@redhat.com> <1347797235-20732-6-git-send-email-avi@redhat.com> <5058188C.70006@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org To: Xiao Guangrong Return-path: Received: from mx1.redhat.com ([209.132.183.28]:4525 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932342Ab2ISQHl (ORCPT ); Wed, 19 Sep 2012 12:07:41 -0400 In-Reply-To: <5058188C.70006@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 09/18/2012 09:45 AM, Xiao Guangrong wrote: > On 09/16/2012 08:07 PM, Avi Kivity wrote: > >> @@ -3672,20 +3672,17 @@ static int vcpu_mmio_gva_to_gpa(struct kvm_vcpu *vcpu, unsigned long gva, >> gpa_t *gpa, struct x86_exception *exception, >> bool write) >> { >> - u32 access = (kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0; >> + u32 access = ((kvm_x86_ops->get_cpl(vcpu) == 3) ? PFERR_USER_MASK : 0) >> + | (write ? PFERR_WRITE_MASK : 0); >> >> - if (vcpu_match_mmio_gva(vcpu, gva) && >> - check_write_user_access(vcpu, write, access, >> - vcpu->arch.access)) { >> + if (vcpu_match_mmio_gva(vcpu, gva) >> + && permission_fault(vcpu->arch.walk_mmu, vcpu->arch.access, access)) { > > I think '!' was missed? Is it !permission_fault()? > > Otherwise looks good to me! Whoops, fixed. -- error compiling committee.c: too many arguments to function