runtime: Support virtiofs queue size for qemu and make it configurable

The default vhost-user-fs queue-size of qemu is 128 now. Set it to 1024
by default which is same as clh. Also make this value configurable.

Fixes: #5694

Signed-off-by: liyuxuan.darfux <liyuxuan.darfux@bytedance.com>
This commit is contained in:
liyuxuan.darfux
2022-11-18 14:24:36 +08:00
parent b8dbb35bb7
commit 3bb145c63a
10 changed files with 27 additions and 1 deletions

View File

@@ -1587,6 +1587,9 @@ func (clh *cloudHypervisor) addVolume(volume types.Volume) error {
// default values defined by cloud-hypervisor
numQueues := int32(1)
queueSize := int32(1024)
if clh.config.VirtioFSQueueSize != 0 {
queueSize = int32(clh.config.VirtioFSQueueSize)
}
fs := chclient.NewFsConfig(volume.MountTag, vfsdSockPath, numQueues, queueSize)
clh.vmconfig.Fs = &[]chclient.FsConfig{*fs}

View File

@@ -467,6 +467,9 @@ type HypervisorConfig struct {
// VirtioFSCacheSize is the DAX cache size in MiB
VirtioFSCacheSize uint32
// Size of virtqueues
VirtioFSQueueSize uint32
// User ID.
Uid uint32

View File

@@ -2080,6 +2080,7 @@ func (q *qemu) AddDevice(ctx context.Context, devInfo interface{}, devType Devic
Type: config.VhostUserFS,
CacheSize: q.config.VirtioFSCacheSize,
Cache: q.config.VirtioFSCache,
QueueSize: q.config.VirtioFSQueueSize,
}
vhostDev.SocketPath = sockPath
vhostDev.DevID = id

View File

@@ -663,6 +663,7 @@ func (q *qemuArchBase) appendVhostUserDevice(ctx context.Context, devices []govm
qemuVhostUserDevice.TypeDevID = utils.MakeNameID("fs", attr.DevID, maxDevIDSize)
qemuVhostUserDevice.Tag = attr.Tag
qemuVhostUserDevice.CacheSize = attr.CacheSize
qemuVhostUserDevice.QueueSize = attr.QueueSize
qemuVhostUserDevice.VhostUserType = govmmQemu.VhostUserFS
}