Skip to content

Commit

Permalink
ppc64le: Restrict maxmem to avoid HTAB allocation failure
Browse files Browse the repository at this point in the history
Fixes: kata-containers#363

Signed-off-by: Nitesh Konkar <[email protected]>
  • Loading branch information
nitkon committed Jun 1, 2018
1 parent 329f704 commit 3b20aeb
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions virtcontainers/qemu_ppc64le.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const defaultQemuMachineOptions = "accel=kvm,usb=off"

const defaultPCBridgeBus = "pci.0"

const defaultMemMaxPPC64le = 32256 // Restrict MemMax to 32Gb on PPC64le

var qemuPaths = map[string]string{
QemuPseries: defaultQemuPath,
}
Expand Down Expand Up @@ -103,8 +105,12 @@ func (q *qemuPPC64le) cpuModel() string {

func (q *qemuPPC64le) memoryTopology(memoryMb, hostMemoryMb uint64) govmmQemu.Memory {

// align hostMemoryMb to 256 MB multiples
hostMemoryMb -= (hostMemoryMb % 256)
if hostMemoryMb > defaultMemMaxPPC64le {
hostMemoryMb = defaultMemMaxPPC64le
} else {
// align hostMemoryMb to 256MB multiples
hostMemoryMb -= (hostMemoryMb % 256)
}
return genericMemoryTopology(memoryMb, hostMemoryMb)
}

Expand Down

0 comments on commit 3b20aeb

Please sign in to comment.