KVM: PPC: Do not warn when userspace asked for too big TCE table
authorAlexey Kardashevskiy <aik@ozlabs.ru>
Tue, 28 Jun 2022 08:02:28 +0000 (18:02 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Wed, 29 Jun 2022 09:39:58 +0000 (19:39 +1000)
KVM manages emulated TCE tables for guest LIOBNs by a two level table
which maps up to 128TiB with 16MB IOMMU pages (enabled in QEMU by default)
and MAX_ORDER=11 (the kernel's default). Note that the last level of
the table is allocated when actual TCE is updated.

However these tables are created via ioctl() on kvmfd and the userspace
can trigger WARN_ON_ONCE_GFP(order >= MAX_ORDER, gfp) in mm/page_alloc.c
and flood dmesg.

This adds __GFP_NOWARN.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20220628080228.1508847-1-aik@ozlabs.ru
arch/powerpc/kvm/book3s_64_vio.c

index d6589c4fe8899e0f0c8cb2968f3506cab0a570ca..40864373ef876facf71e828a030001b6d70062df 100644 (file)
@@ -307,7 +307,7 @@ long kvm_vm_ioctl_create_spapr_tce(struct kvm *kvm,
                return ret;
 
        ret = -ENOMEM;
-       stt = kzalloc(struct_size(stt, pages, npages), GFP_KERNEL);
+       stt = kzalloc(struct_size(stt, pages, npages), GFP_KERNEL | __GFP_NOWARN);
        if (!stt)
                goto fail_acct;