On 07/09/21 19:30, Sean Christopherson wrote:
The allocation in question is for KVM's "rmap" to translate a guest pfn to a host virtual address. The size of the rmap in question is an unsigned long per 4kb page in a memslot, i.e. on x86-64, 8 bytes per 4096 bytes of guest memory in a memslot. With INT_MAX=0x7fffffff, KVM will trip the WARN and fail rmap allocations for memslots >= 1tb, and Google already has VMs that create 1.5tb memslots (12tb of total guest memory spread across 8 virtual NUMA nodes).
We can just use vmalloc. The warning was only added on kvmalloc, and vmalloc suits the KVM rmap just fine.
The maximum that Red Hat has tested, as far as I know, is about 4TiB (and it was back when there was no support for virtual NUMA nodes in QEMU, so it was all in a single memslot).
Paolo