From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753172AbdF0Nkk (ORCPT ); Tue, 27 Jun 2017 09:40:40 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:34098 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752112AbdF0Nkc (ORCPT ); Tue, 27 Jun 2017 09:40:32 -0400 Subject: Re: [PATCH v4 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf To: Wanpeng Li , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Wanpeng Li References: <1498097214-6239-1-git-send-email-wanpeng.li@hotmail.com> <1498097214-6239-4-git-send-email-wanpeng.li@hotmail.com> From: Paolo Bonzini Message-ID: <61bbcc19-a818-6934-75e9-8aed28523aa0@redhat.com> Date: Tue, 27 Jun 2017 15:40:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <1498097214-6239-4-git-send-email-wanpeng.li@hotmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 22/06/2017 04:06, Wanpeng Li wrote: > From: Wanpeng Li > > Add an async_page_fault field to vcpu->arch.exception to identify an async > page fault, and constructs the expected vm-exit information fields. Force > a nested VM exit from nested_vmx_check_exception() if the injected #PF > is async page fault. Extending the userspace interface KVM_GET_VCPU_EVENTS > and KVM_SET_VCPU_EVENTS for live migration. I am not sure what would happen if new kernel (that can produce async_page_fault=1) runs on top of old userspace (that can consume it). I think it would be safer to make the new field "nested_apf", and only set it if in guest_mode, like vcpu->arch.exception.nested_apf = is_guest_mode(vcpu) && fault->async_page_fault; if (vcpu->arch.exception.nested_apf) vcpu->arch.apf.nested_apf_token = fault->address; else vcpu->arch.cr2 = fault->address; What do you think? Paolo