linux-coco.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Chao Peng <chao.p.peng@linux.intel.com>,
	"Kirill A. Shutemov" <kirill@shutemov.name>
Cc: Andy Lutomirski <luto@kernel.org>,
	Sean Christopherson <seanjc@google.com>,
	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@vger.kernel.org, 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>,
	Tom Lendacky <thomas.lendacky@amd.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Varad Gautam <varad.gautam@suse.com>,
	Dario Faggioli <dfaggioli@suse.com>,
	x86@kernel.org, linux-mm@kvack.org, linux-coco@lists.linux.dev,
	"Kirill A . Shutemov" <kirill.shutemov@linux.intel.com>,
	Kuppuswamy Sathyanarayanan
	<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: Wed, 15 Sep 2021 15:51:25 +0200	[thread overview]
Message-ID: <51a6f74f-6c05-74b9-3fd7-b7cd900fb8cc@redhat.com> (raw)
In-Reply-To: <20210915195857.GA52522@chaop.bj.intel.com>

>> diff --git a/mm/memfd.c b/mm/memfd.c
>> index 081dd33e6a61..ae43454789f4 100644
>> --- a/mm/memfd.c
>> +++ b/mm/memfd.c
>> @@ -130,11 +130,24 @@ static unsigned int *memfd_file_seals_ptr(struct file *file)
>>   	return NULL;
>>   }
>>   
>> +int memfd_register_guest(struct inode *inode, void *owner,
>> +			 const struct guest_ops *guest_ops,
>> +			 const struct guest_mem_ops **guest_mem_ops)
>> +{
>> +	if (shmem_mapping(inode->i_mapping)) {
>> +		return shmem_register_guest(inode, owner,
>> +					    guest_ops, guest_mem_ops);
>> +	}
>> +
>> +	return -EINVAL;
>> +}
> 
> Are we stick our design to memfd interface (e.g other memory backing
> stores like tmpfs and hugetlbfs will all rely on this memfd interface to
> interact with KVM), or this is just the initial implementation for PoC?

I don't think we are, it still feels like we are in the early prototype 
phase (even way before a PoC). I'd be happy to see something "cleaner" 
so to say -- it still feels kind of hacky to me, especially there seem 
to be many pieces of the big puzzle missing so far. Unfortunately, this 
series hasn't caught the attention of many -MM people so far, maybe 
because other people miss the big picture as well and are waiting for a 
complete design proposal.

For example, what's unclear to me: we'll be allocating pages with 
GFP_HIGHUSER_MOVABLE, making them land on MIGRATE_CMA or ZONE_MOVABLE; 
then we silently turn them unmovable, which breaks these concepts. Who'd 
migrate these pages away just like when doing long-term pinning, or how 
is that supposed to work?

Also unclear to me is how refcount and mapcount will be handled to 
prevent swapping, who will actually do some kind of gfn-epfn etc. 
mapping, how we'll forbid access to this memory e.g., via /proc/kcore or 
when dumping memory ... and how it would ever work with 
migration/swapping/rmap (it's clearly future work, but it's been raised 
that this would be the way to make it work, I don't quite see how it 
would all come together).

<note>
Last but not least, I raised to Intel via a different channel that I'd 
appreciate updated hardware that avoids essentially crashing the 
hypervisor when writing to encrypted memory from user space. It has the 
smell of "broken hardware" to it that might just be fixed by a new 
hardware generation to make it look more similar to other successful 
implementations of secure/encrypted memory. That might it much easier to 
support an initial version of TDX -- instead of having to reinvent the 
way we map guest memory just now to support hardware that might sort out 
the root problem later.

Having that said, there might be benefits to mapping guest memory 
differently, but my gut feeling is that it might take quite a long time 
to get something reasonable working, to settle on a design, and to get 
it accepted by all involved parties to merge it upstream.

Just my 2 cents, I might be all wrong as so often.
<\note>

-- 
Thanks,

David / dhildenb


  reply	other threads:[~2021-09-15 13:51 UTC|newest]

