All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tom Lendacky <thomas.lendacky@amd.com>
To: jejb@linux.ibm.com, Andy Lutomirski <luto@kernel.org>,
	David Hildenbrand <david@redhat.com>,
	Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
	kvm list <kvm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Borislav Petkov <bp@alien8.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Joerg Roedel <jroedel@suse.de>, Andi Kleen <ak@linux.intel.com>,
	David Rientjes <rientjes@google.com>,
	Vlastimil Babka <vbabka@suse.cz>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Varad Gautam <varad.gautam@suse.com>,
	Dario Faggioli <dfaggioli@suse.com>,
	the arch/x86 maintainers <x86@kernel.org>,
	linux-mm@kvack.org, linux-coco@lists.linux.dev,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	"Kirill A . Shutemov" <kirill@shutemov.name>,
	Sathyanarayanan Kuppuswamy
	<sathyanarayanan.kuppuswamy@linux.intel.com>,
	Dave Hansen <dave.hansen@intel.com>,
	Yu Zhang <yu.c.zhang@linux.intel.com>
Subject: Re: [RFC] KVM: mm: fd-based approach for supporting KVM guest private memory
Date: Tue, 7 Sep 2021 10:00:12 -0500	[thread overview]
Message-ID: <f9fb2962-4b67-00e6-01e3-48a57d466932@amd.com> (raw)
In-Reply-To: <bd22ef54224d15ee89130728c408f70da0516eaa.camel@linux.ibm.com>

On 9/1/21 11:18 AM, 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.

There are SEV/SEV-ES and SEV-SNP APIs to swap a page out and in. There is 
also an API to copy (for SEV/SEV-ES) or move (for SEV-SNP) a page in 
memory to help with balancing if needed.

These aren't currently implemented in the kernel, but can be. It requires 
the changes going in for live migration to recognize that a page is 
encrypted/private and invoke the APIs to transform the page before doing 
the operation.

Thanks,
Tom

> 
>> 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.
> 
> That way the swapped memory is securely encrypted, but can be swapped
> back in.
> 
> James
> 
> 

  parent reply	other threads:[~2021-09-07 15:00 UTC|newest]

