Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753787AbdGNMjj (ORCPT ); Fri, 14 Jul 2017 08:39:39 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39396 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753479AbdGNMjh (ORCPT ); Fri, 14 Jul 2017 08:39:37 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E977E85A05 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=rkrcmar@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E977E85A05 Date: Fri, 14 Jul 2017 14:39:33 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Wanpeng Li Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Paolo Bonzini , Wanpeng Li Subject: Re: [PATCH v8 2/4] KVM: async_pf: Add L1 guest async_pf #PF vmexit handler Message-ID: <20170714123933.GI3442@potion> References: <1499995842-92976-1-git-send-email-wanpeng.li@hotmail.com> <1499995842-92976-3-git-send-email-wanpeng.li@hotmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1499995842-92976-3-git-send-email-wanpeng.li@hotmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 14 Jul 2017 12:39:37 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1246 Lines: 36 2017-07-13 18:30-0700, Wanpeng Li: > From: Wanpeng Li > > This patch adds the L1 guest async page fault #PF vmexit handler, such > by L1 similar to ordinary async page fault. > > Cc: Paolo Bonzini > Cc: Radim Krčmář > Signed-off-by: Wanpeng Li > --- > diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c > @@ -3780,6 +3781,37 @@ static bool try_async_pf(struct kvm_vcpu *vcpu, bool prefault, gfn_t gfn, > return false; > } > > +int kvm_handle_page_fault(struct kvm_vcpu *vcpu, u64 error_code, > + u64 fault_address, char *insn, int insn_len, > + bool need_unprotect) > +{ > + int r = 1; > + > + switch (vcpu->arch.apf.host_apf_reason) { > + default: > + trace_kvm_page_fault(fault_address, error_code); > + > + if (need_unprotect && kvm_event_needs_reinjection(vcpu)) > + kvm_mmu_unprotect_page_virt(vcpu, fault_address); > + r = kvm_mmu_page_fault(vcpu, fault_address, error_code, NULL, 0); I changed this when applying (my patch was crappy), the arguments shouldn't be lost: kvm_mmu_page_fault(vcpu, fault_address, error_code, insn, insn_len); It will be in the second merge window pull request if nothing goes bad, thanks.