diff options
author | Igor Mammedov <imammedo@redhat.com> | 2015-07-02 09:08:11 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2015-07-13 16:17:19 -0400 |
commit | c9ce42f72fd0ba180fd35539829e4139dca31494 (patch) | |
tree | f92250cbd4a9760cb8b69cd349c5e4ee9033b0e8 | |
parent | 4de7255f7d2be5e51664c6ac6011ffd6e5463571 (diff) |
vhost: add max_mem_regions module parameter
it became possible to use a bigger amount of memory
slots, which is used by memory hotplug for
registering hotplugged memory.
However QEMU crashes if it's used with more than ~60
pc-dimm devices and vhost-net enabled since host kernel
in module vhost-net refuses to accept more than 64
memory regions.
Allow to tweak limit via max_mem_regions module paramemter
with default value set to 64 slots.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-rw-r--r-- | drivers/vhost/vhost.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index a4ac369f6adb..a9fe859f43c8 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -30,8 +30,12 @@ | |||
30 | 30 | ||
31 | #include "vhost.h" | 31 | #include "vhost.h" |
32 | 32 | ||
33 | static ushort max_mem_regions = 64; | ||
34 | module_param(max_mem_regions, ushort, 0444); | ||
35 | MODULE_PARM_DESC(max_mem_regions, | ||
36 | "Maximum number of memory regions in memory map. (default: 64)"); | ||
37 | |||
33 | enum { | 38 | enum { |
34 | VHOST_MEMORY_MAX_NREGIONS = 64, | ||
35 | VHOST_MEMORY_F_LOG = 0x1, | 39 | VHOST_MEMORY_F_LOG = 0x1, |
36 | }; | 40 | }; |
37 | 41 | ||
@@ -697,7 +701,7 @@ static long vhost_set_memory(struct vhost_dev *d, struct vhost_memory __user *m) | |||
697 | return -EFAULT; | 701 | return -EFAULT; |
698 | if (mem.padding) | 702 | if (mem.padding) |
699 | return -EOPNOTSUPP; | 703 | return -EOPNOTSUPP; |
700 | if (mem.nregions > VHOST_MEMORY_MAX_NREGIONS) | 704 | if (mem.nregions > max_mem_regions) |
701 | return -E2BIG; | 705 | return -E2BIG; |
702 | newmem = vhost_kvzalloc(size + mem.nregions * sizeof(*m->regions)); | 706 | newmem = vhost_kvzalloc(size + mem.nregions * sizeof(*m->regions)); |
703 | if (!newmem) | 707 | if (!newmem) |