Thread overview: 142+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24  0:52 [RFC] KVM: mm: fd-based approach for supporting KVM guest private memory Sean Christopherson
2021-08-24  0:52 ` Sean Christopherson
2021-08-24 10:48 ` Yu Zhang
2021-08-24 10:48   ` Yu Zhang
2021-08-26  0:35   ` Sean Christopherson
2021-08-26  0:35     ` Sean Christopherson
2021-08-26 13:23     ` Yu Zhang
2021-08-26 13:23       ` Yu Zhang
2021-08-26 10:15 ` David Hildenbrand
2021-08-26 10:15   ` David Hildenbrand
2021-08-26 17:05   ` Andy Lutomirski
2021-08-26 17:05     ` Andy Lutomirski
2021-08-26 21:26     ` David Hildenbrand
2021-08-26 21:26       ` David Hildenbrand
2021-08-27 18:24       ` Andy Lutomirski
2021-08-27 18:24         ` Andy Lutomirski
2021-08-27 22:28         ` Sean Christopherson
2021-08-27 22:28           ` Sean Christopherson
2021-08-31 19:12           ` David Hildenbrand
2021-08-31 19:12             ` David Hildenbrand
2021-08-31 20:45             ` Sean Christopherson
2021-08-31 20:45               ` Sean Christopherson
2021-09-01  7:51               ` David Hildenbrand
2021-09-01  7:51                 ` David Hildenbrand
2021-08-27  2:31   ` Yu Zhang
2021-08-27  2:31     ` Yu Zhang
2021-08-31 19:08     ` David Hildenbrand
2021-08-31 19:08       ` David Hildenbrand
2021-08-31 20:01       ` Andi Kleen
2021-08-31 20:01         ` Andi Kleen
2021-08-31 20:15         ` David Hildenbrand
2021-08-31 20:15           ` David Hildenbrand
2021-08-31 20:39           ` Andi Kleen
2021-08-31 20:39             ` Andi Kleen
2021-09-01  3:34             ` Yu Zhang
2021-09-01  3:34               ` Yu Zhang
2021-09-01  4:53     ` Andy Lutomirski
2021-09-01  4:53       ` Andy Lutomirski
2021-09-01  7:12       ` Tian, Kevin
2021-09-01  7:12         ` Tian, Kevin
2021-09-01 10:24       ` Yu Zhang
2021-09-01 10:24         ` Yu Zhang
2021-09-01 16:07         ` Andy Lutomirski
2021-09-01 16:07           ` Andy Lutomirski
2021-09-01 16:27           ` David Hildenbrand
2021-09-01 16:27             ` David Hildenbrand
2021-09-02  8:34             ` Yu Zhang
2021-09-02  8:34               ` Yu Zhang
2021-09-02  8:44               ` David Hildenbrand
2021-09-02  8:44                 ` David Hildenbrand
2021-09-02 11:02                 ` Yu Zhang
2021-09-02 11:02                   ` Yu Zhang
2021-09-02  8:19           ` Yu Zhang
2021-09-02  8:19             ` Yu Zhang
2021-09-02 18:41             ` Andy Lutomirski
2021-09-02 18:41               ` Andy Lutomirski
2021-09-07  1:33             ` Yan Zhao
2021-09-07  1:33               ` Yan Zhao
2021-09-02  9:27           ` Joerg Roedel
2021-09-02  9:27             ` Joerg Roedel
2021-09-02 18:41             ` Andy Lutomirski
2021-09-02 18:41               ` Andy Lutomirski
2021-09-02 18:57               ` Sean Christopherson
2021-09-02 18:57                 ` Sean Christopherson
2021-09-02 19:07                 ` Dave Hansen
2021-09-02 19:07                   ` Dave Hansen
2021-09-02 20:42                   ` Andy Lutomirski
2021-09-02 20:42                     ` Andy Lutomirski
2021-08-27 22:18   ` Sean Christopherson
2021-08-27 22:18     ` Sean Christopherson
2021-08-31 19:07     ` David Hildenbrand
2021-08-31 19:07       ` David Hildenbrand
2021-08-31 21:54       ` Sean Christopherson
2021-08-31 21:54         ` Sean Christopherson
2021-09-01  8:09         ` David Hildenbrand
2021-09-01  8:09           ` David Hildenbrand
2021-09-01 15:54           ` Andy Lutomirski
2021-09-01 15:54             ` Andy Lutomirski
2021-09-01 16:16             ` David Hildenbrand
2021-09-01 16:16               ` David Hildenbrand
2021-09-01 17:09               ` Andy Lutomirski
2021-09-01 17:09                 ` Andy Lutomirski
2021-09-01 16:18             ` James Bottomley
2021-09-01 16:18               ` James Bottomley
2021-09-01 16:22               ` David Hildenbrand
2021-09-01 16:22                 ` David Hildenbrand
2021-09-01 16:31                 ` James Bottomley
2021-09-01 16:31                   ` James Bottomley
2021-09-01 16:37                   ` David Hildenbrand
2021-09-01 16:37                     ` David Hildenbrand
2021-09-01 16:45                     ` James Bottomley
2021-09-01 16:45                       ` James Bottomley
2021-09-01 17:08                       ` David Hildenbrand
2021-09-01 17:08                         ` David Hildenbrand
2021-09-01 17:50                         ` Sean Christopherson
2021-09-01 17:50                           ` Sean Christopherson
2021-09-01 17:53                           ` David Hildenbrand
2021-09-01 17:53                             ` David Hildenbrand
2021-09-01 17:08               ` Andy Lutomirski
2021-09-01 17:08                 ` Andy Lutomirski
2021-09-01 17:13                 ` James Bottomley
2021-09-01 17:13                   ` James Bottomley
2021-09-02 10:18                 ` Joerg Roedel
2021-09-02 10:18                   ` Joerg Roedel
2021-09-01 18:24               ` Andy Lutomirski
2021-09-01 18:24                 ` Andy Lutomirski
2021-09-01 19:26               ` Dave Hansen
2021-09-01 19:26                 ` Dave Hansen
2021-09-07 15:00               ` Tom Lendacky [this message]
2021-09-07 15:00                 ` Tom Lendacky
2021-09-01  4:58       ` Andy Lutomirski
2021-09-01  4:58         ` Andy Lutomirski
2021-09-01  7:49         ` David Hildenbrand
2021-09-01  7:49           ` David Hildenbrand
2021-09-02 18:47 ` Kirill A. Shutemov
2021-09-02 18:47   ` Kirill A. Shutemov
2021-09-02 20:33   ` Sean Christopherson
2021-09-02 20:33     ` Sean Christopherson
2021-09-03 19:14     ` Kirill A. Shutemov
2021-09-03 19:14       ` Kirill A. Shutemov
2021-09-03 19:15       ` Andy Lutomirski
2021-09-03 19:15         ` Andy Lutomirski
2021-09-10 17:18         ` Kirill A. Shutemov
2021-09-10 17:18           ` Kirill A. Shutemov
2021-09-15 19:58           ` Chao Peng
2021-09-15 19:58             ` Chao Peng
2021-09-15 13:51             ` David Hildenbrand
2021-09-15 13:51               ` David Hildenbrand
2021-09-15 14:29               ` Kirill A. Shutemov
2021-09-15 14:29                 ` Kirill A. Shutemov
2021-09-15 14:59                 ` David Hildenbrand
2021-09-15 14:59                   ` David Hildenbrand
2021-09-15 15:35                   ` David Hildenbrand
2021-09-15 15:35                     ` David Hildenbrand
2021-09-15 20:04                   ` Kirill A. Shutemov
2021-09-15 20:04                     ` Kirill A. Shutemov
2021-09-15 14:11             ` Kirill A. Shutemov
2021-09-15 14:11               ` Kirill A. Shutemov
2021-09-16  7:36               ` Chao Peng
2021-09-16  7:36                 ` Chao Peng
2021-09-16  9:24               ` Paolo Bonzini
2021-09-16  9:24                 ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f9fb2962-4b67-00e6-01e3-48a57d466932@amd.com \
    --to=thomas.lendacky@amd.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=david@redhat.com \
    --cc=dfaggioli@suse.com \
    --cc=jejb@linux.ibm.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=jroedel@suse.de \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=kirill@shutemov.name \
    --cc=kvm@vger.kernel.org \
    --cc=linux-coco@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rientjes@google.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=seanjc@google.com \
    --cc=tglx@linutronix.de \
    --cc=varad.gautam@suse.com \
    --cc=vbabka@suse.cz \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.com \
    --cc=x86@kernel.org \
    --cc=yu.c.zhang@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.