mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-04 02:56:18 +00:00
virtcontainers: Set ppc64le maxmem depending on qemu version
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 <niteshkonkar@in.ibm.com>
This commit is contained in:
parent
3f31643452
commit
d0bccabbe1
@ -64,6 +64,9 @@ const qmpCapErrMsg = "Failed to negoatiate QMP capabilities"
|
|||||||
|
|
||||||
const defaultConsole = "console.sock"
|
const defaultConsole = "console.sock"
|
||||||
|
|
||||||
|
var qemuMajorVersion int
|
||||||
|
var qemuMinorVersion int
|
||||||
|
|
||||||
// agnostic list of kernel parameters
|
// agnostic list of kernel parameters
|
||||||
var defaultKernelParameters = []Param{
|
var defaultKernelParameters = []Param{
|
||||||
{"panic", "1"},
|
{"panic", "1"},
|
||||||
@ -509,6 +512,8 @@ func (q *qemu) waitSandbox(timeout int) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
q.qmpMonitorCh.qmp = qmp
|
q.qmpMonitorCh.qmp = qmp
|
||||||
|
qemuMajorVersion = ver.Major
|
||||||
|
qemuMinorVersion = ver.Minor
|
||||||
|
|
||||||
q.Logger().WithFields(logrus.Fields{
|
q.Logger().WithFields(logrus.Fields{
|
||||||
"qmp-major-version": ver.Major,
|
"qmp-major-version": ver.Major,
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
govmmQemu "github.com/intel/govmm/qemu"
|
govmmQemu "github.com/intel/govmm/qemu"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/device/drivers"
|
"github.com/kata-containers/runtime/virtcontainers/device/drivers"
|
||||||
"github.com/kata-containers/runtime/virtcontainers/utils"
|
"github.com/kata-containers/runtime/virtcontainers/utils"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
type qemuPPC64le struct {
|
type qemuPPC64le struct {
|
||||||
@ -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
|
// MaxQemuVCPUs returns the maximum number of vCPUs supported
|
||||||
func MaxQemuVCPUs() uint32 {
|
func MaxQemuVCPUs() uint32 {
|
||||||
return uint32(128)
|
return uint32(128)
|
||||||
@ -105,12 +111,14 @@ func (q *qemuPPC64le) cpuModel() string {
|
|||||||
|
|
||||||
func (q *qemuPPC64le) memoryTopology(memoryMb, hostMemoryMb uint64) govmmQemu.Memory {
|
func (q *qemuPPC64le) memoryTopology(memoryMb, hostMemoryMb uint64) govmmQemu.Memory {
|
||||||
|
|
||||||
if hostMemoryMb > defaultMemMaxPPC64le {
|
if qemuMajorVersion >= 2 && qemuMinorVersion >= 10 {
|
||||||
hostMemoryMb = defaultMemMaxPPC64le
|
q.Logger().Debug("Aligning maxmem to multiples of 256MB. Assumption: Kernel Version >= 4.11")
|
||||||
} else {
|
|
||||||
// align hostMemoryMb to 256MB multiples
|
|
||||||
hostMemoryMb -= (hostMemoryMb % 256)
|
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)
|
return genericMemoryTopology(memoryMb, hostMemoryMb)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user