From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,SUBJ_ALL_CAPS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 032B4ECE58A for ; Wed, 2 Oct 2019 16:18:15 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id A0D5B21920 for ; Wed, 2 Oct 2019 16:18:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A0D5B21920 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 086326B0005; Wed, 2 Oct 2019 12:18:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 037456B0006; Wed, 2 Oct 2019 12:18:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E68AA6B0007; Wed, 2 Oct 2019 12:18:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0083.hostedemail.com [216.40.44.83]) by kanga.kvack.org (Postfix) with ESMTP id C68B26B0005 for ; Wed, 2 Oct 2019 12:18:13 -0400 (EDT) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 589296D80 for ; Wed, 2 Oct 2019 16:18:13 +0000 (UTC) X-FDA: 75999351666.22.feet67_d8218a794c17 X-HE-Tag: feet67_d8218a794c17 X-Filterd-Recvd-Size: 5578 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Wed, 2 Oct 2019 16:18:12 +0000 (UTC) Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1B7EA5AFE3 for ; Wed, 2 Oct 2019 16:18:11 +0000 (UTC) Received: by mail-wm1-f69.google.com with SMTP id f63so2279625wma.7 for ; Wed, 02 Oct 2019 09:18:11 -0700 (PDT) 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:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/v3cLVQkUXMFYA41ytcIYtOGrK2O1kisY2oYiPOm+oU=; b=DxRGT/1WZGypcYsWAP/HSHnlu25nBZR8E+4SCaz1OWgutQXjo1cJAN6tzZKO0on6gA 5XvQQmQ2FHNhR0Jlt6h+vYnw4IIl+z6aTrj7cP/PCWokngxpC+muPCY4cTEWX165m5O8 +0IlZKVmaO07W2m7bmc0V+qLZdjCpKUfDQxH0O7ITicpAMLdHBmkKjQFSO6FioSuMBXH kRyHZizNGp3qlX/2tSnC6ji++YQqpAzPZQPpM9VIxQ63JKIrR89s5OJZoKn6ebUkf/9N G74ryMwk222+XeHVV16YYG3xqj67VG4dDQYBYiD9CxYuXp70iF4IjmhxVxM677WPwUx1 hV/A== X-Gm-Message-State: APjAAAVjT80WAQQQXHwypGVS3uVP5KrL97DqAYCzdxvPAN4DHs8yZrpV +JNa9teZhQeQZNDx1ikHnWKEqeIN7VcWeidW7ML0B1e2ZT7as4jFX4D+vFL/cvIc39XzsiHNHsH R9W1JKwU0tKg= X-Received: by 2002:adf:f1d1:: with SMTP id z17mr3285351wro.330.1570033089763; Wed, 02 Oct 2019 09:18:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqzdXxh5wz8G/f4mQKDqgI/sCIg/sY1v8M+KqylLMhEoh0g4kEjcKivr4dgFmTlgMkBHXTJsOw== X-Received: by 2002:adf:f1d1:: with SMTP id z17mr3285315wro.330.1570033089460; Wed, 02 Oct 2019 09:18:09 -0700 (PDT) Received: from [192.168.10.150] ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id i11sm9448102wrq.48.2019.10.02.09.18.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Oct 2019 09:18:08 -0700 (PDT) Subject: Re: DANGER WILL ROBINSON, DANGER To: Jerome Glisse Cc: Mircea CIRJALIU - MELIU , =?UTF-8?Q?Adalbert_Laz=c4=83r?= , Matthew Wilcox , "kvm@vger.kernel.org" , "linux-mm@kvack.org" , "virtualization@lists.linux-foundation.org" , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Konrad Rzeszutek Wilk , Tamas K Lengyel , Mathieu Tarral , =?UTF-8?Q?Samuel_Laur=c3=a9n?= , Patrick Colp , Jan Kiszka , Stefan Hajnoczi , Weijiang Yang , Yu C , =?UTF-8?Q?Mihai_Don=c8=9bu?= References: <20190809162444.GP5482@bombadil.infradead.org> <1565694095.D172a51.28640.@15f23d3a749365d981e968181cce585d2dcb3ffa> <20190815191929.GA9253@redhat.com> <20190815201630.GA25517@redhat.com> <20190905180955.GA3251@redhat.com> <5b0966de-b690-fb7b-5a72-bc7906459168@redhat.com> <20191002192714.GA5020@redhat.com> <20191002141542.GA5669@redhat.com> From: Paolo Bonzini Openpgp: preference=signencrypt Message-ID: Date: Wed, 2 Oct 2019 18:18:06 +0200 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: <20191002141542.GA5669@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 02/10/19 16:15, Jerome Glisse wrote: >>> Why would you need to target mmu notifier on target vma ? >> If the mapping of the source VMA changes, mirroring can update the >> target VMA via insert_pfn. But what ensures that KVM's MMU notifier >> dismantles its own existing page tables (so that they can be recreated >> with the new mapping from the source VMA)? >> > So just to make sure i follow we have: > - qemu process on host with anonymous vma > -> host cpu page table > - kvm which maps host anonymous vma to guest > -> kvm guest page table > - kvm inspector process which mirror vma from qemu process > -> inspector process page table > > AFAIK the KVM notifier's will clear the kvm guest page table whenever > necessary (through kvm_mmu_notifier_invalidate_range_start). This is > what ensure that KVM's dismatles its own mapping, it abides to mmu- > notifier callbacks. If you did not you would have bugs (at least i > expect so). Am i wrong here ? The KVM inspector process is also (or can be) a QEMU that will have to create its own KVM guest page table. So if a page in the source VMA is unmapped we want: - the source KVM to invalidate its guest page table (done by the KVM MMU notifier) - the target VMA to be invalidated (easy using mirroring) - the target KVM to invalidate its guest page table, as a result of invalidation of the target VMA Paolo