Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933781AbcDFI4z (ORCPT ); Wed, 6 Apr 2016 04:56:55 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:33944 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932604AbcDFI4w (ORCPT ); Wed, 6 Apr 2016 04:56:52 -0400 Subject: Re: [PATCH 1/4] KVM: MMU: fix permission_fault() To: Xiao Guangrong References: <1458911978-19430-1-git-send-email-guangrong.xiao@linux.intel.com> Cc: gleb@kernel.org, mtosatti@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org From: Paolo Bonzini Message-ID: <5704CF4D.9080905@redhat.com> Date: Wed, 6 Apr 2016 10:56:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0 MIME-Version: 1.0 In-Reply-To: <1458911978-19430-1-git-send-email-guangrong.xiao@linux.intel.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 Content-Length: 714 Lines: 27 On 25/03/2016 14:19, Xiao Guangrong wrote: > @@ -193,11 +193,11 @@ static inline u8 permission_fault(struct kvm_vcpu *vcpu, struct kvm_mmu *mmu, > ((pte_access & PT_USER_MASK) << (PFERR_RSVD_BIT - PT_USER_SHIFT)); One more tweak is needed in the line above; pfec - 1 must become pfec & ~1, because you've removed the pfec |= PFERR_PRESENT_MASK; line. Applied with this change. Paolo > > pkru_bits &= mmu->pkru_mask >> offset; > - pfec |= -pkru_bits & PFERR_PK_MASK; > + errcode |= -pkru_bits & PFERR_PK_MASK; > fault |= (pkru_bits != 0); > } > > - return -(uint32_t)fault & pfec; > + return -(uint32_t)fault & errcode; > } > > void kvm_mmu_invalidate_zap_all_pages(struct kvm *kvm);