Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp3923774ybn; Fri, 27 Sep 2019 13:25:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqzU9AIJuP2IFaERyqZrVz5TwJaQZC6qlhXgSjPooE96LEQf7rYI+GJH7Y4q4sV4N0y+PeYx X-Received: by 2002:a17:906:3298:: with SMTP id 24mr9443497ejw.136.1569615911335; Fri, 27 Sep 2019 13:25:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569615911; cv=none; d=google.com; s=arc-20160816; b=xMsHLRN60Tu0Lz57T38gIKbdzvrkq8865I5Q8/jfXOYwCtlQVgfLSWlc+xkRCoTnY4 v7p6fpKv95en7s3Vy+2EaYftYUIwQEpYb41oPhVQz3R7keOyghxkiPPbDLYlJSEHvxZT v3F+FGfTALhLTJ7uxs/vekdPMCYrIBeDEvYT0PZh93Hp8OAc3PVeG5ZmaDMGMQf5P6wc JxFBnHm1zhuBdt1YkJseFa3H2ldQtM8k5H7YB4fyHufsR1hJJEFcEB+PUQ+VQg6mbCeh YOjKGQVCW1yv/mO/gruqmaExPdvHGLHTK9OId7i5LjbkLERqlTP3c6ogtg8J1oTC+7Qw zlLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:organization:autocrypt:openpgp:from:references:cc:to :subject:dkim-signature; bh=av8uQTzC5kAZ04adK2jUzugM4hsPl2jUpES0RTtperI=; b=itrNaM6YiV70vjTpqgqppwE0i9kckLCC8kX6Py0DhukqojoTrYjoCBKqfOx0ZlMYMQ t2LEJ51mQtR5pUl3ArbY6e0dwxI80i5cooKOm6tLa6ctvOOsWfk2pHHmgCA0R501tECr HuNFp+2osrP9XKg26ehBVxBmdrB8AtJCL5XCoOrFBukIQauFdd1yic50xVOwNACmSSz6 doSOpSm28vqMDZXEsB7Qe871YykUnqzCx6nNb0KXYPhadz2W4MxZHa+X0rvXW98ewo9q 1VIdlJmFQXppSutpAskah/m8Wh8/Bn9V67IYr8wDCtAG87fmH8Lrv8v/hLnfDEdp2/4w e4sw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=fOt4rEu6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11si3315349ejc.366.2019.09.27.13.24.44; Fri, 27 Sep 2019 13:25:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=fOt4rEu6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726762AbfI0UYl (ORCPT + 99 others); Fri, 27 Sep 2019 16:24:41 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:45095 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726036AbfI0UYk (ORCPT ); Fri, 27 Sep 2019 16:24:40 -0400 Received: by mail-pf1-f195.google.com with SMTP id y72so2171032pfb.12 for ; Fri, 27 Sep 2019 13:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=subject:to:cc:references:from:openpgp:autocrypt:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=av8uQTzC5kAZ04adK2jUzugM4hsPl2jUpES0RTtperI=; b=fOt4rEu6WT8wmVxdYRnJ5ZS/3wY9TTML1Y6MVTtId1t6nLAYoWvXz6fmKAFPqs+mKo ZA3BjyNtKIj11n5uTvytcNvyA7XeEokpO/MzutnuoG5QJI1kWN1/YwV4twGddY3JDHDu RzKU8tvzIixQ23Is9KezC3Lc3CVs9C3ZELa9UeAF8y7CB6srtOXhCV0RWf7zyF7Mo2iI 68qI11EL5VsmZ5SuQH9uB/MaD6PRt6Tuek+8zTVk7TSNNAtALCggtOy3zC4cydScB+PM O/8YmwGUfZYeGNowVOONCOp8Zj6UB2RiJ93SDjb3jh6vVTFsLmYK4I6QBsc0cXxPvqC8 lI/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:openpgp:autocrypt :organization:message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=av8uQTzC5kAZ04adK2jUzugM4hsPl2jUpES0RTtperI=; b=QmdUhNc9nJzNAxt+CS6LLdouOWC3LidBvCthQIzvWJKS7RFJNnIy959wlDMbKtZzJU AGazxVjuHniRyLgbJK2HXC9ajbyWd/rEi/qV/d4Rm9VntGXy/hJFKJfwtD5pvq1iF1UC 3oweyfCY+okPispO0RF6rGtx6uFPdsLgIC6+UyQNKS3+9tbbqquRiEyBgiVfke6uIJSH wXVxuZiZZgIDzGdUg6ET+zfGCMzNmYxj6fhoYnYvogJPLsgvHvoF78JzEmuHgKr5rC6S ve/dO+r1alvjMjLXs95UlzgEu15cFgADBL+rKBw/Hi+sGLWHfugQBzut/HEq02JhiTcx g81A== X-Gm-Message-State: APjAAAV84N2IuNfWHTG/m/1yNADQRGaGs8T9gYj8OpF8X9yM1Q5M/nN6 HCk14W36JiMULngQUMZ/8sfFuw== X-Received: by 2002:a17:90a:80c9:: with SMTP id k9mr11914360pjw.68.1569615879390; Fri, 27 Sep 2019 13:24:39 -0700 (PDT) Received: from js-desktop.svl.corp.google.com ([2620:15c:2cd:2:5e41:bb1f:98fb:39da]) by smtp.gmail.com with ESMTPSA id d1sm3421894pfc.98.2019.09.27.13.24.38 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Sep 2019 13:24:38 -0700 (PDT) Subject: Re: [PATCH v2 2/3] KVM: x86: fix nested guest live migration with PML To: Paolo Bonzini , linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: Vitaly Kuznetsov , Sean Christopherson References: <1569582943-13476-1-git-send-email-pbonzini@redhat.com> <1569582943-13476-3-git-send-email-pbonzini@redhat.com> From: Junaid Shahid Openpgp: preference=signencrypt Autocrypt: addr=junaids@google.com; keydata= mQGNBFyBfSUBDADJpxqPVaO+D+pK2zarR0QwxUAAA7kVV9uPO5iEJXWAmZJJSzeRSoZEEcVg hXXQzmYaEn18kA/lDih1/20gr7y0sCupvQwnE0itvLYqyPzmWv93ilkOXnus7CySH2CDINH7 49+kHhA5YX1TxWBYoAbKxyc/IKHG7h/hsSxCfQhYZimE1hpZUcVx77GD6h2Fbh855c2p8RN8 D/A+fMkBncrpRgWjpc64bLrZnLGJz+/BB301xA2xhMrllGpgreW6ZmiUEh1/oTWMnEUzADx5 bzDRSZyw4fUlysAOujmHmJ4B6ORIhYZkyReo2wdHXizsv2lonifygsM8yfBSAOEBez3yDoic Yb9qIZoVNlBGFuHJrp4sx41JxFr9EOeHQtbX8O3iy+n8afrBlVPMZiUkEtnsat+LsT5ix2Nk mdeY9J5zBwalKEC5zCZ1OfSo9rBLF+pamT/EeCGzatNFY7pyqcOjGvFxloYEKn+D8P0DYFRP ny7CeVwLZo43nkaiyRKMeHcAEQEAAbQiSnVuYWlkIFNoYWhpZCA8anVuYWlkc0Bnb29nbGUu Y29tPokB1AQTAQoAPhYhBK06Mjqf2kfFM5QUJZzM5LZ0wQJuBQJcgX0lAhsDBQkDwmcABQsJ CAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEJzM5LZ0wQJuwcwMA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gUCXIF9JQIbDAUJ A8JnAAAKCRCczOS2dMECbt8hC/0QoPTA6kfuCMoKq9uT7sRdM7Zx+y8ug0J63HjhsdEfXoMx 88qXOG/rRrh99uxgqtr5NgtD3kftAtUcBglhgwJxLwo/WLmCFn/zBTZA4klTLgYqRrDtQvev bhzXMcSlBsZWiWPaLpSN6CBxWdxSlMWDwnZhfKMwQhg16tk7sxV/vfHU60ZoeIqKfHV83qg5 nEbeUprl/vwWv3b7d4PgKCLPEhjPFU/6oWuD4cgrsPNp8xqVZ7BXHpWH0hXcIMV2H3+zV4vj dJcBMt0VfEgATMVj6fSTZlh3lRceC/OXza2q0qg2HIT9yxErYIL8YSAFikZPJjkG1Wwv9CTd s2WSlTd3YfM2EGcJFP1XFZQKl+vs1Jop+rFjynQB2jX0GP1IG4ab1NYHAVX9ENhIiE97gMLL 5X/clE5ZjNHVh8p8Ivv4UyZk2pfJxBgg9++M3EXfVuZpP4Rzna4ttKLdB5Ehv7YuGHu8E0n9 iWogGkOc4UGfcj87Lt9ivHEsVoo/lwCTIiQ= Organization: Google Message-ID: <0b6701ed-8eac-1f52-8fdd-c06d2289ce11@google.com> Date: Fri, 27 Sep 2019 13:24:37 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <1569582943-13476-3-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 9/27/19 4:15 AM, Paolo Bonzini wrote: > Shadow paging is fundamentally incompatible with the page-modification > log, because the GPAs in the log come from the wrong memory map. > In particular, for the EPT page-modification log, the GPAs in the log come > from L2 rather than L1. (If there was a non-EPT page-modification log, > we couldn't use it for shadow paging because it would log GVAs rather > than GPAs). > > Therefore, we need to rely on write protection to record dirty pages. > This has the side effect of bypassing PML, since writes now result in an > EPT violation vmexit. > > This is relatively easy to add to KVM, because pretty much the only place > that needs changing is spte_clear_dirty. The first access to the page > already goes through the page fault path and records the correct GPA; > it's only subsequent accesses that are wrong. Therefore, we can equip > set_spte (where the first access happens) to record that the SPTE will > have to be write protected, and then spte_clear_dirty will use this > information to do the right thing. > > Signed-off-by: Paolo Bonzini > --- Reviewed-by: Junaid Shahid