qemu-discuss
[Top][All Lists]
Advanced

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

Why are physically contiguous memory allocations failing in Guest OS?


From: Jason Tongen
Subject: Why are physically contiguous memory allocations failing in Guest OS?
Date: Thu, 18 Nov 2021 16:55:13 -0600

Hello,
I'm running a Windows 10 guest on kvm64 CPU.  I'm experimenting with authoring a kernel driver within the guest that's calling MmAllocateContiguousMemory(), which (as is fairly obvious from the name) is allocating page-locked physically contiguous memory.  I'm seeing that these allocations start to fail at very small allocation sizes (1 - 10 MB) in my setup, much smaller than would fail on real HW.  Similar allocations without the contiguous requirement succeed for very large allocations (many GB, as expected).  I have not tried Linux guests running the same experiment, but I assume I'd observe similar results.
I'm assuming qemu+kvm are requiring this allocation request to also be contiguous within the host, possibly to support PCIe passthrough cases.  Is that accurate?  Can anyone point me in the direction of the qemu code where this policy is?
Do I have any way to influence the maximum contiguous size that'll succeed?  I think I'm ideally looking for a command-line flag that'd influence the policy such that guest contiguous requests weren't necessarily allocated contiguous in the host, even if it meant PCIe passthrough would not work (that is not an important use case to me).
Any ideas or leads are appreciated, thanks in advance.

Jason

reply via email to

[Prev in Thread] Current Thread [Next in Thread]