mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 08:47:56 +00:00
virtiofs: Add cache size option
Add VirtioFSCacheSize aka virtio_fs_cache_size option to set the size (in MiB) of the DAX cache. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
This commit is contained in:
parent
82d1a9d6f4
commit
6767c1a358
4
Makefile
4
Makefile
@ -158,6 +158,8 @@ DEFENTROPYSOURCE := /dev/urandom
|
|||||||
DEFDISABLEBLOCK := false
|
DEFDISABLEBLOCK := false
|
||||||
DEFSHAREDFS := virtio-9p
|
DEFSHAREDFS := virtio-9p
|
||||||
DEFVIRTIOFSDAEMON :=
|
DEFVIRTIOFSDAEMON :=
|
||||||
|
# Default DAX mapping cache size in MiB
|
||||||
|
DEFVIRTIOFSCACHESIZE := 8192
|
||||||
DEFENABLEIOTHREADS := false
|
DEFENABLEIOTHREADS := false
|
||||||
DEFENABLEMEMPREALLOC := false
|
DEFENABLEMEMPREALLOC := false
|
||||||
DEFENABLEHUGEPAGES := false
|
DEFENABLEHUGEPAGES := false
|
||||||
@ -324,6 +326,7 @@ USER_VARS += DEFBLOCKSTORAGEDRIVER_FC
|
|||||||
USER_VARS += DEFBLOCKSTORAGEDRIVER_QEMU
|
USER_VARS += DEFBLOCKSTORAGEDRIVER_QEMU
|
||||||
USER_VARS += DEFSHAREDFS
|
USER_VARS += DEFSHAREDFS
|
||||||
USER_VARS += DEFVIRTIOFSDAEMON
|
USER_VARS += DEFVIRTIOFSDAEMON
|
||||||
|
USER_VARS += DEFVIRTIOFSCACHESIZE
|
||||||
USER_VARS += DEFENABLEIOTHREADS
|
USER_VARS += DEFENABLEIOTHREADS
|
||||||
USER_VARS += DEFENABLEMEMPREALLOC
|
USER_VARS += DEFENABLEMEMPREALLOC
|
||||||
USER_VARS += DEFENABLEHUGEPAGES
|
USER_VARS += DEFENABLEHUGEPAGES
|
||||||
@ -462,6 +465,7 @@ $(GENERATED_FILES): %: %.in $(MAKEFILE_LIST) VERSION .git-commit
|
|||||||
-e "s|@DEFBLOCKSTORAGEDRIVER_QEMU@|$(DEFBLOCKSTORAGEDRIVER_QEMU)|g" \
|
-e "s|@DEFBLOCKSTORAGEDRIVER_QEMU@|$(DEFBLOCKSTORAGEDRIVER_QEMU)|g" \
|
||||||
-e "s|@DEFSHAREDFS@|$(DEFSHAREDFS)|g" \
|
-e "s|@DEFSHAREDFS@|$(DEFSHAREDFS)|g" \
|
||||||
-e "s|@DEFVIRTIOFSDAEMON@|$(DEFVIRTIOFSDAEMON)|g" \
|
-e "s|@DEFVIRTIOFSDAEMON@|$(DEFVIRTIOFSDAEMON)|g" \
|
||||||
|
-e "s|@DEFVIRTIOFSCACHESIZE@|$(DEFVIRTIOFSCACHESIZE)|g" \
|
||||||
-e "s|@DEFENABLEIOTHREADS@|$(DEFENABLEIOTHREADS)|g" \
|
-e "s|@DEFENABLEIOTHREADS@|$(DEFENABLEIOTHREADS)|g" \
|
||||||
-e "s|@DEFENABLEMEMPREALLOC@|$(DEFENABLEMEMPREALLOC)|g" \
|
-e "s|@DEFENABLEMEMPREALLOC@|$(DEFENABLEMEMPREALLOC)|g" \
|
||||||
-e "s|@DEFENABLEHUGEPAGES@|$(DEFENABLEHUGEPAGES)|g" \
|
-e "s|@DEFENABLEHUGEPAGES@|$(DEFENABLEHUGEPAGES)|g" \
|
||||||
|
@ -105,6 +105,9 @@ shared_fs = "@DEFSHAREDFS@"
|
|||||||
# Path to vhost-user-fs daemon.
|
# Path to vhost-user-fs daemon.
|
||||||
virtio_fs_daemon = "@DEFVIRTIOFSDAEMON@"
|
virtio_fs_daemon = "@DEFVIRTIOFSDAEMON@"
|
||||||
|
|
||||||
|
# Default size of DAX cache in MiB
|
||||||
|
virtio_fs_cache_size = @DEFVIRTIOFSCACHESIZE@
|
||||||
|
|
||||||
# Block storage driver to be used for the hypervisor in case the container
|
# Block storage driver to be used for the hypervisor in case the container
|
||||||
# rootfs is backed by a block device. This is virtio-scsi, virtio-blk
|
# rootfs is backed by a block device. This is virtio-scsi, virtio-blk
|
||||||
# or nvdimm.
|
# or nvdimm.
|
||||||
|
@ -94,6 +94,7 @@ type hypervisor struct {
|
|||||||
EntropySource string `toml:"entropy_source"`
|
EntropySource string `toml:"entropy_source"`
|
||||||
SharedFS string `toml:"shared_fs"`
|
SharedFS string `toml:"shared_fs"`
|
||||||
VirtioFSDaemon string `toml:"virtio_fs_daemon"`
|
VirtioFSDaemon string `toml:"virtio_fs_daemon"`
|
||||||
|
VirtioFSCacheSize uint32 `toml:"virtio_fs_cache_size"`
|
||||||
BlockDeviceCacheSet bool `toml:"block_device_cache_set"`
|
BlockDeviceCacheSet bool `toml:"block_device_cache_set"`
|
||||||
BlockDeviceCacheDirect bool `toml:"block_device_cache_direct"`
|
BlockDeviceCacheDirect bool `toml:"block_device_cache_direct"`
|
||||||
BlockDeviceCacheNoflush bool `toml:"block_device_cache_noflush"`
|
BlockDeviceCacheNoflush bool `toml:"block_device_cache_noflush"`
|
||||||
@ -578,6 +579,7 @@ func newQemuHypervisorConfig(h hypervisor) (vc.HypervisorConfig, error) {
|
|||||||
DisableBlockDeviceUse: h.DisableBlockDeviceUse,
|
DisableBlockDeviceUse: h.DisableBlockDeviceUse,
|
||||||
SharedFS: sharedFS,
|
SharedFS: sharedFS,
|
||||||
VirtioFSDaemon: h.VirtioFSDaemon,
|
VirtioFSDaemon: h.VirtioFSDaemon,
|
||||||
|
VirtioFSCacheSize: h.VirtioFSCacheSize,
|
||||||
MemPrealloc: h.MemPrealloc,
|
MemPrealloc: h.MemPrealloc,
|
||||||
HugePages: h.HugePages,
|
HugePages: h.HugePages,
|
||||||
Mlock: !h.Swap,
|
Mlock: !h.Swap,
|
||||||
|
@ -188,6 +188,7 @@ type VhostUserDeviceAttrs struct {
|
|||||||
|
|
||||||
// These are only meaningful for vhost user fs devices
|
// These are only meaningful for vhost user fs devices
|
||||||
Tag string
|
Tag string
|
||||||
|
CacheSize uint32
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetHostPathFunc is function pointer used to mock GetHostPath in tests.
|
// GetHostPathFunc is function pointer used to mock GetHostPath in tests.
|
||||||
|
@ -146,6 +146,9 @@ type HypervisorConfig struct {
|
|||||||
// VirtioFSDaemon is the virtio-fs vhost-user daemon path
|
// VirtioFSDaemon is the virtio-fs vhost-user daemon path
|
||||||
VirtioFSDaemon string
|
VirtioFSDaemon string
|
||||||
|
|
||||||
|
// VirtioFSCacheSize is the virtio-fs DAX cache size in MiB
|
||||||
|
VirtioFSCacheSize uint32
|
||||||
|
|
||||||
// KernelParams are additional guest kernel parameters.
|
// KernelParams are additional guest kernel parameters.
|
||||||
KernelParams []Param
|
KernelParams []Param
|
||||||
|
|
||||||
|
@ -170,6 +170,9 @@ type HypervisorConfig struct {
|
|||||||
// MemOffset specifies memory space for nvdimm device
|
// MemOffset specifies memory space for nvdimm device
|
||||||
MemOffset uint32
|
MemOffset uint32
|
||||||
|
|
||||||
|
// VirtioFSCacheSize is the DAX cache size in MiB
|
||||||
|
VirtioFSCacheSize uint32
|
||||||
|
|
||||||
// KernelParams are additional guest kernel parameters.
|
// KernelParams are additional guest kernel parameters.
|
||||||
KernelParams []Param
|
KernelParams []Param
|
||||||
|
|
||||||
|
@ -1378,6 +1378,7 @@ func (q *qemu) addDevice(devInfo interface{}, devType deviceType) error {
|
|||||||
vhostDev := config.VhostUserDeviceAttrs{
|
vhostDev := config.VhostUserDeviceAttrs{
|
||||||
Tag: v.MountTag,
|
Tag: v.MountTag,
|
||||||
Type: config.VhostUserFS,
|
Type: config.VhostUserFS,
|
||||||
|
CacheSize: q.config.VirtioFSCacheSize,
|
||||||
}
|
}
|
||||||
vhostDev.SocketPath = sockPath
|
vhostDev.SocketPath = sockPath
|
||||||
vhostDev.DevID = id
|
vhostDev.DevID = id
|
||||||
|
@ -530,6 +530,7 @@ func (q *qemuArchBase) appendVhostUserDevice(devices []govmmQemu.Device, attr co
|
|||||||
case config.VhostUserFS:
|
case config.VhostUserFS:
|
||||||
qemuVhostUserDevice.TypeDevID = utils.MakeNameID("fs", attr.DevID, maxDevIDSize)
|
qemuVhostUserDevice.TypeDevID = utils.MakeNameID("fs", attr.DevID, maxDevIDSize)
|
||||||
qemuVhostUserDevice.Tag = attr.Tag
|
qemuVhostUserDevice.Tag = attr.Tag
|
||||||
|
qemuVhostUserDevice.CacheSize = attr.CacheSize
|
||||||
}
|
}
|
||||||
|
|
||||||
qemuVhostUserDevice.VhostUserType = govmmQemu.DeviceDriver(attr.Type)
|
qemuVhostUserDevice.VhostUserType = govmmQemu.DeviceDriver(attr.Type)
|
||||||
|
Loading…
Reference in New Issue
Block a user