mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
block: make available VIRTIO_BLK_F_SEG_MAX
This allows the guest to put in more than one segment per request. It can improve the throughput of the system. Introduce a new check to make sure the queue size configured by the user is large enough to hold at least one segment. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
@@ -14,6 +14,7 @@ use option_parser::{
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use thiserror::Error;
|
||||
use virtio_devices::block::MINIMUM_BLOCK_QUEUE_SIZE;
|
||||
use virtio_devices::{RateLimiterConfig, TokenBucketConfig};
|
||||
|
||||
use crate::landlock::LandlockAccess;
|
||||
@@ -168,6 +169,8 @@ pub enum ValidationError {
|
||||
TdxFirmwareMissing,
|
||||
/// Insufficient vCPUs for queues
|
||||
TooManyQueues,
|
||||
/// Invalid queue size
|
||||
InvalidQueueSize(u16),
|
||||
/// Need shared memory for vfio-user
|
||||
UserDevicesRequireSharedMemory,
|
||||
/// VSOCK Context Identifier has a special meaning, unsuitable for a VM.
|
||||
@@ -273,6 +276,12 @@ impl fmt::Display for ValidationError {
|
||||
TooManyQueues => {
|
||||
write!(f, "Number of vCPUs is insufficient for number of queues")
|
||||
}
|
||||
InvalidQueueSize(s) => {
|
||||
write!(
|
||||
f,
|
||||
"Queue size is smaller than {MINIMUM_BLOCK_QUEUE_SIZE}: {s}"
|
||||
)
|
||||
}
|
||||
UserDevicesRequireSharedMemory => {
|
||||
write!(
|
||||
f,
|
||||
@@ -1307,6 +1316,10 @@ impl DiskConfig {
|
||||
return Err(ValidationError::TooManyQueues);
|
||||
}
|
||||
|
||||
if self.queue_size <= MINIMUM_BLOCK_QUEUE_SIZE {
|
||||
return Err(ValidationError::InvalidQueueSize(self.queue_size));
|
||||
}
|
||||
|
||||
if self.vhost_user && self.iommu {
|
||||
return Err(ValidationError::IommuNotSupported);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user