Re: RFC: A KVM-specific alternative to UserfaultFD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Nov 7, 2023 at 5:27 PM Oliver Upton <oliver.upton@xxxxxxxxx> wrote:
>
> On Tue, Nov 07, 2023 at 01:34:34PM -0800, David Matlack wrote:
> > On Tue, Nov 7, 2023 at 1:10 PM Oliver Upton <oliver.upton@xxxxxxxxx> wrote:
> > Thanks Oliver. Maybe I'm being dense but I'm still not understanding
> > how VGIC and UFFD interact :). I understand that VGIC is unaware of
> > UFFD, but fundamentally they must interact in some way during
> > post-copy. Can you spell out the sequence of events?
>
> Well it doesn't help that my abbreviated explanation glosses over some
> details. So here's the verbose explanation, and I'm sure Marc will have
> a set of corrections too :) I meant there's no _explicit_ interaction
> between UFFD and the various bits of GIC that need to touch guest
> memory.
>
> The GIC redistributors contain a set of MMIO registers that are
> accessible through the KVM_GET_DEVICE_ATTR and KVM_SET_DEVICE_ATTR
> ioctls. Writes to these are reflected directly into the KVM
> representation, no biggie there.
>
> One of the registers (GICR_PENDBASER) is a pointer to guest memory,
> containing a bitmap of pending LPIs managed by the redistributor. The
> ITS takes this to the extreme, as it is effectively a bunch of page
> tables for interrupts. All of this state actually lives in a KVM
> representation, and is only flushed out to guest memory when explicitly
> told to do so by userspace.
>
> On the target, we reread all the info when rebuilding interrupt
> translations when userspace calls KVM_DEV_ARM_ITS_RESTORE_TABLES. All of
> these guest memory accesses go through kvm_read_guest() and I expect the
> usual UFFD handling for non-present pages kicks in from there.

Thanks for the longer explanation. Yes kvm_read_guest() eventually
calls __copy_from_user() which will trigger a page fault and
UserfaultFD will notify userspace and wait for the page to become
present. In the KVM-specific proposal I outlined, calling
kvm_read_guest() will ultimately result in a check of the VM's present
bitmap and KVM will nnotify userspace and wait for the page to become
present if it's not, before calling __copy_from_user(). So I don't
expect a KVM-specific solution to have any increased maintenance
burden for VGIC (or any other widgets).





[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux