Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754116AbdFNBBj (ORCPT ); Tue, 13 Jun 2017 21:01:39 -0400 Received: from mail-oi0-f67.google.com ([209.85.218.67]:34863 "EHLO mail-oi0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753382AbdFNBBh (ORCPT ); Tue, 13 Jun 2017 21:01:37 -0400 MIME-Version: 1.0 In-Reply-To: <20170613181924.GA1276@potion> References: <1497334094-6982-1-git-send-email-wanpeng.li@hotmail.com> <1497334094-6982-5-git-send-email-wanpeng.li@hotmail.com> <20170613181924.GA1276@potion> From: Wanpeng Li Date: Wed, 14 Jun 2017 09:01:36 +0800 Message-ID: Subject: Re: [PATCH 4/4] KVM: async_pf: Let host know whether the guest support delivery async_pf as #PF vmexit To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= Cc: "linux-kernel@vger.kernel.org" , kvm , Paolo Bonzini , Wanpeng Li Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by mail.home.local id v5E11gwA020269 Content-Length: 1340 Lines: 36 2017-06-14 2:19 GMT+08:00 Radim Krčmář : > 2017-06-12 23:08-0700, Wanpeng Li: >> From: Wanpeng Li >> >> Adds another flag bit (bit 2) to MSR_KVM_ASYNC_PF_EN. If bit 2 is 1, async >> page faults are delivered to L1 as #PF vmexits; if bit 2 is 0, kvm_can_do_async_pf >> returns 0 if in guest mode. >> >> Cc: Paolo Bonzini >> Cc: Radim Krčmář >> Signed-off-by: Wanpeng Li >> --- > > I think KVM (L1) should also do something like > > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index dd274db9bf77..c15a9f178e60 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -7991,7 +7991,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu) > if (is_nmi(intr_info)) > return false; > else if (is_page_fault(intr_info)) > - return enable_ept; > + return !vmx->apf_reason && enable_ept; > else if (is_no_device(intr_info) && > !(vmcs12->guest_cr0 & X86_CR0_TS)) > return false; > > so it doesn't pass the APF directed towards it (L1) into L2 if there is > L3 at the moment. Agreed. I will do this in v2. Regards, Wanpeng Li