Dave Jiang <[email protected]> wrote:
> This RFC series is created as a proof of concept to connect device DAX to 
> guest
> memory by riding on top of guest memfd in order to prove out that device DAX
> can be used as guest memory. The series seeks to jump start a discussion on
> if there are interests in creating a DAX bridge to utilize CXL memory for 
> guest
> memory until the N_PRIVATE implementation by Gregory [1] is available upstream
> and DAX users are ready to move to the new scheme. Once there's an established
> consensus of interest, we can move the discussion to the best way to implement
> the DAX bridge and the future of device DAX as guest.
> 
> I did the bare minimal to get the PoC to pass a modified version of KVM gmem
> selftest (guest_memfd_test) in order to prove out that DAX can go in the gmem
> path. A DAX char dev is created and the fd is passed in user space with
> vm_set_user_memory_region2(). The DAX region is passed in as a whole when used
> unlike memfd where any size can be passed in to be allocated.
> 
> The folks on the cc line are people that Dan Williams has mentioned that may 
> be
> of interest to this.
> 
> [1]: 
> https://lore.kernel.org/linux-cxl/aeWV1CvP9ImZ3eEG@gourry-fedora-PF4VCD3F/T/#t

One of the main ideas behind guest_memfd is that the memory is managed
by the kernel only, so it knows what it has and that it can trust
the memory. This RFC passes an fd in via the ioctl(), which I think
breaks that model.

Since there is interest for several different allocation backends
(default, hugetlb, zone_device), it might be better to use a model
where guest_memfd has the option for backend allocators to register
themselves in the kernel. The ioctl can then select one by their
id/name (could be just a string). They can be configured using
e.g. sysfs (like hugetlb already is).

This would also allow easy experimentation with new allocators,
having an allocator with BPF control, etc.

- Frank

Reply via email to