From cfdf6432370441bcea66a96d9098545fb32c00c7 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Fri, 12 Nov 2021 10:47:23 +0000 Subject: [PATCH] block_util: Remove time consuming EventFd check As part of checking if io_uring is supported various functionality is tested. The test for whether io_uring supports EventFds is very time consuming (~10ms) however this test can be removed as a later test will test for functionality added after this one. The support for register_eventfd() was released in Linux 5.1 but the support for register_probe() was released in Linux 5.4. So if the latter is present the former also is. Before: cloud-hypervisor: 4.880411ms: INFO:vmm/src/device_manager.rs:1916 -- Creating virtio-block device: DiskConfig { path: Some("/home/rob/workloads/focal-server-cloudimg-amd64-custom-20210609-0.raw"), readonly: false, direct: false, iommu: false, num_queues: 1, queue_size: 128, vhost_user: false, vhost_socket: None, poll_queue: true, rate_limiter_config: None, id: Some("_disk0"), disable_io_uring: false, pci_segment: 0 } cloud-hypervisor: 14.105123ms: INFO:vmm/src/device_manager.rs:1998 -- Using asynchronous RAW disk file (io_uring) cloud-hypervisor: 14.134837ms: INFO:vmm/src/device_manager.rs:1916 -- Creating virtio-block device: DiskConfig { path: Some("/tmp/disk"), readonly: false, direct: false, iommu: false, num_queues: 1, queue_size: 128, vhost_user: false, vhost_socket: None, poll_queue: true, rate_limiter_config: None, id: Some("_disk1"), disable_io_uring: false, pci_segment: 0 } cloud-hypervisor: 14.221869ms: INFO:vmm/src/device_manager.rs:1998 -- Using asynchronous RAW disk file (io_uring) After: cloud-hypervisor: 3.140716ms: INFO:vmm/src/device_manager.rs:1916 -- Creating virtio-block device: DiskConfig { path: Some("/home/rob/workloads/focal-server-cloudimg-amd64-custom-20210609-0.raw"), readonly: false, direct: false, iommu: false, num_queues: 1, queue_size: 128, vhost_user: false, vhost_socket: None, poll_queue: true, rate_limiter_config: None, id: Some("_disk0"), disable_io_uring: false, pci_segment: 0 } cloud-hypervisor: 3.376027ms: INFO:vmm/src/device_manager.rs:1998 -- Using asynchronous RAW disk file (io_uring) cloud-hypervisor: 3.40446ms: INFO:vmm/src/device_manager.rs:1916 -- Creating virtio-block device: DiskConfig { path: Some("/tmp/disk"), readonly: false, direct: false, iommu: false, num_queues: 1, queue_size: 128, vhost_user: false, vhost_socket: None, poll_queue: true, rate_limiter_config: None, id: Some("_disk1"), disable_io_uring: false, pci_segment: 0 } cloud-hypervisor: 3.513969ms: INFO:vmm/src/device_manager.rs:1998 -- Using asynchronous RAW disk file (io_uring) Signed-off-by: Rob Bradford --- block_util/src/lib.rs | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/block_util/src/lib.rs b/block_util/src/lib.rs index cc39ee586..7f2831462 100644 --- a/block_util/src/lib.rs +++ b/block_util/src/lib.rs @@ -28,8 +28,6 @@ use std::convert::TryInto; use std::fs::File; use std::io::{self, IoSlice, IoSliceMut, Read, Seek, SeekFrom, Write}; use std::os::linux::fs::MetadataExt; -#[cfg(feature = "io_uring")] -use std::os::unix::io::AsRawFd; use std::path::Path; use std::result; use std::sync::{Arc, Mutex}; @@ -440,25 +438,6 @@ pub fn block_io_uring_is_supported() -> bool { let submitter = io_uring.submitter(); - let event_fd = match EventFd::new(libc::EFD_NONBLOCK) { - Ok(fd) => fd, - Err(e) => { - info!("{} failed to create eventfd: {}", error_msg, e); - return false; - } - }; - - // Check we can register an eventfd as this is going to be needed while - // using io_uring with the virtio block device. This also validates that - // io_uring_register() syscall is supported. - match submitter.register_eventfd(event_fd.as_raw_fd()) { - Ok(_) => {} - Err(e) => { - info!("{} failed to register eventfd: {}", error_msg, e); - return false; - } - } - let mut probe = Probe::new(); // Check we can register a probe to validate supported operations.