Thread overview: 71+ 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 10:48 ` Yu Zhang
2021-08-26  0:35   ` Sean Christopherson
2021-08-26 13:23     ` Yu Zhang
2021-08-26 10:15 ` David Hildenbrand
2021-08-26 17:05   ` Andy Lutomirski
2021-08-26 21:26     ` David Hildenbrand
2021-08-27 18:24       ` Andy Lutomirski
2021-08-27 22:28         ` Sean Christopherson
2021-08-31 19:12           ` David Hildenbrand
2021-08-31 20:45             ` Sean Christopherson
2021-09-01  7:51               ` David Hildenbrand
2021-08-27  2:31   ` Yu Zhang
2021-08-31 19:08     ` David Hildenbrand
2021-08-31 20:01       ` Andi Kleen
2021-08-31 20:15         ` David Hildenbrand
2021-08-31 20:39           ` Andi Kleen
2021-09-01  3:34             ` Yu Zhang
2021-09-01  4:53     ` Andy Lutomirski
2021-09-01  7:12       ` Tian, Kevin
2021-09-01 10:24       ` Yu Zhang
2021-09-01 16:07         ` Andy Lutomirski
2021-09-01 16:27           ` David Hildenbrand
2021-09-02  8:34             ` Yu Zhang
2021-09-02  8:44               ` David Hildenbrand
2021-09-02 11:02                 ` Yu Zhang
2021-09-02  8:19           ` Yu Zhang
2021-09-02 18:41             ` Andy Lutomirski
2021-09-07  1:33             ` Yan Zhao
2021-09-02  9:27           ` Joerg Roedel
2021-09-02 18:41             ` Andy Lutomirski
2021-09-02 18:57               ` Sean Christopherson
2021-09-02 19:07                 ` Dave Hansen
2021-09-02 20:42                   ` Andy Lutomirski
2021-08-27 22:18   ` Sean Christopherson
2021-08-31 19:07     ` David Hildenbrand
2021-08-31 21:54       ` Sean Christopherson
2021-09-01  8:09         ` David Hildenbrand
2021-09-01 15:54           ` Andy Lutomirski
2021-09-01 16:16             ` David Hildenbrand
2021-09-01 17:09               ` Andy Lutomirski
2021-09-01 16:18             ` James Bottomley
2021-09-01 16:22               ` David Hildenbrand
2021-09-01 16:31                 ` James Bottomley
2021-09-01 16:37                   ` David Hildenbrand
2021-09-01 16:45                     ` James Bottomley
2021-09-01 17:08                       ` David Hildenbrand
2021-09-01 17:50                         ` Sean Christopherson
2021-09-01 17:53                           ` David Hildenbrand
2021-09-01 17:08               ` Andy Lutomirski
2021-09-01 17:13                 ` James Bottomley
2021-09-02 10:18                 ` Joerg Roedel
2021-09-01 18:24               ` Andy Lutomirski
2021-09-01 19:26               ` Dave Hansen
2021-09-07 15:00               ` Tom Lendacky
2021-09-01  4:58       ` Andy Lutomirski
2021-09-01  7:49         ` David Hildenbrand
2021-09-02 18:47 ` Kirill A. Shutemov
2021-09-02 20:33   ` Sean Christopherson
2021-09-03 19:14     ` Kirill A. Shutemov
2021-09-03 19:15       ` Andy Lutomirski
2021-09-10 17:18         ` Kirill A. Shutemov
2021-09-15 19:58           ` Chao Peng
2021-09-15 13:51             ` David Hildenbrand [this message]
2021-09-15 14:29               ` Kirill A. Shutemov
2021-09-15 14:59                 ` David Hildenbrand
2021-09-15 15:35                   ` David Hildenbrand
2021-09-15 20:04                   ` Kirill A. Shutemov
2021-09-15 14:11             ` Kirill A. Shutemov
2021-09-16  7:36               ` Chao Peng
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=51a6f74f-6c05-74b9-3fd7-b7cd900fb8cc@redhat.com \
    --to=david@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=chao.p.peng@linux.intel.com \
    --cc=dave.hansen@intel.com \
    --cc=dfaggioli@suse.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=thomas.lendacky@amd.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).