From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751616AbdFHMs3 (ORCPT ); Thu, 8 Jun 2017 08:48:29 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46134 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751547AbdFHMsN (ORCPT ); Thu, 8 Jun 2017 08:48:13 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 08384C05FFC6 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=pbonzini@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 08384C05FFC6 Subject: Re: [PATCH RFC] KVM: async_pf: fix async_pf exception injection To: Wanpeng Li Cc: "linux-kernel@vger.kernel.org" , kvm , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Wanpeng Li References: <1496914224-87730-1-git-send-email-wanpeng.li@hotmail.com> <6458c7e1-c404-43e5-800b-6e02f236c902@redhat.com> From: Paolo Bonzini Message-ID: <579af34a-acea-3aed-ca2c-38fe9fa7da76@redhat.com> Date: Thu, 8 Jun 2017 14:48:08 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 08 Jun 2017 12:48:13 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/06/2017 14:32, Wanpeng Li wrote: >>> I change the >>> condition to "nr == PF_VECTOR && error_code == 0" to intercept async_pf, however, >>> the below bug will be splatted: >> Right, because error_code == 0 is a valid error code. >> >> For stable releases, this should be enough: > > We should also take care PAGE_READY async_pfs injection. I will send a > patch to avoid async pf injection stuff in guest mode for stable > release. Right, the simplest thing to do here is another is_guest_mode check in kvm_arch_can_inject_async_page_present. That would delay the signaling of ready pages while L2 runs, but hopefully we're under memory pressure so L2 will get a page fault too. In fact, kvm_arch_can_inject_async_page_present should just be if (!(vcpu->arch.apf.msr_val & KVM_ASYNC_PF_ENABLED)) return true; else return can_do_async_pf(vcpu); where can_do_async_pf becomes nonstatic. Paolo