Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752155AbdF1NjF (ORCPT ); Wed, 28 Jun 2017 09:39:05 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45942 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751559AbdF1Ni4 (ORCPT ); Wed, 28 Jun 2017 09:38:56 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CA3184DD49 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=rkrcmar@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com CA3184DD49 Date: Wed, 28 Jun 2017 15:38:52 +0200 From: Radim =?utf-8?B?S3LEjW3DocWZ?= To: Paolo Bonzini Cc: Wanpeng Li , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Wanpeng Li Subject: Re: [PATCH v6 3/4] KVM: async_pf: Force a nested vmexit if the injected #PF is async_pf Message-ID: <20170628133852.GA3261@potion> References: <1498652712-10283-1-git-send-email-wanpeng.li@hotmail.com> <1498652712-10283-4-git-send-email-wanpeng.li@hotmail.com> <293c4524-5869-2d3f-e0a3-92bde4430b81@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <293c4524-5869-2d3f-e0a3-92bde4430b81@redhat.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 28 Jun 2017 13:38:56 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1520 Lines: 34 2017-06-28 14:56+0200, Paolo Bonzini: > On 28/06/2017 14:25, Wanpeng Li wrote: >> From: Wanpeng Li >> >> Add an nested_apf 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. >> >> Cc: Paolo Bonzini >> Cc: Radim Krčmář >> Signed-off-by: Wanpeng Li >> --- > > Radim, Wanpeng, > > the patch is nice now but I'm still not 100% sure about the live > migration part. Why do we need to pass nested_apf to userspace, but not > nested_apf_token? We do not need it for migration, but unavailable nested_apf_token already breaks checkpoint & restore from userspace ... I think the cleanest way would be to add a new paravirtual event for nested_apf. (Or just keep delaying the apf.) Migration does a "async-pf-broadcast" while setting the async-pf MSR on destination, which resumes all async-pf waiters. Userspace actually has to drop the async-pf event on migration, because the destination has invalid nested_apf_token. (It's a horrible design.) nested_apf is not #PF: if we didn't pass nested_apf, then the exception would be injected as #PF to L2 after migration. (Local KVM could remember that the #PF is nested_apf and do some ugly hacks.)