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=-7.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,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 96ADDC43460 for ; Fri, 9 Apr 2021 14:19:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3EDB361186 for ; Fri, 9 Apr 2021 14:19:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3EDB361186 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 C9CE46B006E; Fri, 9 Apr 2021 10:19:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C4D396B0070; Fri, 9 Apr 2021 10:19:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AEDB36B0071; Fri, 9 Apr 2021 10:19:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0077.hostedemail.com [216.40.44.77]) by kanga.kvack.org (Postfix) with ESMTP id 9080D6B006E for ; Fri, 9 Apr 2021 10:19:09 -0400 (EDT) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 48B44A8C7 for ; Fri, 9 Apr 2021 14:19:09 +0000 (UTC) X-FDA: 78013035618.08.2EFBB45 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf02.hostedemail.com (Postfix) with ESMTP id 38E7040002E1 for ; Fri, 9 Apr 2021 14:18:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617977948; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=e3UH0r2xCKD4o2NrpBi1CrnYYl14AvSTiS+slBUMDUw=; b=Og0cdX228mBoxisHHhO2bD5aww+MgAJJe5s7eVcJRfRwfWOgvplbn/zuRymjxpszwvTahH ocDKfjq9NS6LYxIJfrRo2OramIKbk7nKJLvVnPAY1NNpfpui/dORIraFB5C0lEvjhkljDh MAuGmpVKFaQBSrk/esrtnBQ/bmXuHf4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-582-Cv5cFVeBOO2Qwp9BMdJcpg-1; Fri, 09 Apr 2021 10:19:04 -0400 X-MC-Unique: Cv5cFVeBOO2Qwp9BMdJcpg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 561CF81744F; Fri, 9 Apr 2021 14:19:02 +0000 (UTC) Received: from [10.36.115.11] (ovpn-115-11.ams2.redhat.com [10.36.115.11]) by smtp.corp.redhat.com (Postfix) with ESMTP id 38AA16B8DD; Fri, 9 Apr 2021 14:18:57 +0000 (UTC) Subject: Re: [RFCv1 7/7] KVM: unmap guest memory using poisoned pages To: "Kirill A. Shutemov" Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , Sean Christopherson , Jim Mattson , David Rientjes , "Edgecombe, Rick P" , "Kleen, Andi" , "Yamahata, Isaku" , x86@kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Oscar Salvador , Naoya Horiguchi References: <20210402152645.26680-1-kirill.shutemov@linux.intel.com> <20210402152645.26680-8-kirill.shutemov@linux.intel.com> <5e934d94-414c-90de-c58e-34456e4ab1cf@redhat.com> <20210409133347.r2uf3u5g55pp27xn@box> <5ef83789-ffa5-debd-9ea2-50d831262237@redhat.com> <20210409141211.wfbyzflj7ygtx7ex@box.shutemov.name> From: David Hildenbrand Organization: Red Hat GmbH Message-ID: <8a845f8e-295b-1445-382c-75277ade45ae@redhat.com> Date: Fri, 9 Apr 2021 16:18:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210409141211.wfbyzflj7ygtx7ex@box.shutemov.name> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Stat-Signature: 568stuozjywt38ptb7h3dd9kh8oc6ajh X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 38E7040002E1 Received-SPF: none (redhat.com>: No applicable sender policy available) receiver=imf02; identity=mailfrom; envelope-from=""; helo=us-smtp-delivery-124.mimecast.com; client-ip=63.128.21.124 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617977938-971546 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 09.04.21 16:12, Kirill A. Shutemov wrote: > On Fri, Apr 09, 2021 at 03:50:42PM +0200, David Hildenbrand wrote: >>>> 3. Allow selected users to still grab the pages (esp. KVM to fault them into >>>> the page tables). >>> >>> As long as fault leads to non-present PTEs we are fine. Usespace still may >>> want to mlock() some of guest memory. There's no reason to prevent this. >> >> I'm curious, even get_user_pages() will lead to a present PTE as is, no? So >> that will need modifications I assume. (although I think it fundamentally >> differs to the way get_user_pages() works - trigger a fault first, then >> lookup the PTE in the page tables). > > For now, the patch has two step poisoning: first fault in, on the add to > shadow PTE -- poison. By the time VM has chance to use the page it's > poisoned and unmapped from the host userspace. IIRC, this then assumes that while a page is protected, it will remain mapped into the NPT; because, there is no way to remap into NPT later because the pages have already been poisoned. -- Thanks, David / dhildenb