machine/linux: Use memory-backend-memfd by default
This is prep for using virtiofsd; it has no real impact otherwise. Signed-off-by: Colin Walters <walters@verbum.org>
This commit is contained in:
parent
0e57573d1e
commit
406f130590
|
|
@ -35,8 +35,10 @@ func NewQemuBuilder(binary string, options []string) QemuCmd {
|
|||
|
||||
// SetMemory adds the specified amount of memory for the machine
|
||||
func (q *QemuCmd) SetMemory(m strongunits.MiB) {
|
||||
// qemu accepts the memory in MiB
|
||||
*q = append(*q, "-m", strconv.FormatUint(uint64(m), 10))
|
||||
serializedMem := strconv.FormatUint(uint64(m), 10)
|
||||
// In order to use virtiofsd, we must enable shared memory
|
||||
*q = append(*q, "-object", fmt.Sprintf("memory-backend-memfd,id=mem,size=%sM,share=on", serializedMem))
|
||||
*q = append(*q, "-m", serializedMem)
|
||||
}
|
||||
|
||||
// SetCPUs adds the number of CPUs the machine will have
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ func (q *QEMUStubber) addArchOptions(_ *setNewMachineCMDOpts) []string {
|
|||
opts := []string{
|
||||
"-accel", "kvm",
|
||||
"-cpu", "host",
|
||||
"-M", "memory-backend=mem",
|
||||
}
|
||||
return opts
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ func (q *QEMUStubber) addArchOptions(_ *setNewMachineCMDOpts) []string {
|
|||
opts := []string{
|
||||
"-accel", "kvm",
|
||||
"-cpu", "host",
|
||||
"-M", "virt,gic-version=max",
|
||||
"-M", "virt,gic-version=max,memory-backend=mem",
|
||||
"-bios", getQemuUefiFile("QEMU_EFI.fd"),
|
||||
}
|
||||
return opts
|
||||
|
|
|
|||
Loading…
Reference in New Issue