Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-06-24 Thread Michael Roth
On Fri, Jun 24, 2022 at 04:54:26PM +0800, Chao Peng wrote: > On Thu, Jun 23, 2022 at 05:59:49PM -0500, Michael Roth wrote: > > On Fri, May 20, 2022 at 06:31:02PM +, Sean Christopherson wrote: > > > On Fri, May 20, 2022, Andy Lutomirski wrote: > > > > The alternative would be to have some kind o

Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-06-24 Thread Chao Peng
On Thu, Jun 23, 2022 at 05:59:49PM -0500, Michael Roth wrote: > On Fri, May 20, 2022 at 06:31:02PM +, Sean Christopherson wrote: > > On Fri, May 20, 2022, Andy Lutomirski wrote: > > > The alternative would be to have some kind of separate table or bitmap > > > (part > > > of the memslot?) that

Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-06-23 Thread Michael Roth
On Fri, May 20, 2022 at 06:31:02PM +, Sean Christopherson wrote: > On Fri, May 20, 2022, Andy Lutomirski wrote: > > The alternative would be to have some kind of separate table or bitmap (part > > of the memslot?) that tells KVM whether a GPA should map to the fd. > > > > What do you all think

Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-06-20 Thread Chao Peng
On Fri, Jun 17, 2022 at 09:27:25PM +, Sean Christopherson wrote: > On Fri, Jun 17, 2022, Sean Christopherson wrote: > > > @@ -110,6 +133,7 @@ struct kvm_userspace_memory_region { > > > */ > > > #define KVM_MEM_LOG_DIRTY_PAGES (1UL << 0) > > > #define KVM_MEM_READONLY (1UL << 1) > > > +#def

Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-06-20 Thread Chao Peng
On Fri, Jun 17, 2022 at 08:52:15PM +, Sean Christopherson wrote: > On Thu, May 19, 2022, Chao Peng wrote: > > @@ -653,12 +662,12 @@ struct kvm_irq_routing_table { > > }; > > #endif > > > > -#ifndef KVM_PRIVATE_MEM_SLOTS > > -#define KVM_PRIVATE_MEM_SLOTS 0 > > +#ifndef KVM_INTERNAL_MEM_SLOT

Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-06-17 Thread Sean Christopherson
On Fri, Jun 17, 2022, Sean Christopherson wrote: > > @@ -110,6 +133,7 @@ struct kvm_userspace_memory_region { > > */ > > #define KVM_MEM_LOG_DIRTY_PAGES(1UL << 0) > > #define KVM_MEM_READONLY (1UL << 1) > > +#define KVM_MEM_PRIVATE(1UL << 2) > > Hmm, KVM_MEM_PRIVATE is techni

Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-06-17 Thread Sean Christopherson
On Thu, May 19, 2022, Chao Peng wrote: > @@ -653,12 +662,12 @@ struct kvm_irq_routing_table { > }; > #endif > > -#ifndef KVM_PRIVATE_MEM_SLOTS > -#define KVM_PRIVATE_MEM_SLOTS 0 > +#ifndef KVM_INTERNAL_MEM_SLOTS > +#define KVM_INTERNAL_MEM_SLOTS 0 > #endif This rename belongs in a separate pa

Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-06-13 Thread Chao Peng
On Fri, Jun 10, 2022 at 04:14:21PM +, Sean Christopherson wrote: > On Mon, May 30, 2022, Chao Peng wrote: > > On Mon, May 23, 2022 at 03:22:32PM +, Sean Christopherson wrote: > > > Actually, if the semantics are that userspace declares memory as private, > > > then we > > > can reuse KVM_M

Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-06-10 Thread Sean Christopherson
On Mon, May 30, 2022, Chao Peng wrote: > On Mon, May 23, 2022 at 03:22:32PM +, Sean Christopherson wrote: > > Actually, if the semantics are that userspace declares memory as private, > > then we > > can reuse KVM_MEMORY_ENCRYPT_REG_REGION and > > KVM_MEMORY_ENCRYPT_UNREG_REGION. It'd > > be

Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-05-30 Thread Chao Peng
On Mon, May 23, 2022 at 03:22:32PM +, Sean Christopherson wrote: > On Mon, May 23, 2022, Chao Peng wrote: > > On Fri, May 20, 2022 at 06:31:02PM +, Sean Christopherson wrote: > > > On Fri, May 20, 2022, Andy Lutomirski wrote: > > > > The alternative would be to have some kind of separate ta

Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-05-23 Thread Sean Christopherson
On Mon, May 23, 2022, Chao Peng wrote: > On Fri, May 20, 2022 at 06:31:02PM +, Sean Christopherson wrote: > > On Fri, May 20, 2022, Andy Lutomirski wrote: > > > The alternative would be to have some kind of separate table or bitmap > > > (part > > > of the memslot?) that tells KVM whether a GP

Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-05-23 Thread Chao Peng
On Fri, May 20, 2022 at 06:31:02PM +, Sean Christopherson wrote: > On Fri, May 20, 2022, Andy Lutomirski wrote: > > The alternative would be to have some kind of separate table or bitmap (part > > of the memslot?) that tells KVM whether a GPA should map to the fd. > > > > What do you all think

Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-05-21 Thread Andy Lutomirski
On Fri, May 20, 2022, at 11:31 AM, Sean Christopherson wrote: > But a dedicated KVM ioctl() to add/remove shared ranges would be easy > to implement > and wouldn't necessarily even need to interact with the memslots. It > could be a > consumer of memslots, e.g. if we wanted to disallow regis

Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-05-20 Thread Sean Christopherson
On Fri, May 20, 2022, Andy Lutomirski wrote: > The alternative would be to have some kind of separate table or bitmap (part > of the memslot?) that tells KVM whether a GPA should map to the fd. > > What do you all think? My original proposal was to have expolicit shared vs. private memslots, and

Re: [PATCH v6 4/8] KVM: Extend the memslot to support fd-based private memory

2022-05-20 Thread Andy Lutomirski
On 5/19/22 08:37, Chao Peng wrote: Extend the memslot definition to provide guest private memory through a file descriptor(fd) instead of userspace_addr(hva). Such guest private memory(fd) may never be mapped into userspace so no userspace_addr(hva) can be used. Instead add another two new fields