From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lai Jiangshan Subject: [PATCH 1/2] kvm,ept: pass error code to handler Date: Fri, 11 Jun 2010 19:30:24 +0800 Message-ID: <4C121E50.6050402@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit To: Avi Kivity , Marcelo Tosatti , kvm@vger.kernel.org, LKML Return-path: Received: from cn.fujitsu.com ([222.73.24.84]:64598 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1755400Ab0FKLa5 (ORCPT ); Fri, 11 Jun 2010 07:30:57 -0400 Sender: kvm-owner@vger.kernel.org List-ID: handle_ept_violation() does not pass error code to the handler tdp_page_fault(). It means tdp_page_fault() handles the page fault with ignoring the error code, It will not handle the page fault completely correctly, and may causes endless page fault. { But because there is another bad code in the kvm, This endless page faulting never occur. The bad code: kvm always set pte writable. negative * negative = positive, WTF!! Next patch will fix this bad code. } Signed-off-by: Lai Jiangshan --- diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index c7565ea..6362dcc 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -3470,7 +3470,7 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu) gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS); trace_kvm_page_fault(gpa, exit_qualification); - return kvm_mmu_page_fault(vcpu, gpa & PAGE_MASK, 0); + return kvm_mmu_page_fault(vcpu, gpa & PAGE_MASK, exit_qualification); } static u64 ept_rsvd_mask(u64 spte, int level)