Re: [PATCH v3 03/70] RAMBlock/guest_memfd: Enable KVM_GUEST_MEMFD_ALLOW_HUGEPAGE

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

 



On 30.11.23 18:51, Daniel P. Berrangé wrote:
On Thu, Nov 30, 2023 at 05:54:26PM +0100, David Hildenbrand wrote:
On 30.11.23 17:01, Sean Christopherson wrote:
On Thu, Nov 30, 2023, David Hildenbrand wrote:
On 30.11.23 08:32, Xiaoyao Li wrote:
On 11/20/2023 5:26 PM, David Hildenbrand wrote:

... did you shamelessly copy that from hw/virtio/virtio-mem.c ? ;)

Get caught.

This should be factored out into a common helper.

Sure, will do it in next version.

Factor it out in a separate patch. Then, this patch is get small that
you can just squash it into #2.

And my comment regarding "flags = 0" to patch #2 does no longer apply :)


I see.

But it depends on if KVM_GUEST_MEMFD_ALLOW_HUGEPAGE will appear together
with initial guest memfd in linux (hopefully 6.8)
https://lore.kernel.org/all/CABgObfa=DH7FySBviF63OS9sVog_wt-AqYgtUAGKqnY5Bizivw@xxxxxxxxxxxxxx/


Doesn't seem to be in -next if I am looking at the right tree:

https://git.kernel.org/pub/scm/virt/kvm/kvm.git/log/?h=next

Yeah, we punted on adding hugepage support for the initial guest_memfd merge so
as not to rush in kludgy uABI.  The internal KVM code isn't problematic, we just
haven't figured out exactly what the ABI should look like, e.g. should hugepages
be dependent on THP being enabled, and if not, how does userspace discover the
supported hugepage sizes?

Are we talking about THP or hugetlb? They are two different things, and
"KVM_GUEST_MEMFD_ALLOW_HUGEPAGE" doesn't make it clearer what we are talking
about.

This patch here "get_thp_size()" indicates that we care about THP, not
hugetlb.


THP lives in:
	/sys/kernel/mm/transparent_hugepage/
and hugetlb in:
	/sys/kernel/mm/hugepages/

THP for shmem+anon currently really only supports PMD-sized THP, that size
can be observed via:
	/sys/kernel/mm/transparent_hugepage/hpage_pmd_size

hugetlb sizes can be detected simply by looking at the folders inside
/sys/kernel/mm/hugepages/. "tools/testing/selftests/mm/vm_util.c" in the
kernel has a function "detect_hugetlb_page_sizes()" that uses that interface
to detect the sizes.


But likely we want THP support here. Because for hugetlb, one would actually
have to instruct the kernel which size to use, like we do for memfd with
hugetlb.

Would we not want both ultimately ?

Likely we want both somehow, although I am not sure how to obtain either cleanly and fully.

My question is targeted at what the current interface/implementation promises, and how it relates to both, THP and hugetlb.

--
Cheers,

David / dhildenb





[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