From a429677a0b9bd44079744b1a4cbb109959389236 Mon Sep 17 00:00:00 2001 From: Peng Tao Date: Fri, 7 Sep 2018 22:02:47 +0800 Subject: [PATCH] govmm: fix memory prealloc The memory-backend-ram should also be set to a numa node instead of being inserted as a new device. Otherwise it becomes additional memory and requires explicit online to be available, instead of just being a backend of the memory specified by -m option. Signed-off-by: Peng Tao --- qemu/qemu.go | 6 +++--- qemu/qemu_test.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/qemu/qemu.go b/qemu/qemu.go index d2f27f51dc..0b97025da5 100644 --- a/qemu/qemu.go +++ b/qemu/qemu.go @@ -1502,13 +1502,13 @@ func (config *Config) appendMemoryKnobs() { if config.Memory.Size != "" { dimmName := "dimm1" objMemParam := "memory-backend-ram,id=" + dimmName + ",size=" + config.Memory.Size + ",prealloc=on" - deviceMemParam := "pc-dimm,id=" + dimmName + ",memdev=" + dimmName + numaMemParam := "node,memdev=" + dimmName config.qemuParams = append(config.qemuParams, "-object") config.qemuParams = append(config.qemuParams, objMemParam) - config.qemuParams = append(config.qemuParams, "-device") - config.qemuParams = append(config.qemuParams, deviceMemParam) + config.qemuParams = append(config.qemuParams, "-numa") + config.qemuParams = append(config.qemuParams, numaMemParam) } } else if config.Knobs.FileBackedMem == true { if config.Memory.Size != "" && config.Memory.Path != "" { diff --git a/qemu/qemu_test.go b/qemu/qemu_test.go index 7fdaa9bffb..014c58d9c8 100644 --- a/qemu/qemu_test.go +++ b/qemu/qemu_test.go @@ -475,7 +475,7 @@ func TestAppendMemoryMemPrealloc(t *testing.T) { FileBackedMem: true, FileBackedMemShared: true, } - knobsString := "-object memory-backend-ram,id=dimm1,size=1G,prealloc=on -device pc-dimm,id=dimm1,memdev=dimm1" + knobsString := "-object memory-backend-ram,id=dimm1,size=1G,prealloc=on -numa node,memdev=dimm1" mlockFalseString := "-realtime mlock=off" testConfigAppend(conf, knobs, memString+" "+knobsString+" "+mlockFalseString, t)