Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
virtcontainers: Set ppc64le maxmem depending on qemu version
Browse files Browse the repository at this point in the history
The "Failed to allocate HTAB of requested size,
try with smaller maxmem" error in ppc64le occurs
when maxmem allocated is very high. This got fixed
in qemu 2.10 and kernel 4.11. Hence put a maxmem
restriction of 32GB per kata-container if qemu
version less than 2.10

Fixes: #415

Signed-off-by: Nitesh Konkar <[email protected]>
  • Loading branch information
nitkon authored and Eric Ernst committed Aug 23, 2018
1 parent 3dda260 commit d10b1d8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions virtcontainers/qemu.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ const qmpSocket = "qmp.sock"

const defaultConsole = "console.sock"

var qemuMajorVersion int
var qemuMinorVersion int

// agnostic list of kernel parameters
var defaultKernelParameters = []Param{
{"panic", "1"},
Expand Down Expand Up @@ -456,6 +459,8 @@ func (q *qemu) waitSandbox(timeout int) error {
}

q.qmpMonitorCh.qmp = qmp
qemuMajorVersion = ver.Major
qemuMinorVersion = ver.Minor

q.Logger().WithFields(logrus.Fields{
"qmp-major-version": ver.Major,
Expand Down
16 changes: 12 additions & 4 deletions virtcontainers/qemu_ppc64le.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
govmmQemu "github.com/intel/govmm/qemu"
"github.com/kata-containers/runtime/virtcontainers/device/drivers"
"github.com/kata-containers/runtime/virtcontainers/utils"
"github.com/sirupsen/logrus"
)

type qemuPPC64le struct {
Expand Down Expand Up @@ -54,6 +55,11 @@ var supportedQemuMachines = []govmmQemu.Machine{
},
}

// Logger returns a logrus logger appropriate for logging qemu messages
func (q *qemuPPC64le) Logger() *logrus.Entry {
return virtLog.WithField("subsystem", "qemu")
}

// MaxQemuVCPUs returns the maximum number of vCPUs supported
func MaxQemuVCPUs() uint32 {
return uint32(128)
Expand Down Expand Up @@ -105,12 +111,14 @@ func (q *qemuPPC64le) cpuModel() string {

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

if hostMemoryMb > defaultMemMaxPPC64le {
hostMemoryMb = defaultMemMaxPPC64le
} else {
// align hostMemoryMb to 256MB multiples
if qemuMajorVersion >= 2 && qemuMinorVersion >= 10 {
q.Logger().Debug("Aligning maxmem to multiples of 256MB. Assumption: Kernel Version >= 4.11")
hostMemoryMb -= (hostMemoryMb % 256)
} else {
q.Logger().Debug("Restricting maxmem to 32GB as Qemu Version < 2.10, Assumption: Kernel Version >= 4.11")
hostMemoryMb = defaultMemMaxPPC64le
}

return genericMemoryTopology(memoryMb, hostMemoryMb)
}

Expand Down

0 comments on commit d10b1d8

Please sign in to comment.