vmm, config, vhost_user_blk: remove "wce" parameter

This config option provided very little value and instead we now enable
this feature (which then lets the guest control the cache mode)
unconditionally.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2020-05-20 17:39:30 +01:00 committed by Samuel Ortiz
parent 9101bdd7a9
commit af8292b623
7 changed files with 13 additions and 39 deletions

View File

@ -76,7 +76,7 @@ VMs run in client mode. They connect to the socket created by the `dpdkvhostuser
--memory size=1024M,file=/dev/hugepages \ --memory size=1024M,file=/dev/hugepages \
--kernel linux/arch/x86/boot/compressed/vmlinux.bin \ --kernel linux/arch/x86/boot/compressed/vmlinux.bin \
--cmdline "console=ttyS0 reboot=k panic=1 nomodules i8042.noaux i8042.nomux i8042.nopnp i8042.dumbkbd root=/dev/vda3 iommu=off" \ --cmdline "console=ttyS0 reboot=k panic=1 nomodules i8042.noaux i8042.nomux i8042.nopnp i8042.dumbkbd root=/dev/vda3 iommu=off" \
--disk "path=images/clear-kvm.img" "num_queues=4,queue_size=128,vhost_user=true,socket=/var/tmp/vhost.1,wce=true" \ --disk "path=images/clear-kvm.img" "num_queues=4,queue_size=128,vhost_user=true,socket=/var/tmp/vhost.1" \
--console off \ --console off \
--serial tty \ --serial tty \
--rng --rng

View File

@ -763,14 +763,14 @@ mod unit_tests {
"--memory", "--memory",
"shared=true", "shared=true",
"--disk", "--disk",
"vhost_user=true,socket=/tmp/socket1,wce=true", "vhost_user=true,socket=/tmp/socket1",
"path=/path/to/disk/2", "path=/path/to/disk/2",
], ],
r#"{ r#"{
"kernel": {"path": "/path/to/kernel"}, "kernel": {"path": "/path/to/kernel"},
"memory" : { "shared": true, "size": 536870912 }, "memory" : { "shared": true, "size": 536870912 },
"disks": [ "disks": [
{"vhost_user":true, "vhost_socket":"/tmp/socket1", "wce":true}, {"vhost_user":true, "vhost_socket":"/tmp/socket1"},
{"path": "/path/to/disk/2"} {"path": "/path/to/disk/2"}
] ]
}"#, }"#,

View File

@ -1539,7 +1539,7 @@ mod tests {
( (
format!( format!(
"vhost_user=true,path={},num_queues={},queue_size=128,wce=true", "vhost_user=true,path={},num_queues={},queue_size=128",
blk_file_path, num_queues, blk_file_path, num_queues,
), ),
None, None,
@ -1552,7 +1552,7 @@ mod tests {
( (
format!( format!(
"vhost_user=true,socket={},num_queues={},queue_size=128,wce=true", "vhost_user=true,socket={},num_queues={},queue_size=128",
vubd_socket_path, num_queues, vubd_socket_path, num_queues,
), ),
Some(daemon_child), Some(daemon_child),
@ -1736,7 +1736,7 @@ mod tests {
let (blk_boot_params, daemon_child) = if self_spawned { let (blk_boot_params, daemon_child) = if self_spawned {
( (
format!( format!(
"vhost_user=true,path={},num_queues={},queue_size=128,wce=true", "vhost_user=true,path={},num_queues={},queue_size=128",
disk_path, num_queues, disk_path, num_queues,
), ),
None, None,
@ -1754,7 +1754,7 @@ mod tests {
( (
format!( format!(
"vhost_user=true,socket={},num_queues={},queue_size=128,wce=true", "vhost_user=true,socket={},num_queues={},queue_size=128",
vubd_socket_path, num_queues, vubd_socket_path, num_queues,
), ),
Some(daemon_child), Some(daemon_child),

View File

@ -50,7 +50,7 @@ pub struct Blk {
impl Blk { impl Blk {
/// Create a new vhost-user-blk device /// Create a new vhost-user-blk device
pub fn new(id: String, wce: bool, vu_cfg: VhostUserConfig) -> Result<Blk> { pub fn new(id: String, vu_cfg: VhostUserConfig) -> Result<Blk> {
let mut vhost_user_blk = Master::connect(&vu_cfg.sock, vu_cfg.num_queues as u64) let mut vhost_user_blk = Master::connect(&vu_cfg.sock, vu_cfg.num_queues as u64)
.map_err(Error::VhostUserCreateMaster)?; .map_err(Error::VhostUserCreateMaster)?;
@ -61,13 +61,10 @@ impl Blk {
| 1 << VIRTIO_BLK_F_FLUSH | 1 << VIRTIO_BLK_F_FLUSH
| 1 << VIRTIO_BLK_F_TOPOLOGY | 1 << VIRTIO_BLK_F_TOPOLOGY
| 1 << VIRTIO_RING_F_EVENT_IDX | 1 << VIRTIO_RING_F_EVENT_IDX
| 1 << VIRTIO_BLK_F_CONFIG_WCE
| 1 << VIRTIO_F_VERSION_1 | 1 << VIRTIO_F_VERSION_1
| VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits(); | VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits();
if wce {
avail_features |= 1 << VIRTIO_BLK_F_CONFIG_WCE;
}
if vu_cfg.num_queues > 1 { if vu_cfg.num_queues > 1 {
avail_features |= 1 << VIRTIO_BLK_F_MQ; avail_features |= 1 << VIRTIO_BLK_F_MQ;
} }

View File

@ -454,9 +454,6 @@ components:
default: false default: false
vhost_socket: vhost_socket:
type: string type: string
wce:
type: boolean
default: true
poll_queue: poll_queue:
type: boolean type: boolean
default: true default: true

View File

@ -561,8 +561,6 @@ pub struct DiskConfig {
#[serde(default)] #[serde(default)]
pub vhost_user: bool, pub vhost_user: bool,
pub vhost_socket: Option<String>, pub vhost_socket: Option<String>,
#[serde(default = "default_diskconfig_wce")]
pub wce: bool,
#[serde(default = "default_diskconfig_poll_queue")] #[serde(default = "default_diskconfig_poll_queue")]
pub poll_queue: bool, pub poll_queue: bool,
#[serde(default)] #[serde(default)]
@ -577,10 +575,6 @@ fn default_diskconfig_queue_size() -> u16 {
DEFAULT_QUEUE_SIZE_VUBLK DEFAULT_QUEUE_SIZE_VUBLK
} }
fn default_diskconfig_wce() -> bool {
true
}
fn default_diskconfig_poll_queue() -> bool { fn default_diskconfig_poll_queue() -> bool {
true true
} }
@ -596,7 +590,6 @@ impl Default for DiskConfig {
queue_size: default_diskconfig_queue_size(), queue_size: default_diskconfig_queue_size(),
vhost_user: false, vhost_user: false,
vhost_socket: None, vhost_socket: None,
wce: default_diskconfig_wce(),
poll_queue: default_diskconfig_poll_queue(), poll_queue: default_diskconfig_poll_queue(),
id: None, id: None,
} }
@ -607,7 +600,7 @@ impl DiskConfig {
pub const SYNTAX: &'static str = "Disk parameters \ pub const SYNTAX: &'static str = "Disk parameters \
\"path=<disk_image_path>,readonly=on|off,iommu=on|off,num_queues=<number_of_queues>,\ \"path=<disk_image_path>,readonly=on|off,iommu=on|off,num_queues=<number_of_queues>,\
queue_size=<size_of_each_queue>,vhost_user=<vhost_user_enable>,\ queue_size=<size_of_each_queue>,vhost_user=<vhost_user_enable>,\
socket=<vhost_user_socket_path>,wce=<true|false, default true>,id=<device_id>\""; socket=<vhost_user_socket_path>, default true>,id=<device_id>\"";
pub fn parse(disk: &str) -> Result<Self> { pub fn parse(disk: &str) -> Result<Self> {
let mut parser = OptionParser::new(); let mut parser = OptionParser::new();
@ -620,7 +613,6 @@ impl DiskConfig {
.add("num_queues") .add("num_queues")
.add("vhost_user") .add("vhost_user")
.add("socket") .add("socket")
.add("wce")
.add("poll_queue") .add("poll_queue")
.add("id"); .add("id");
parser.parse(disk).map_err(Error::ParseDisk)?; parser.parse(disk).map_err(Error::ParseDisk)?;
@ -655,11 +647,6 @@ impl DiskConfig {
.unwrap_or(Toggle(false)) .unwrap_or(Toggle(false))
.0; .0;
let vhost_socket = parser.get("socket"); let vhost_socket = parser.get("socket");
let wce = parser
.convert::<Toggle>("wce")
.map_err(Error::ParseDisk)?
.unwrap_or_else(|| Toggle(default_diskconfig_wce()))
.0;
let poll_queue = parser let poll_queue = parser
.convert::<Toggle>("poll_queue") .convert::<Toggle>("poll_queue")
.map_err(Error::ParseDisk)? .map_err(Error::ParseDisk)?
@ -667,10 +654,6 @@ impl DiskConfig {
.0; .0;
let id = parser.get("id"); let id = parser.get("id");
if parser.is_set("wce") && !vhost_user {
warn!("wce parameter currently only has effect when used vhost_user=true");
}
if parser.is_set("poll_queue") && !vhost_user { if parser.is_set("poll_queue") && !vhost_user {
warn!("poll_queue parameter currently only has effect when used vhost_user=true"); warn!("poll_queue parameter currently only has effect when used vhost_user=true");
} }
@ -684,7 +667,6 @@ impl DiskConfig {
queue_size, queue_size,
vhost_socket, vhost_socket,
vhost_user, vhost_user,
wce,
poll_queue, poll_queue,
id, id,
}) })
@ -1611,18 +1593,16 @@ mod tests {
} }
); );
assert_eq!( assert_eq!(
DiskConfig::parse("path=/path/to_file,wce=true")?, DiskConfig::parse("path=/path/to_file")?,
DiskConfig { DiskConfig {
path: Some(PathBuf::from("/path/to_file")), path: Some(PathBuf::from("/path/to_file")),
wce: true,
..Default::default() ..Default::default()
} }
); );
assert_eq!( assert_eq!(
DiskConfig::parse("path=/path/to_file,wce=false")?, DiskConfig::parse("path=/path/to_file")?,
DiskConfig { DiskConfig {
path: Some(PathBuf::from("/path/to_file")), path: Some(PathBuf::from("/path/to_file")),
wce: false,
..Default::default() ..Default::default()
} }
); );

View File

@ -1336,7 +1336,7 @@ impl DeviceManager {
queue_size: disk_cfg.queue_size, queue_size: disk_cfg.queue_size,
}; };
let vhost_user_block_device = Arc::new(Mutex::new( let vhost_user_block_device = Arc::new(Mutex::new(
vm_virtio::vhost_user::Blk::new(id.clone(), disk_cfg.wce, vu_cfg) vm_virtio::vhost_user::Blk::new(id.clone(), vu_cfg)
.map_err(DeviceManagerError::CreateVhostUserBlk)?, .map_err(DeviceManagerError::CreateVhostUserBlk)?,
)); ));