mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-09 20:58:55 +00:00
Merge pull request #4051 from bergwolf/github/vmx-vm-factory
enable vmx for vm factory
This commit is contained in:
@@ -38,14 +38,11 @@ const (
|
|||||||
|
|
||||||
defaultQemuMachineOptions = "accel=kvm,kernel_irqchip=on"
|
defaultQemuMachineOptions = "accel=kvm,kernel_irqchip=on"
|
||||||
|
|
||||||
|
splitIrqChipMachineOptions = "accel=kvm,kernel_irqchip=split"
|
||||||
|
|
||||||
qmpMigrationWaitTimeout = 5 * time.Second
|
qmpMigrationWaitTimeout = 5 * time.Second
|
||||||
)
|
)
|
||||||
|
|
||||||
var qemuPaths = map[string]string{
|
|
||||||
QemuQ35: defaultQemuPath,
|
|
||||||
QemuMicrovm: defaultQemuPath,
|
|
||||||
}
|
|
||||||
|
|
||||||
var kernelParams = []Param{
|
var kernelParams = []Param{
|
||||||
{"tsc", "reliable"},
|
{"tsc", "reliable"},
|
||||||
{"no_timer_check", ""},
|
{"no_timer_check", ""},
|
||||||
@@ -101,7 +98,7 @@ func newQemuArch(config HypervisorConfig) (qemuArch, error) {
|
|||||||
// IOMMU and Guest Protection require a split IRQ controller for handling interrupts
|
// IOMMU and Guest Protection require a split IRQ controller for handling interrupts
|
||||||
// otherwise QEMU won't be able to create the kernel irqchip
|
// otherwise QEMU won't be able to create the kernel irqchip
|
||||||
if config.IOMMU || config.ConfidentialGuest {
|
if config.IOMMU || config.ConfidentialGuest {
|
||||||
mp.Options = "accel=kvm,kernel_irqchip=split"
|
mp.Options = splitIrqChipMachineOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.IOMMU {
|
if config.IOMMU {
|
||||||
@@ -114,7 +111,7 @@ func newQemuArch(config HypervisorConfig) (qemuArch, error) {
|
|||||||
q := &qemuAmd64{
|
q := &qemuAmd64{
|
||||||
qemuArchBase: qemuArchBase{
|
qemuArchBase: qemuArchBase{
|
||||||
qemuMachine: *mp,
|
qemuMachine: *mp,
|
||||||
qemuExePath: qemuPaths[machineType],
|
qemuExePath: defaultQemuPath,
|
||||||
memoryOffset: config.MemOffset,
|
memoryOffset: config.MemOffset,
|
||||||
kernelParamsNonDebug: kernelParamsNonDebug,
|
kernelParamsNonDebug: kernelParamsNonDebug,
|
||||||
kernelParamsDebug: kernelParamsDebug,
|
kernelParamsDebug: kernelParamsDebug,
|
||||||
@@ -172,19 +169,6 @@ func (q *qemuAmd64) bridges(number uint32) {
|
|||||||
q.Bridges = genericBridges(number, q.qemuMachine.Type)
|
q.Bridges = genericBridges(number, q.qemuMachine.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *qemuAmd64) cpuModel() string {
|
|
||||||
cpuModel := defaultCPUModel
|
|
||||||
|
|
||||||
// VMX is not migratable yet.
|
|
||||||
// issue: https://github.com/kata-containers/runtime/issues/1750
|
|
||||||
if q.vmFactory {
|
|
||||||
hvLogger.WithField("subsystem", "qemuAmd64").Warn("VMX is not migratable yet: turning it off")
|
|
||||||
cpuModel += ",vmx=off"
|
|
||||||
}
|
|
||||||
|
|
||||||
return cpuModel
|
|
||||||
}
|
|
||||||
|
|
||||||
func (q *qemuAmd64) memoryTopology(memoryMb, hostMemoryMb uint64, slots uint8) govmmQemu.Memory {
|
func (q *qemuAmd64) memoryTopology(memoryMb, hostMemoryMb uint64, slots uint8) govmmQemu.Memory {
|
||||||
return genericMemoryTopology(memoryMb, hostMemoryMb, slots, q.memoryOffset)
|
return genericMemoryTopology(memoryMb, hostMemoryMb, slots, q.memoryOffset)
|
||||||
}
|
}
|
||||||
|
@@ -87,7 +87,7 @@ func TestQemuAmd64CPUModel(t *testing.T) {
|
|||||||
base, ok := amd64.(*qemuAmd64)
|
base, ok := amd64.(*qemuAmd64)
|
||||||
assert.True(ok)
|
assert.True(ok)
|
||||||
base.vmFactory = true
|
base.vmFactory = true
|
||||||
expectedOut = defaultCPUModel + ",vmx=off"
|
expectedOut = defaultCPUModel
|
||||||
model = amd64.cpuModel()
|
model = amd64.cpuModel()
|
||||||
assert.Equal(expectedOut, model)
|
assert.Equal(expectedOut, model)
|
||||||
}
|
}
|
||||||
|
@@ -114,10 +114,6 @@ func (q *qemuPPC64le) bridges(number uint32) {
|
|||||||
q.Bridges = genericBridges(number, q.qemuMachine.Type)
|
q.Bridges = genericBridges(number, q.qemuMachine.Type)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *qemuPPC64le) cpuModel() string {
|
|
||||||
return defaultCPUModel
|
|
||||||
}
|
|
||||||
|
|
||||||
func (q *qemuPPC64le) memoryTopology(memoryMb, hostMemoryMb uint64, slots uint8) govmmQemu.Memory {
|
func (q *qemuPPC64le) memoryTopology(memoryMb, hostMemoryMb uint64, slots uint8) govmmQemu.Memory {
|
||||||
|
|
||||||
q.Logger().Debug("Aligning maxmem to multiples of 256MB. Assumption: Kernel Version >= 4.11")
|
q.Logger().Debug("Aligning maxmem to multiples of 256MB. Assumption: Kernel Version >= 4.11")
|
||||||
|
Reference in New Issue
Block a user