]> git.baikalelectronics.ru Git - kernel.git/commit
kvm: avoid page allocation failure in kvm_set_memory_region()
authorIgor Mammedov <imammedo@redhat.com>
Fri, 20 Mar 2015 12:21:37 +0000 (12:21 +0000)
committerMarcelo Tosatti <mtosatti@redhat.com>
Tue, 24 Mar 2015 00:23:44 +0000 (21:23 -0300)
commit5cc32f2282a83cd3e0dae1f97ed4b34211ce0cdf
tree41518f58b292b6abb637edb19fe83f1aaade52d6
parentb82284c3a4e30d3335f99f6400700d9311100167
kvm: avoid page allocation failure in kvm_set_memory_region()

KVM guest can fail to startup with following trace on host:

qemu-system-x86: page allocation failure: order:4, mode:0x40d0
Call Trace:
  dump_stack+0x47/0x67
  warn_alloc_failed+0xee/0x150
  __alloc_pages_direct_compact+0x14a/0x150
  __alloc_pages_nodemask+0x776/0xb80
  alloc_kmem_pages+0x3a/0x110
  kmalloc_order+0x13/0x50
  kmemdup+0x1b/0x40
  __kvm_set_memory_region+0x24a/0x9f0 [kvm]
  kvm_set_ioapic+0x130/0x130 [kvm]
  kvm_set_memory_region+0x21/0x40 [kvm]
  kvm_vm_ioctl+0x43f/0x750 [kvm]

Failure happens when attempting to allocate pages for
'struct kvm_memslots', however it doesn't have to be
present in physically contiguous (kmalloc-ed) address
space, change allocation to kvm_kvzalloc() so that
it will be vmalloc-ed when its size is more then a page.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
virt/kvm/kvm_main.c