mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-28 03:42:09 +00:00
runtime: remove enable_swap option
`enable_swap` option was added long time ago to add `-realtime mlock=off` to the QEMU's command line. Kata now supports QEMU 6, `-realtime` option has been deprecated and `mlock=on` is causing unexpected behaviors in kata. This patch removes support for `enable_swap`, `-realtime` and `mlock=` since they are causing bugs in kata. Signed-off-by: Julio Montes <julio.montes@intel.com>
This commit is contained in:
parent
41e0c414a4
commit
49223e67af
@ -56,7 +56,6 @@ There are several kinds of Kata configurations and they are listed below.
|
||||
| `io.katacontainers.config.hypervisor.enable_iommu` | `boolean` | enable `iommu` on Q35 (QEMU x86_64) |
|
||||
| `io.katacontainers.config.hypervisor.enable_iothreads` | `boolean`| enable IO to be processed in a separate thread. Supported currently for virtio-`scsi` driver |
|
||||
| `io.katacontainers.config.hypervisor.enable_mem_prealloc` | `boolean` | the memory space used for `nvdimm` device by the hypervisor |
|
||||
| `io.katacontainers.config.hypervisor.enable_swap` | `boolean` | enable swap of VM memory |
|
||||
| `io.katacontainers.config.hypervisor.enable_vhost_user_store` | `boolean` | enable vhost-user storage device (QEMU) |
|
||||
| `io.katacontainers.config.hypervisor.enable_virtio_mem` | `boolean` | enable virtio-mem (QEMU) |
|
||||
| `io.katacontainers.config.hypervisor.entropy_source` (R) | string| the path to a host source of entropy (`/dev/random`, `/dev/urandom` or real hardware RNG device) |
|
||||
|
@ -361,7 +361,6 @@ USER_VARS += CONFIG_PATH
|
||||
USER_VARS += CONFIG_QEMU_IN
|
||||
USER_VARS += DESTDIR
|
||||
USER_VARS += DEFAULT_HYPERVISOR
|
||||
USER_VARS += DEFENABLEMSWAP
|
||||
USER_VARS += ACRNCMD
|
||||
USER_VARS += ACRNCTLCMD
|
||||
USER_VARS += ACRNPATH
|
||||
|
@ -153,10 +153,6 @@ block_device_driver = "@DEFBLOCKSTORAGEDRIVER_FC@"
|
||||
# command line: intel_iommu=on,iommu=pt
|
||||
#enable_iommu = true
|
||||
|
||||
# Enable swap of vm memory. Default false.
|
||||
# The behaviour is undefined if mem_prealloc is also set to true
|
||||
#enable_swap = true
|
||||
|
||||
# This option changes the default hypervisor and kernel parameters
|
||||
# to enable debug output where available.
|
||||
#
|
||||
|
@ -250,10 +250,6 @@ valid_vhost_user_store_paths = @DEFVALIDVHOSTUSERSTOREPATHS@
|
||||
# Your distribution recommends: @DEFVALIDFILEMEMBACKENDS@
|
||||
valid_file_mem_backends = @DEFVALIDFILEMEMBACKENDS@
|
||||
|
||||
# Enable swap of vm memory. Default false.
|
||||
# The behaviour is undefined if mem_prealloc is also set to true
|
||||
#enable_swap = true
|
||||
|
||||
# -pflash can add image file to VM. The arguments of it should be in format
|
||||
# of ["/path/to/flash0.img", "/path/to/flash1.img"]
|
||||
pflashes = []
|
||||
|
@ -71,7 +71,6 @@ const defaultEnableHugePages bool = false
|
||||
const defaultEnableIOMMU bool = false
|
||||
const defaultEnableIOMMUPlatform bool = false
|
||||
const defaultFileBackedMemRootDir string = ""
|
||||
const defaultEnableSwap bool = false
|
||||
const defaultEnableDebug bool = false
|
||||
const defaultDisableNestingChecks bool = false
|
||||
const defaultMsize9p uint32 = 8192
|
||||
|
@ -123,7 +123,6 @@ type hypervisor struct {
|
||||
VirtioMem bool `toml:"enable_virtio_mem"`
|
||||
IOMMU bool `toml:"enable_iommu"`
|
||||
IOMMUPlatform bool `toml:"enable_iommu_platform"`
|
||||
Swap bool `toml:"enable_swap"`
|
||||
Debug bool `toml:"enable_debug"`
|
||||
DisableNestingChecks bool `toml:"disable_nesting_checks"`
|
||||
EnableIOThreads bool `toml:"enable_iothreads"`
|
||||
@ -554,7 +553,6 @@ func newFirecrackerHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
||||
DefaultBridges: h.defaultBridges(),
|
||||
DisableBlockDeviceUse: h.DisableBlockDeviceUse,
|
||||
HugePages: h.HugePages,
|
||||
Mlock: !h.Swap,
|
||||
Debug: h.Debug,
|
||||
DisableNestingChecks: h.DisableNestingChecks,
|
||||
BlockDeviceDriver: blockDriver,
|
||||
@ -672,7 +670,6 @@ func newQemuHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
||||
IOMMUPlatform: h.getIOMMUPlatform(),
|
||||
FileBackedMemRootDir: h.FileBackedMemRootDir,
|
||||
FileBackedMemRootList: h.FileBackedMemRootList,
|
||||
Mlock: !h.Swap,
|
||||
Debug: h.Debug,
|
||||
DisableNestingChecks: h.DisableNestingChecks,
|
||||
BlockDeviceDriver: blockDriver,
|
||||
@ -755,7 +752,6 @@ func newAcrnHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
||||
EntropySourceList: h.EntropySourceList,
|
||||
DefaultBridges: h.defaultBridges(),
|
||||
HugePages: h.HugePages,
|
||||
Mlock: !h.Swap,
|
||||
Debug: h.Debug,
|
||||
DisableNestingChecks: h.DisableNestingChecks,
|
||||
BlockDeviceDriver: blockDriver,
|
||||
@ -841,7 +837,6 @@ func newClhHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
||||
HugePages: h.HugePages,
|
||||
FileBackedMemRootDir: h.FileBackedMemRootDir,
|
||||
FileBackedMemRootList: h.FileBackedMemRootList,
|
||||
Mlock: !h.Swap,
|
||||
Debug: h.Debug,
|
||||
DisableNestingChecks: h.DisableNestingChecks,
|
||||
BlockDeviceDriver: blockDriver,
|
||||
@ -1022,7 +1017,6 @@ func GetDefaultHypervisorConfig() vc.HypervisorConfig {
|
||||
IOMMU: defaultEnableIOMMU,
|
||||
IOMMUPlatform: defaultEnableIOMMUPlatform,
|
||||
FileBackedMemRootDir: defaultFileBackedMemRootDir,
|
||||
Mlock: !defaultEnableSwap,
|
||||
Debug: defaultEnableDebug,
|
||||
DisableNestingChecks: defaultDisableNestingChecks,
|
||||
BlockDeviceDriver: defaultBlockDeviceDriver,
|
||||
|
@ -155,7 +155,6 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
|
||||
DisableBlockDeviceUse: disableBlockDevice,
|
||||
BlockDeviceDriver: defaultBlockDeviceDriver,
|
||||
DefaultBridges: defaultBridgesCount,
|
||||
Mlock: !defaultEnableSwap,
|
||||
EnableIOThreads: enableIOThreads,
|
||||
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
||||
PCIeRootPort: pcieRootPort,
|
||||
@ -563,7 +562,6 @@ func TestMinimalRuntimeConfig(t *testing.T) {
|
||||
MemorySize: defaultMemSize,
|
||||
DisableBlockDeviceUse: defaultDisableBlockDeviceUse,
|
||||
DefaultBridges: defaultBridgesCount,
|
||||
Mlock: !defaultEnableSwap,
|
||||
BlockDeviceDriver: defaultBlockDeviceDriver,
|
||||
Msize9p: defaultMsize9p,
|
||||
GuestHookPath: defaultGuestHookPath,
|
||||
|
@ -566,15 +566,6 @@ func addHypervisorMemoryOverrides(ocispec specs.Spec, sbConfig *vc.SandboxConfig
|
||||
return err
|
||||
}
|
||||
|
||||
if value, ok := ocispec.Annotations[vcAnnotations.EnableSwap]; ok {
|
||||
enableSwap, err := strconv.ParseBool(value)
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error parsing annotation for enable_swap: Please specify boolean value 'true|false'")
|
||||
}
|
||||
|
||||
sbConfig.HypervisorConfig.Mlock = !enableSwap
|
||||
}
|
||||
|
||||
if value, ok := ocispec.Annotations[vcAnnotations.FileBackedMemRootDir]; ok {
|
||||
if !checkPathIsInGlobs(runtime.HypervisorConfig.FileBackedMemRootList, value) {
|
||||
return fmt.Errorf("file_mem_backend value %v required from annotation is not valid", value)
|
||||
|
@ -650,7 +650,6 @@ func TestAddHypervisorAnnotations(t *testing.T) {
|
||||
ocispec.Annotations[vcAnnotations.MemOffset] = "512"
|
||||
ocispec.Annotations[vcAnnotations.VirtioMem] = "true"
|
||||
ocispec.Annotations[vcAnnotations.MemPrealloc] = "true"
|
||||
ocispec.Annotations[vcAnnotations.EnableSwap] = "true"
|
||||
ocispec.Annotations[vcAnnotations.FileBackedMemRootDir] = "/dev/shm"
|
||||
ocispec.Annotations[vcAnnotations.HugePages] = "true"
|
||||
ocispec.Annotations[vcAnnotations.IOMMU] = "true"
|
||||
@ -687,7 +686,6 @@ func TestAddHypervisorAnnotations(t *testing.T) {
|
||||
assert.Equal(config.HypervisorConfig.MemOffset, uint64(512))
|
||||
assert.Equal(config.HypervisorConfig.VirtioMem, true)
|
||||
assert.Equal(config.HypervisorConfig.MemPrealloc, true)
|
||||
assert.Equal(config.HypervisorConfig.Mlock, false)
|
||||
assert.Equal(config.HypervisorConfig.FileBackedMemRootDir, "/dev/shm")
|
||||
assert.Equal(config.HypervisorConfig.HugePages, true)
|
||||
assert.Equal(config.HypervisorConfig.IOMMU, true)
|
||||
|
@ -277,14 +277,6 @@ type HypervisorConfig struct {
|
||||
// IOMMUPlatform is used to indicate if IOMMU_PLATFORM is enabled for supported devices
|
||||
IOMMUPlatform bool
|
||||
|
||||
// Realtime Used to enable/disable realtime
|
||||
Realtime bool
|
||||
|
||||
// Mlock is used to control memory locking when Realtime is enabled
|
||||
// Realtime=true and Mlock=false, allows for swapping out of VM memory
|
||||
// enabling higher density
|
||||
Mlock bool
|
||||
|
||||
// DisableNestingChecks is used to override customizations performed
|
||||
// when running on top of another VMM.
|
||||
DisableNestingChecks bool
|
||||
|
@ -263,7 +263,6 @@ func TestFactoryGetVM(t *testing.T) {
|
||||
assert.Nil(err)
|
||||
|
||||
// checkConfig fall back
|
||||
vmConfig.HypervisorConfig.Mlock = true
|
||||
vm, err = f.GetVM(ctx, vmConfig)
|
||||
assert.Nil(err)
|
||||
|
||||
|
@ -469,14 +469,6 @@ type HypervisorConfig struct {
|
||||
// IOMMUPlatform is used to indicate if IOMMU_PLATFORM is enabled for supported devices
|
||||
IOMMUPlatform bool
|
||||
|
||||
// Realtime Used to enable/disable realtime
|
||||
Realtime bool
|
||||
|
||||
// Mlock is used to control memory locking when Realtime is enabled
|
||||
// Realtime=true and Mlock=false, allows for swapping out of VM memory
|
||||
// enabling higher density
|
||||
Mlock bool
|
||||
|
||||
// DisableNestingChecks is used to override customizations performed
|
||||
// when running on top of another VMM.
|
||||
DisableNestingChecks bool
|
||||
|
@ -239,8 +239,6 @@ func (s *Sandbox) dumpConfig(ss *persistapi.SandboxState) {
|
||||
HugePages: sconfig.HypervisorConfig.HugePages,
|
||||
FileBackedMemRootDir: sconfig.HypervisorConfig.FileBackedMemRootDir,
|
||||
FileBackedMemRootList: sconfig.HypervisorConfig.FileBackedMemRootList,
|
||||
Realtime: sconfig.HypervisorConfig.Realtime,
|
||||
Mlock: sconfig.HypervisorConfig.Mlock,
|
||||
DisableNestingChecks: sconfig.HypervisorConfig.DisableNestingChecks,
|
||||
DisableImageNvdimm: sconfig.HypervisorConfig.DisableImageNvdimm,
|
||||
HotplugVFIOOnRootBus: sconfig.HypervisorConfig.HotplugVFIOOnRootBus,
|
||||
@ -508,8 +506,6 @@ func loadSandboxConfig(id string) (*SandboxConfig, error) {
|
||||
HugePages: hconf.HugePages,
|
||||
FileBackedMemRootDir: hconf.FileBackedMemRootDir,
|
||||
FileBackedMemRootList: hconf.FileBackedMemRootList,
|
||||
Realtime: hconf.Realtime,
|
||||
Mlock: hconf.Mlock,
|
||||
DisableNestingChecks: hconf.DisableNestingChecks,
|
||||
DisableImageNvdimm: hconf.DisableImageNvdimm,
|
||||
HotplugVFIOOnRootBus: hconf.HotplugVFIOOnRootBus,
|
||||
|
@ -184,14 +184,6 @@ type HypervisorConfig struct {
|
||||
// VirtioMem is used to enable/disable virtio-mem
|
||||
VirtioMem bool
|
||||
|
||||
// Realtime Used to enable/disable realtime
|
||||
Realtime bool
|
||||
|
||||
// Mlock is used to control memory locking when Realtime is enabled
|
||||
// Realtime=true and Mlock=false, allows for swapping out of VM memory
|
||||
// enabling higher density
|
||||
Mlock bool
|
||||
|
||||
// DisableNestingChecks is used to override customizations performed
|
||||
// when running on top of another VMM.
|
||||
DisableNestingChecks bool
|
||||
|
@ -152,10 +152,6 @@ const (
|
||||
// MemPrealloc is a sandbox annotation that specifies the memory space used for nvdimm device by the hypervisor.
|
||||
MemPrealloc = kataAnnotHypervisorPrefix + "enable_mem_prealloc"
|
||||
|
||||
// EnableSwap is a sandbox annotation to enable swap of vm memory.
|
||||
// The behaviour is undefined if mem_prealloc is also set to true
|
||||
EnableSwap = kataAnnotHypervisorPrefix + "enable_swap"
|
||||
|
||||
// HugePages is a sandbox annotation to specify if the memory should be pre-allocated from huge pages
|
||||
HugePages = kataAnnotHypervisorPrefix + "enable_hugepages"
|
||||
|
||||
|
@ -500,8 +500,6 @@ func (q *qemu) CreateVM(ctx context.Context, id string, networkNS NetworkNamespa
|
||||
Daemonize: true,
|
||||
MemPrealloc: q.config.MemPrealloc,
|
||||
HugePages: q.config.HugePages,
|
||||
Realtime: q.config.Realtime,
|
||||
Mlock: q.config.Mlock,
|
||||
IOMMUPlatform: q.config.IOMMUPlatform,
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user