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=-8.7 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=ham 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 541DDC432BE for ; Wed, 1 Sep 2021 16:22:16 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F377860F91 for ; Wed, 1 Sep 2021 16:22:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F377860F91 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 85B718D0001; Wed, 1 Sep 2021 12:22:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 80B8D6B0071; Wed, 1 Sep 2021 12:22:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 65D478D0001; Wed, 1 Sep 2021 12:22:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0202.hostedemail.com [216.40.44.202]) by kanga.kvack.org (Postfix) with ESMTP id 571F46B006C for ; Wed, 1 Sep 2021 12:22:13 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1AB6D28DA4 for ; Wed, 1 Sep 2021 16:22:13 +0000 (UTC) X-FDA: 78539521746.26.C874A17 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf21.hostedemail.com (Postfix) with ESMTP id B5AA3D025A85 for ; Wed, 1 Sep 2021 16:22:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630513332; 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=kuwA3a8VRWyiF+2itRlcJL8JZbLVL9d2O5cOM0SFnRU=; b=WQRXkfq+SF/A68ErIkBvmwGyikPvG6TEXzLcG9RbB98n06QPXMzyTIXTyfQbxsgqO1iKg3 GMg8PQUTUtPUw6f9PIH4ghunV7NL5ggpa5vJyEyUN0tXv3Uqm0jriT11fI8CVK+aiYVFo8 /QN6edJsTgtQ6pNjA6OPlTNxlZnvSa4= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-180-2wqskGZlMNq-iUfN6RZffQ-1; Wed, 01 Sep 2021 12:22:09 -0400 X-MC-Unique: 2wqskGZlMNq-iUfN6RZffQ-1 Received: by mail-wm1-f72.google.com with SMTP id v2-20020a7bcb420000b02902e6b108fcf1so24074wmj.8 for ; Wed, 01 Sep 2021 09:22:09 -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:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=kuwA3a8VRWyiF+2itRlcJL8JZbLVL9d2O5cOM0SFnRU=; b=sB1tL/yGVF5MEccT76Wud2li7Ppzx4xA8+rpTA8oKAIH8nFvpRCph30hGXW0LpZx37 V9iH6wKg5hgI+/JyjVHin/7ck8AIr0PTdrbVr94VDTZa5L1DKPSsqnnJ7/OuARuwbPhw Khgue+joQryRxMzBgpLutzFVmxt0AfceqMUtTJU4vzzfoZMiWm6rTWHxb65G/wDPSnBs nCUPpfKhm0NTdBQ4Pne1QF1T4r2jNUHpCiA6fo4ZRAuLBIP9GNVLxi2F4su6Ply/OCH5 ME43KYEiBQ/REYqnHGs6UkCRUsyaB8GjKv6Wob1tIRwpJ742VgwE5s/MkAmm0CU1CWYp +Dgg== X-Gm-Message-State: AOAM531sIPJ+2xgOTUOrSttYQQ+P0PP1mAqOPDoVA4U1pWHRDhKOVoKo W+bomOyvqvNd6dEp4o1oF1/KiwbcRof6BEDhtecAkxv1/TOrC5CE+U2VUa1/Z1oiV+UlKL3rYTx gak2vYeDuTPU= X-Received: by 2002:a5d:5441:: with SMTP id w1mr219216wrv.280.1630513328549; Wed, 01 Sep 2021 09:22:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMeavg6INqoWZwHlPtck8LgKcacomg/7RET1DPeO3xXFNSw6hOlYKr+pCFep6oFcJQhqOzMQ== X-Received: by 2002:a5d:5441:: with SMTP id w1mr219161wrv.280.1630513328354; Wed, 01 Sep 2021 09:22:08 -0700 (PDT) Received: from [192.168.3.132] (p4ff23f71.dip0.t-ipconnect.de. [79.242.63.113]) by smtp.gmail.com with ESMTPSA id q85sm31443wme.23.2021.09.01.09.22.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 01 Sep 2021 09:22:07 -0700 (PDT) Subject: Re: [RFC] KVM: mm: fd-based approach for supporting KVM guest private memory To: jejb@linux.ibm.com, Andy Lutomirski , Sean Christopherson Cc: Paolo Bonzini , Vitaly Kuznetsov , Wanpeng Li , Jim Mattson , Joerg Roedel , kvm list , Linux Kernel Mailing List , Borislav Petkov , Andrew Morton , Joerg Roedel , Andi Kleen , David Rientjes , Vlastimil Babka , Tom Lendacky , Thomas Gleixner , "Peter Zijlstra (Intel)" , Ingo Molnar , Varad Gautam , Dario Faggioli , the arch/x86 maintainers , linux-mm@kvack.org, linux-coco@lists.linux.dev, "Kirill A. Shutemov" , "Kirill A . Shutemov" , Sathyanarayanan Kuppuswamy , Dave Hansen , Yu Zhang References: <20210824005248.200037-1-seanjc@google.com> <307d385a-a263-276f-28eb-4bc8dd287e32@redhat.com> <61ea53ce-2ba7-70cc-950d-ca128bcb29c5@redhat.com> <9ec3636a-6434-4c98-9d8d-addc82858c41@www.fastmail.com> From: David Hildenbrand Organization: Red Hat Message-ID: Date: Wed, 1 Sep 2021 18:22:06 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WQRXkfq+; dmarc=pass (policy=none) header.from=redhat.com; spf=none (imf21.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: B5AA3D025A85 X-Stat-Signature: ojp1pu4pf8qfhm57po1ybozrz9nzdnjf X-HE-Tag: 1630513332-743649 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 01.09.21 18:18, James Bottomley wrote: > On Wed, 2021-09-01 at 08:54 -0700, Andy Lutomirski wrote: > [...] >> If you want to swap a page on TDX, you can't. Sorry, go directly to >> jail, do not collect $200. > > Actually, even on SEV-ES you can't either. You can read the encrypted > page and write it out if you want, but unless you swap it back to the > exact same physical memory location, the encryption key won't work. > Since we don't guarantee this for swap, I think swap won't actually > work for any confidential computing environment. > >> So I think there are literally zero code paths that currently call >> try_to_unmap() that will actually work like that on TDX. If we run >> out of memory on a TDX host, we can kill the guest completely and >> reclaim all of its memory (which probably also involves killing QEMU >> or whatever other user program is in charge), but that's really our >> only option. > > I think our only option for swap is guest co-operation. We're going to > have to inflate a balloon or something in the guest and have the guest > driver do some type of bounce of the page, where it becomes an > unencrypted page in the guest (so the host can read it without the > physical address keying of the encryption getting in the way) but > actually encrypted with a swap transfer key known only to the guest. I > assume we can use the page acceptance infrastructure currently being > discussed elsewhere to do swap back in as well ... the host provides > the guest with the encrypted swap page and the guest has to decrypt it > and place it in encrypted guest memory. Ballooning is indeed *the* mechanism to avoid swapping in the hypervisor and much rather let the guest swap. Shame it requires trusting a guest, which we, in general, can't. Not to mention other issues we already do have with ballooning (latency, broken auto-ballooning, over-inflating, ...). -- Thanks, David / dhildenb