[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v8 2/8] KVM: Extend the memslot to support fd-based private m
From: |
Jarkko Sakkinen |
Subject: |
Re: [PATCH v8 2/8] KVM: Extend the memslot to support fd-based private memory |
Date: |
Fri, 7 Oct 2022 14:14:03 +0300 |
On Thu, Oct 06, 2022 at 03:34:58PM +0000, Sean Christopherson wrote:
> On Thu, Oct 06, 2022, Jarkko Sakkinen wrote:
> > On Thu, Oct 06, 2022 at 05:58:03PM +0300, Jarkko Sakkinen wrote:
> > > On Thu, Sep 15, 2022 at 10:29:07PM +0800, Chao Peng wrote:
> > > > This new extension, indicated by the new flag KVM_MEM_PRIVATE, adds two
> > > > additional KVM memslot fields private_fd/private_offset to allow
> > > > userspace to specify that guest private memory provided from the
> > > > private_fd and guest_phys_addr mapped at the private_offset of the
> > > > private_fd, spanning a range of memory_size.
> > > >
> > > > The extended memslot can still have the userspace_addr(hva). When use, a
> > > > single memslot can maintain both private memory through private
> > > > fd(private_fd/private_offset) and shared memory through
> > > > hva(userspace_addr). Whether the private or shared part is visible to
> > > > guest is maintained by other KVM code.
> > >
> > > What is anyway the appeal of private_offset field, instead of having just
> > > 1:1 association between regions and files, i.e. one memfd per region?
>
> Modifying memslots is slow, both in KVM and in QEMU (not sure about Google's
> VMM).
> E.g. if a vCPU converts a single page, it will be forced to wait until all
> other
> vCPUs drop SRCU, which can have severe latency spikes, e.g. if KVM is
> faulting in
> memory. KVM's memslot updates also hold a mutex for the entire duration of
> the
> update, i.e. conversions on different vCPUs would be fully serialized,
> exacerbating
> the SRCU problem.
>
> KVM also has historical baggage where it "needs" to zap _all_ SPTEs when any
> memslot is deleted.
>
> Taking both a private_fd and a shared userspace address allows userspace to
> convert
> between private and shared without having to manipulate memslots.
Right, this was really good explanation, thank you.
Still wondering could this possibly work (or not):
1. Union userspace_addr and private_fd.
2. Instead of introducing private_offset, use guest_phys_addr as the
offset.
BR, Jarkko
- Re: [PATCH v8 2/8] KVM: Extend the memslot to support fd-based private memory, Jarkko Sakkinen, 2022/10/05
- Re: [PATCH v8 2/8] KVM: Extend the memslot to support fd-based private memory, Fuad Tabba, 2022/10/06
- Re: [PATCH v8 2/8] KVM: Extend the memslot to support fd-based private memory, Jarkko Sakkinen, 2022/10/06
- Re: [PATCH v8 2/8] KVM: Extend the memslot to support fd-based private memory, Jarkko Sakkinen, 2022/10/06
- Re: [PATCH v8 2/8] KVM: Extend the memslot to support fd-based private memory, Sean Christopherson, 2022/10/06
- Re: [PATCH v8 2/8] KVM: Extend the memslot to support fd-based private memory,
Jarkko Sakkinen <=
- Re: [PATCH v8 2/8] KVM: Extend the memslot to support fd-based private memory, Sean Christopherson, 2022/10/07
- Re: [PATCH v8 2/8] KVM: Extend the memslot to support fd-based private memory, Jarkko Sakkinen, 2022/10/07
- Re: [PATCH v8 2/8] KVM: Extend the memslot to support fd-based private memory, Jarkko Sakkinen, 2022/10/08
- Re: [PATCH v8 2/8] KVM: Extend the memslot to support fd-based private memory, Jarkko Sakkinen, 2022/10/08
- Re: [PATCH v8 2/8] KVM: Extend the memslot to support fd-based private memory, Chao Peng, 2022/10/10
- Re: [PATCH v8 2/8] KVM: Extend the memslot to support fd-based private memory, Jarkko Sakkinen, 2022/10/12