2020-01-20 16:10:21 +00:00
|
|
|
// Copyright 2019 Red Hat, Inc. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Portions Copyright 2019 Intel Corporation. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Portions Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
|
|
//
|
|
|
|
// Portions Copyright 2017 The Chromium OS Authors. All rights reserved.
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: (Apache-2.0 AND BSD-3-Clause)
|
|
|
|
|
2020-07-14 09:43:33 +00:00
|
|
|
extern crate block_util;
|
2020-01-20 16:10:21 +00:00
|
|
|
extern crate log;
|
|
|
|
extern crate vhost_rs;
|
|
|
|
extern crate vhost_user_backend;
|
|
|
|
|
2020-07-14 09:43:33 +00:00
|
|
|
use block_util::{build_disk_image_id, Request, VirtioBlockConfig};
|
2020-02-07 10:38:02 +00:00
|
|
|
use libc::EFD_NONBLOCK;
|
2020-01-20 16:10:21 +00:00
|
|
|
use log::*;
|
2020-07-06 15:41:45 +00:00
|
|
|
use option_parser::{OptionParser, OptionParserError, Toggle};
|
2020-01-20 16:10:21 +00:00
|
|
|
use qcow::{self, ImageType, QcowFile};
|
|
|
|
use std::fs::File;
|
|
|
|
use std::fs::OpenOptions;
|
|
|
|
use std::io::Read;
|
|
|
|
use std::io::{Seek, SeekFrom, Write};
|
2020-02-14 12:24:34 +00:00
|
|
|
use std::num::Wrapping;
|
2020-04-16 15:13:08 +00:00
|
|
|
use std::ops::DerefMut;
|
2020-02-11 11:27:03 +00:00
|
|
|
use std::os::unix::fs::OpenOptionsExt;
|
2020-01-20 16:10:21 +00:00
|
|
|
use std::path::PathBuf;
|
2020-01-21 15:16:38 +00:00
|
|
|
use std::process;
|
2020-05-20 16:04:52 +00:00
|
|
|
use std::result;
|
|
|
|
use std::sync::atomic::{AtomicBool, Ordering};
|
2020-04-08 16:27:26 +00:00
|
|
|
use std::sync::{Arc, Mutex, RwLock};
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
use std::time::Instant;
|
2020-01-20 16:10:21 +00:00
|
|
|
use std::vec::Vec;
|
2020-02-06 11:32:00 +00:00
|
|
|
use std::{convert, error, fmt, io};
|
2020-01-20 16:10:21 +00:00
|
|
|
use vhost_rs::vhost_user::message::*;
|
2020-04-24 11:33:00 +00:00
|
|
|
use vhost_rs::vhost_user::Listener;
|
2020-04-16 14:45:18 +00:00
|
|
|
use vhost_user_backend::{VhostUserBackend, VhostUserDaemon, Vring};
|
2020-01-20 16:10:21 +00:00
|
|
|
use virtio_bindings::bindings::virtio_blk::*;
|
2020-02-14 12:24:34 +00:00
|
|
|
use virtio_bindings::bindings::virtio_ring::VIRTIO_RING_F_EVENT_IDX;
|
2020-05-20 14:25:14 +00:00
|
|
|
use vm_memory::ByteValued;
|
2020-04-16 15:50:22 +00:00
|
|
|
use vm_memory::{Bytes, GuestMemoryMmap};
|
2020-02-07 10:38:02 +00:00
|
|
|
use vmm_sys_util::eventfd::EventFd;
|
2020-01-20 16:10:21 +00:00
|
|
|
|
|
|
|
const SECTOR_SHIFT: u8 = 9;
|
|
|
|
const SECTOR_SIZE: u64 = (0x01 as u64) << SECTOR_SHIFT;
|
|
|
|
const BLK_SIZE: u32 = 512;
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
// Current (2020) enterprise SSDs have a latency lower than 30us.
|
|
|
|
// Polling for 50us should be enough to cover for the device latency
|
|
|
|
// and the overhead of the emulation layer.
|
|
|
|
const POLL_QUEUE_US: u128 = 50;
|
2020-01-20 16:10:21 +00:00
|
|
|
|
2020-04-16 15:50:22 +00:00
|
|
|
trait DiskFile: Read + Seek + Write + Send + Sync {}
|
2020-01-20 16:10:21 +00:00
|
|
|
impl<D: Read + Seek + Write + Send + Sync> DiskFile for D {}
|
|
|
|
|
2020-04-16 15:50:22 +00:00
|
|
|
type Result<T> = std::result::Result<T, Error>;
|
|
|
|
type VhostUserBackendResult<T> = std::result::Result<T, std::io::Error>;
|
2020-01-20 16:10:21 +00:00
|
|
|
|
|
|
|
#[derive(Debug)]
|
2020-04-16 15:50:22 +00:00
|
|
|
enum Error {
|
2020-02-07 10:38:02 +00:00
|
|
|
/// Failed to create kill eventfd
|
|
|
|
CreateKillEventFd(io::Error),
|
2020-05-08 15:43:56 +00:00
|
|
|
/// Failed to parse configuration string
|
|
|
|
FailedConfigParse(OptionParserError),
|
|
|
|
/// Failed to handle event other than input event.
|
|
|
|
HandleEventNotEpollIn,
|
2020-02-07 10:38:02 +00:00
|
|
|
/// Failed to handle unknown event.
|
|
|
|
HandleEventUnknownEvent,
|
2020-05-08 15:43:56 +00:00
|
|
|
/// No path provided
|
|
|
|
PathParameterMissing,
|
|
|
|
/// No socket provided
|
|
|
|
SocketParameterMissing,
|
2020-01-20 16:10:21 +00:00
|
|
|
}
|
2020-02-06 11:31:05 +00:00
|
|
|
|
2020-05-08 15:11:00 +00:00
|
|
|
pub const SYNTAX: &str = "vhost-user-block backend parameters \
|
|
|
|
\"path=<image_path>,socket=<socket_path>,num_queues=<number_of_queues>,\
|
2020-05-08 16:50:14 +00:00
|
|
|
queue_size=<size_of_each_queue>,readonly=true|false,direct=true|false,\
|
|
|
|
poll_queue=true|false\"";
|
2020-05-08 15:11:00 +00:00
|
|
|
|
2020-02-06 11:31:05 +00:00
|
|
|
impl fmt::Display for Error {
|
|
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
|
|
write!(f, "vhost_user_block_error: {:?}", self)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl error::Error for Error {}
|
|
|
|
|
|
|
|
impl convert::From<Error> for io::Error {
|
|
|
|
fn from(e: Error) -> Self {
|
|
|
|
io::Error::new(io::ErrorKind::Other, e)
|
|
|
|
}
|
|
|
|
}
|
2020-01-20 16:10:21 +00:00
|
|
|
|
2020-04-16 15:50:22 +00:00
|
|
|
struct VhostUserBlkThread {
|
2020-01-20 16:10:21 +00:00
|
|
|
mem: Option<GuestMemoryMmap>,
|
2020-04-16 15:13:08 +00:00
|
|
|
disk_image: Arc<Mutex<dyn DiskFile>>,
|
2020-01-20 16:10:21 +00:00
|
|
|
disk_image_id: Vec<u8>,
|
|
|
|
disk_nsectors: u64,
|
2020-02-14 12:24:34 +00:00
|
|
|
event_idx: bool,
|
2020-02-07 10:38:02 +00:00
|
|
|
kill_evt: EventFd,
|
2020-05-20 16:04:52 +00:00
|
|
|
writeback: Arc<AtomicBool>,
|
2020-01-20 16:10:21 +00:00
|
|
|
}
|
|
|
|
|
2020-04-08 16:27:26 +00:00
|
|
|
impl VhostUserBlkThread {
|
2020-04-16 15:50:22 +00:00
|
|
|
fn new(
|
2020-04-16 15:44:12 +00:00
|
|
|
disk_image: Arc<Mutex<dyn DiskFile>>,
|
|
|
|
disk_image_id: Vec<u8>,
|
|
|
|
disk_nsectors: u64,
|
2020-05-20 16:04:52 +00:00
|
|
|
writeback: Arc<AtomicBool>,
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
) -> Result<Self> {
|
2020-04-08 16:27:26 +00:00
|
|
|
Ok(VhostUserBlkThread {
|
2020-01-20 16:10:21 +00:00
|
|
|
mem: None,
|
2020-04-16 15:44:12 +00:00
|
|
|
disk_image,
|
|
|
|
disk_image_id,
|
|
|
|
disk_nsectors,
|
2020-02-14 12:24:34 +00:00
|
|
|
event_idx: false,
|
2020-02-07 10:38:02 +00:00
|
|
|
kill_evt: EventFd::new(EFD_NONBLOCK).map_err(Error::CreateKillEventFd)?,
|
2020-05-20 16:04:52 +00:00
|
|
|
writeback,
|
2020-01-20 16:10:21 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
2020-04-16 15:50:22 +00:00
|
|
|
fn process_queue(&mut self, vring: &mut Vring) -> bool {
|
2020-01-20 16:10:21 +00:00
|
|
|
let mut used_any = false;
|
|
|
|
let mem = match self.mem.as_ref() {
|
|
|
|
Some(m) => m,
|
|
|
|
None => return false,
|
|
|
|
};
|
|
|
|
|
|
|
|
while let Some(head) = vring.mut_queue().iter(mem).next() {
|
|
|
|
debug!("got an element in the queue");
|
|
|
|
let len;
|
|
|
|
match Request::parse(&head, mem) {
|
2020-05-20 16:04:52 +00:00
|
|
|
Ok(mut request) => {
|
2020-01-20 16:10:21 +00:00
|
|
|
debug!("element is a valid request");
|
2020-05-20 16:04:52 +00:00
|
|
|
request.set_writeback(self.writeback.load(Ordering::SeqCst));
|
2020-01-20 16:10:21 +00:00
|
|
|
let status = match request.execute(
|
2020-04-16 15:13:08 +00:00
|
|
|
&mut self.disk_image.lock().unwrap().deref_mut(),
|
2020-01-20 16:10:21 +00:00
|
|
|
self.disk_nsectors,
|
|
|
|
mem,
|
|
|
|
&self.disk_image_id,
|
|
|
|
) {
|
|
|
|
Ok(l) => {
|
|
|
|
len = l;
|
|
|
|
VIRTIO_BLK_S_OK
|
|
|
|
}
|
|
|
|
Err(e) => {
|
|
|
|
len = 1;
|
|
|
|
e.status()
|
|
|
|
}
|
|
|
|
};
|
|
|
|
mem.write_obj(status, request.status_addr).unwrap();
|
|
|
|
}
|
|
|
|
Err(err) => {
|
|
|
|
error!("failed to parse available descriptor chain: {:?}", err);
|
|
|
|
len = 0;
|
|
|
|
}
|
|
|
|
}
|
2020-02-14 12:24:34 +00:00
|
|
|
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
if self.event_idx {
|
2020-05-20 09:40:54 +00:00
|
|
|
let queue = vring.mut_queue();
|
|
|
|
if let Some(used_idx) = queue.add_used(mem, head.index, len) {
|
|
|
|
if queue.needs_notification(&mem, Wrapping(used_idx)) {
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
debug!("signalling queue");
|
|
|
|
vring.signal_used_queue().unwrap();
|
|
|
|
} else {
|
|
|
|
debug!("omitting signal (event_idx)");
|
|
|
|
}
|
|
|
|
used_any = true;
|
2020-02-14 12:24:34 +00:00
|
|
|
}
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
} else {
|
|
|
|
debug!("signalling queue");
|
|
|
|
vring.mut_queue().add_used(mem, head.index, len);
|
|
|
|
vring.signal_used_queue().unwrap();
|
2020-02-14 12:24:34 +00:00
|
|
|
used_any = true;
|
|
|
|
}
|
2020-01-20 16:10:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
used_any
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-16 15:50:22 +00:00
|
|
|
struct VhostUserBlkBackend {
|
2020-04-16 16:50:12 +00:00
|
|
|
threads: Vec<Mutex<VhostUserBlkThread>>,
|
2020-05-20 14:25:14 +00:00
|
|
|
config: VirtioBlockConfig,
|
2020-04-16 15:44:12 +00:00
|
|
|
rdonly: bool,
|
|
|
|
poll_queue: bool,
|
2020-04-16 16:50:12 +00:00
|
|
|
queues_per_thread: Vec<u64>,
|
2020-05-08 16:50:14 +00:00
|
|
|
queue_size: usize,
|
2020-05-20 16:04:52 +00:00
|
|
|
acked_features: u64,
|
|
|
|
writeback: Arc<AtomicBool>,
|
2020-04-08 16:27:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
impl VhostUserBlkBackend {
|
2020-04-16 15:50:22 +00:00
|
|
|
fn new(
|
2020-04-08 16:27:26 +00:00
|
|
|
image_path: String,
|
|
|
|
num_queues: usize,
|
|
|
|
rdonly: bool,
|
|
|
|
direct: bool,
|
|
|
|
poll_queue: bool,
|
2020-05-08 16:50:14 +00:00
|
|
|
queue_size: usize,
|
2020-04-08 16:27:26 +00:00
|
|
|
) -> Result<Self> {
|
2020-04-16 15:44:12 +00:00
|
|
|
let mut options = OpenOptions::new();
|
|
|
|
options.read(true);
|
|
|
|
options.write(!rdonly);
|
|
|
|
if direct {
|
|
|
|
options.custom_flags(libc::O_DIRECT);
|
|
|
|
}
|
|
|
|
let image: File = options.open(&image_path).unwrap();
|
2020-07-10 14:43:12 +00:00
|
|
|
let mut raw_img: qcow::RawFile = qcow::RawFile::new(image, direct);
|
2020-04-08 16:27:26 +00:00
|
|
|
|
2020-04-16 15:44:12 +00:00
|
|
|
let image_id = build_disk_image_id(&PathBuf::from(&image_path));
|
|
|
|
let image_type = qcow::detect_image_type(&mut raw_img).unwrap();
|
|
|
|
let image = match image_type {
|
|
|
|
ImageType::Raw => Arc::new(Mutex::new(raw_img)) as Arc<Mutex<dyn DiskFile>>,
|
|
|
|
ImageType::Qcow2 => {
|
|
|
|
Arc::new(Mutex::new(QcowFile::from(raw_img).unwrap())) as Arc<Mutex<dyn DiskFile>>
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
let nsectors = (image.lock().unwrap().seek(SeekFrom::End(0)).unwrap() as u64) / SECTOR_SIZE;
|
2020-05-20 14:25:14 +00:00
|
|
|
let mut config = VirtioBlockConfig::default();
|
2020-04-16 15:44:12 +00:00
|
|
|
|
|
|
|
config.capacity = nsectors;
|
|
|
|
config.blk_size = BLK_SIZE;
|
|
|
|
config.size_max = 65535;
|
|
|
|
config.seg_max = 128 - 2;
|
|
|
|
config.min_io_size = 1;
|
|
|
|
config.opt_io_size = 1;
|
|
|
|
config.num_queues = num_queues as u16;
|
2020-05-20 14:25:14 +00:00
|
|
|
config.writeback = 1;
|
2020-04-16 15:44:12 +00:00
|
|
|
|
2020-04-16 16:50:12 +00:00
|
|
|
let mut queues_per_thread = Vec::new();
|
|
|
|
let mut threads = Vec::new();
|
2020-05-20 16:04:52 +00:00
|
|
|
let writeback = Arc::new(AtomicBool::new(true));
|
2020-04-16 16:50:12 +00:00
|
|
|
for i in 0..num_queues {
|
|
|
|
let thread = Mutex::new(VhostUserBlkThread::new(
|
|
|
|
image.clone(),
|
|
|
|
image_id.clone(),
|
|
|
|
nsectors,
|
2020-05-20 16:04:52 +00:00
|
|
|
writeback.clone(),
|
2020-04-16 16:50:12 +00:00
|
|
|
)?);
|
|
|
|
threads.push(thread);
|
|
|
|
queues_per_thread.push(0b1 << i);
|
|
|
|
}
|
2020-04-16 15:44:12 +00:00
|
|
|
|
|
|
|
Ok(VhostUserBlkBackend {
|
2020-04-16 16:50:12 +00:00
|
|
|
threads,
|
2020-04-16 15:44:12 +00:00
|
|
|
config,
|
|
|
|
rdonly,
|
|
|
|
poll_queue,
|
2020-04-16 16:50:12 +00:00
|
|
|
queues_per_thread,
|
2020-05-08 16:50:14 +00:00
|
|
|
queue_size,
|
2020-05-20 16:04:52 +00:00
|
|
|
acked_features: 0,
|
|
|
|
writeback,
|
2020-04-16 15:44:12 +00:00
|
|
|
})
|
2020-04-08 16:27:26 +00:00
|
|
|
}
|
2020-05-20 16:04:52 +00:00
|
|
|
|
|
|
|
fn update_writeback(&mut self) {
|
|
|
|
// Use writeback from config if VIRTIO_BLK_F_CONFIG_WCE
|
|
|
|
let writeback =
|
|
|
|
if self.acked_features & 1 << VIRTIO_BLK_F_CONFIG_WCE == 1 << VIRTIO_BLK_F_CONFIG_WCE {
|
|
|
|
self.config.writeback == 1
|
|
|
|
} else {
|
|
|
|
// Else check if VIRTIO_BLK_F_FLUSH negotiated
|
|
|
|
self.acked_features & 1 << VIRTIO_BLK_F_FLUSH == 1 << VIRTIO_BLK_F_FLUSH
|
|
|
|
};
|
|
|
|
|
|
|
|
info!(
|
|
|
|
"Changing cache mode to {}",
|
|
|
|
if writeback {
|
|
|
|
"writeback"
|
|
|
|
} else {
|
|
|
|
"writethrough"
|
|
|
|
}
|
|
|
|
);
|
|
|
|
self.writeback.store(writeback, Ordering::SeqCst);
|
|
|
|
}
|
2020-04-08 16:27:26 +00:00
|
|
|
}
|
|
|
|
|
2020-01-20 16:10:21 +00:00
|
|
|
impl VhostUserBackend for VhostUserBlkBackend {
|
|
|
|
fn num_queues(&self) -> usize {
|
2020-04-16 15:44:12 +00:00
|
|
|
self.config.num_queues as usize
|
2020-01-20 16:10:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn max_queue_size(&self) -> usize {
|
2020-05-08 16:50:14 +00:00
|
|
|
self.queue_size as usize
|
2020-01-20 16:10:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
fn features(&self) -> u64 {
|
|
|
|
let mut avail_features = 1 << VIRTIO_BLK_F_MQ
|
|
|
|
| 1 << VIRTIO_BLK_F_CONFIG_WCE
|
2020-02-14 12:24:34 +00:00
|
|
|
| 1 << VIRTIO_RING_F_EVENT_IDX
|
2020-01-20 16:10:21 +00:00
|
|
|
| 1 << VIRTIO_F_VERSION_1
|
2020-05-18 08:58:47 +00:00
|
|
|
| 1 << VIRTIO_BLK_F_FLUSH
|
2020-01-20 16:10:21 +00:00
|
|
|
| VhostUserVirtioFeatures::PROTOCOL_FEATURES.bits();
|
|
|
|
|
2020-04-16 15:44:12 +00:00
|
|
|
if self.rdonly {
|
2020-01-20 16:10:21 +00:00
|
|
|
avail_features |= 1 << VIRTIO_BLK_F_RO;
|
|
|
|
}
|
|
|
|
avail_features
|
|
|
|
}
|
|
|
|
|
2020-05-20 16:04:52 +00:00
|
|
|
fn acked_features(&mut self, features: u64) {
|
|
|
|
self.acked_features = features;
|
|
|
|
self.update_writeback();
|
|
|
|
}
|
|
|
|
|
2020-01-20 16:10:21 +00:00
|
|
|
fn protocol_features(&self) -> VhostUserProtocolFeatures {
|
|
|
|
VhostUserProtocolFeatures::CONFIG
|
|
|
|
}
|
|
|
|
|
2020-02-14 12:24:34 +00:00
|
|
|
fn set_event_idx(&mut self, enabled: bool) {
|
2020-04-16 16:50:12 +00:00
|
|
|
for thread in self.threads.iter() {
|
|
|
|
thread.lock().unwrap().event_idx = enabled;
|
|
|
|
}
|
2020-02-14 12:24:34 +00:00
|
|
|
}
|
2020-02-14 11:27:47 +00:00
|
|
|
|
2020-01-20 16:10:21 +00:00
|
|
|
fn update_memory(&mut self, mem: GuestMemoryMmap) -> VhostUserBackendResult<()> {
|
2020-04-16 16:50:12 +00:00
|
|
|
for thread in self.threads.iter() {
|
|
|
|
thread.lock().unwrap().mem = Some(mem.clone());
|
|
|
|
}
|
2020-01-20 16:10:21 +00:00
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
|
|
|
fn handle_event(
|
2020-04-09 11:14:05 +00:00
|
|
|
&self,
|
2020-01-20 16:10:21 +00:00
|
|
|
device_event: u16,
|
|
|
|
evset: epoll::Events,
|
|
|
|
vrings: &[Arc<RwLock<Vring>>],
|
2020-04-16 16:50:12 +00:00
|
|
|
thread_id: usize,
|
2020-01-20 16:10:21 +00:00
|
|
|
) -> VhostUserBackendResult<bool> {
|
|
|
|
if evset != epoll::Events::EPOLLIN {
|
2020-02-06 11:32:00 +00:00
|
|
|
return Err(Error::HandleEventNotEpollIn.into());
|
2020-01-20 16:10:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
debug!("event received: {:?}", device_event);
|
|
|
|
|
2020-04-16 16:50:12 +00:00
|
|
|
let mut thread = self.threads[thread_id].lock().unwrap();
|
2020-02-07 10:38:02 +00:00
|
|
|
match device_event {
|
2020-04-16 16:50:12 +00:00
|
|
|
0 => {
|
|
|
|
let mut vring = vrings[0].write().unwrap();
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
|
2020-04-16 15:44:12 +00:00
|
|
|
if self.poll_queue {
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
// Actively poll the queue until POLL_QUEUE_US has passed
|
|
|
|
// without seeing a new request.
|
|
|
|
let mut now = Instant::now();
|
|
|
|
loop {
|
2020-04-08 16:27:26 +00:00
|
|
|
if thread.process_queue(&mut vring) {
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
now = Instant::now();
|
|
|
|
} else if now.elapsed().as_micros() > POLL_QUEUE_US {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-04-08 16:27:26 +00:00
|
|
|
if thread.event_idx {
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
// vm-virtio's Queue implementation only checks avail_index
|
|
|
|
// once, so to properly support EVENT_IDX we need to keep
|
|
|
|
// calling process_queue() until it stops finding new
|
|
|
|
// requests on the queue.
|
|
|
|
loop {
|
|
|
|
vring
|
|
|
|
.mut_queue()
|
2020-04-08 16:27:26 +00:00
|
|
|
.update_avail_event(thread.mem.as_ref().unwrap());
|
|
|
|
if !thread.process_queue(&mut vring) {
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
break;
|
|
|
|
}
|
2020-02-14 12:24:34 +00:00
|
|
|
}
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
} else {
|
|
|
|
// Without EVENT_IDX, a single call is enough.
|
2020-04-08 16:27:26 +00:00
|
|
|
thread.process_queue(&mut vring);
|
2020-02-07 10:38:02 +00:00
|
|
|
}
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
|
2020-02-07 10:38:02 +00:00
|
|
|
Ok(false)
|
|
|
|
}
|
|
|
|
_ => Err(Error::HandleEventUnknownEvent.into()),
|
2020-01-20 16:10:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn get_config(&self, _offset: u32, _size: u32) -> Vec<u8> {
|
2020-05-20 14:25:14 +00:00
|
|
|
self.config.as_slice().to_vec()
|
2020-01-20 16:10:21 +00:00
|
|
|
}
|
2020-02-11 11:27:03 +00:00
|
|
|
|
2020-05-20 16:04:52 +00:00
|
|
|
fn set_config(&mut self, offset: u32, data: &[u8]) -> result::Result<(), io::Error> {
|
|
|
|
let config_slice = self.config.as_mut_slice();
|
|
|
|
let data_len = data.len() as u32;
|
|
|
|
let config_len = config_slice.len() as u32;
|
|
|
|
if offset + data_len > config_len {
|
|
|
|
error!("Failed to write config space");
|
|
|
|
return Err(io::Error::from_raw_os_error(libc::EINVAL));
|
|
|
|
}
|
|
|
|
let (_, right) = config_slice.split_at_mut(offset as usize);
|
|
|
|
right.copy_from_slice(&data[..]);
|
|
|
|
self.update_writeback();
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
|
2020-04-16 16:50:12 +00:00
|
|
|
fn exit_event(&self, thread_index: usize) -> Option<(EventFd, Option<u16>)> {
|
|
|
|
// The exit event is placed after the queue, which is event index 1.
|
2020-04-08 16:27:26 +00:00
|
|
|
Some((
|
2020-04-16 16:50:12 +00:00
|
|
|
self.threads[thread_index]
|
|
|
|
.lock()
|
|
|
|
.unwrap()
|
|
|
|
.kill_evt
|
|
|
|
.try_clone()
|
|
|
|
.unwrap(),
|
|
|
|
Some(1),
|
2020-04-08 16:27:26 +00:00
|
|
|
))
|
2020-02-11 11:27:03 +00:00
|
|
|
}
|
2020-04-16 16:50:12 +00:00
|
|
|
|
|
|
|
fn queues_per_thread(&self) -> Vec<u64> {
|
|
|
|
self.queues_per_thread.clone()
|
|
|
|
}
|
2020-01-20 16:10:21 +00:00
|
|
|
}
|
|
|
|
|
2020-05-08 15:43:56 +00:00
|
|
|
struct VhostUserBlkBackendConfig {
|
|
|
|
path: String,
|
|
|
|
socket: String,
|
2020-04-16 15:50:22 +00:00
|
|
|
num_queues: usize,
|
2020-05-08 16:50:14 +00:00
|
|
|
queue_size: usize,
|
2020-04-16 15:50:22 +00:00
|
|
|
readonly: bool,
|
|
|
|
direct: bool,
|
|
|
|
poll_queue: bool,
|
2020-01-20 16:10:21 +00:00
|
|
|
}
|
|
|
|
|
2020-05-08 15:43:56 +00:00
|
|
|
impl VhostUserBlkBackendConfig {
|
|
|
|
fn parse(backend: &str) -> Result<Self> {
|
|
|
|
let mut parser = OptionParser::new();
|
|
|
|
parser
|
|
|
|
.add("path")
|
|
|
|
.add("readonly")
|
|
|
|
.add("direct")
|
|
|
|
.add("num_queues")
|
2020-05-08 16:50:14 +00:00
|
|
|
.add("queue_size")
|
2020-05-08 15:43:56 +00:00
|
|
|
.add("socket")
|
|
|
|
.add("poll_queue");
|
|
|
|
parser.parse(backend).map_err(Error::FailedConfigParse)?;
|
|
|
|
|
|
|
|
let path = parser.get("path").ok_or(Error::PathParameterMissing)?;
|
|
|
|
let readonly = parser
|
|
|
|
.convert::<Toggle>("readonly")
|
|
|
|
.map_err(Error::FailedConfigParse)?
|
|
|
|
.unwrap_or(Toggle(false))
|
|
|
|
.0;
|
|
|
|
let direct = parser
|
|
|
|
.convert::<Toggle>("direct")
|
|
|
|
.map_err(Error::FailedConfigParse)?
|
|
|
|
.unwrap_or(Toggle(false))
|
|
|
|
.0;
|
|
|
|
let num_queues = parser
|
|
|
|
.convert("num_queues")
|
|
|
|
.map_err(Error::FailedConfigParse)?
|
|
|
|
.unwrap_or(1);
|
|
|
|
let socket = parser.get("socket").ok_or(Error::SocketParameterMissing)?;
|
|
|
|
let poll_queue = parser
|
|
|
|
.convert::<Toggle>("poll_queue")
|
|
|
|
.map_err(Error::FailedConfigParse)?
|
2020-11-25 16:22:41 +00:00
|
|
|
.unwrap_or(Toggle(true))
|
2020-05-08 15:43:56 +00:00
|
|
|
.0;
|
2020-05-08 16:50:14 +00:00
|
|
|
let queue_size = parser
|
|
|
|
.convert("queue_size")
|
|
|
|
.map_err(Error::FailedConfigParse)?
|
|
|
|
.unwrap_or(1024);
|
2020-01-20 16:10:21 +00:00
|
|
|
|
|
|
|
Ok(VhostUserBlkBackendConfig {
|
2020-05-08 15:43:56 +00:00
|
|
|
path,
|
|
|
|
socket,
|
2020-02-03 07:36:15 +00:00
|
|
|
num_queues,
|
2020-01-20 16:10:21 +00:00
|
|
|
readonly,
|
|
|
|
direct,
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
poll_queue,
|
2020-05-08 16:50:14 +00:00
|
|
|
queue_size,
|
2020-01-20 16:10:21 +00:00
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
2020-01-21 15:16:38 +00:00
|
|
|
|
|
|
|
pub fn start_block_backend(backend_command: &str) {
|
|
|
|
let backend_config = match VhostUserBlkBackendConfig::parse(backend_command) {
|
|
|
|
Ok(config) => config,
|
|
|
|
Err(e) => {
|
|
|
|
println!("Failed parsing parameters {:?}", e);
|
|
|
|
process::exit(1);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
let blk_backend = Arc::new(RwLock::new(
|
|
|
|
VhostUserBlkBackend::new(
|
2020-05-08 15:43:56 +00:00
|
|
|
backend_config.path,
|
2020-02-03 07:36:15 +00:00
|
|
|
backend_config.num_queues,
|
2020-01-21 15:16:38 +00:00
|
|
|
backend_config.readonly,
|
|
|
|
backend_config.direct,
|
vhost_user_block: Implement optional static polling
Actively polling the virtqueue significantly reduces the latency of
each I/O operation, at the expense of using more CPU time. This
features is specially useful when using low-latency devices (SSD,
NVMe) as the backend.
This change implements static polling. When a request arrives after
being idle, vhost_user_block will keep checking the virtqueue for new
requests, until POLL_QUEUE_US (50us) has passed without finding one.
POLL_QUEUE_US is defined to be 50us, based on the current latency of
enterprise SSDs (< 30us) and the overhead of the emulation.
This feature is enabled by default, and can be disabled by using the
"poll_queue" parameter of "block-backend".
This is a test using null_blk as a backend for the image, with the
following parameters:
- null_blk gb=20 nr_devices=1 irqmode=2 completion_nsec=0 no_sched=1
With "poll_queue=false":
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=169MiB/s][r=43.2k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=433: Tue Feb 18 11:12:59 2020
read: IOPS=43.2k, BW=169MiB/s (177MB/s)(1688MiB/10001msec)
clat (usec): min=17, max=836, avg=21.64, stdev= 3.81
lat (usec): min=17, max=836, avg=21.77, stdev= 3.81
clat percentiles (nsec):
| 1.00th=[19328], 5.00th=[19840], 10.00th=[20352], 20.00th=[21120],
| 30.00th=[21376], 40.00th=[21376], 50.00th=[21376], 60.00th=[21632],
| 70.00th=[21632], 80.00th=[21888], 90.00th=[22144], 95.00th=[22912],
| 99.00th=[28544], 99.50th=[30336], 99.90th=[39168], 99.95th=[42752],
| 99.99th=[71168]
bw ( KiB/s): min=168440, max=188496, per=100.00%, avg=172912.00, stdev=3975.63, samples=19
iops : min=42110, max=47124, avg=43228.00, stdev=993.91, samples=19
lat (usec) : 20=5.90%, 50=94.08%, 100=0.02%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=10.35%, sys=25.82%, ctx=432417, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=432220,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=169MiB/s (177MB/s), 169MiB/s-169MiB/s (177MB/s-177MB/s), io=1688MiB (1770MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=427867/0, merge=0/0, ticks=7346/0, in_queue=0, util=99.04%
With "poll_queue=true" (default):
fio --ioengine=sync --bs=4k --rw randread --name randread --direct=1
--filename=/dev/vdb --time_based --runtime=10
randread: (g=0): rw=randread, bs=(R) 4096B-4096B, (W) 4096B-4096B, (T) 4096B-4096B, ioengine=sync, iodepth=1
fio-3.14
Starting 1 process
Jobs: 1 (f=1): [r(1)][100.0%][r=260MiB/s][r=66.7k IOPS][eta 00m:00s]
randread: (groupid=0, jobs=1): err= 0: pid=422: Tue Feb 18 11:14:47 2020
read: IOPS=68.5k, BW=267MiB/s (280MB/s)(2674MiB/10001msec)
clat (usec): min=10, max=966, avg=13.60, stdev= 3.49
lat (usec): min=10, max=966, avg=13.70, stdev= 3.50
clat percentiles (nsec):
| 1.00th=[11200], 5.00th=[11968], 10.00th=[11968], 20.00th=[12224],
| 30.00th=[12992], 40.00th=[13504], 50.00th=[13760], 60.00th=[13888],
| 70.00th=[14016], 80.00th=[14144], 90.00th=[14272], 95.00th=[14656],
| 99.00th=[20352], 99.50th=[23936], 99.90th=[35072], 99.95th=[36096],
| 99.99th=[47872]
bw ( KiB/s): min=265456, max=296456, per=100.00%, avg=274229.05, stdev=13048.14, samples=19
iops : min=66364, max=74114, avg=68557.26, stdev=3262.03, samples=19
lat (usec) : 20=98.84%, 50=1.15%, 100=0.01%, 250=0.01%, 500=0.01%
lat (usec) : 750=0.01%, 1000=0.01%
cpu : usr=8.24%, sys=21.15%, ctx=684669, majf=0, minf=10
IO depths : 1=100.0%, 2=0.0%, 4=0.0%, 8=0.0%, 16=0.0%, 32=0.0%, >=64=0.0%
submit : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
complete : 0=0.0%, 4=100.0%, 8=0.0%, 16=0.0%, 32=0.0%, 64=0.0%, >=64=0.0%
issued rwts: total=684611,0,0,0 short=0,0,0,0 dropped=0,0,0,0
latency : target=0, window=0, percentile=100.00%, depth=1
Run status group 0 (all jobs):
READ: bw=267MiB/s (280MB/s), 267MiB/s-267MiB/s (280MB/s-280MB/s), io=2674MiB (2804MB), run=10001-10001msec
Disk stats (read/write):
vdb: ios=677855/0, merge=0/0, ticks=7026/0, in_queue=0, util=99.04%
Signed-off-by: Sergio Lopez <slp@redhat.com>
2020-02-17 13:52:25 +00:00
|
|
|
backend_config.poll_queue,
|
2020-05-08 16:50:14 +00:00
|
|
|
backend_config.queue_size,
|
2020-01-21 15:16:38 +00:00
|
|
|
)
|
|
|
|
.unwrap(),
|
|
|
|
));
|
|
|
|
|
|
|
|
debug!("blk_backend is created!\n");
|
|
|
|
|
2020-04-24 11:33:00 +00:00
|
|
|
let listener = Listener::new(&backend_config.socket, true).unwrap();
|
|
|
|
|
2020-01-21 15:16:38 +00:00
|
|
|
let name = "vhost-user-blk-backend";
|
2020-04-24 11:33:00 +00:00
|
|
|
let mut blk_daemon = VhostUserDaemon::new(name.to_string(), blk_backend.clone()).unwrap();
|
|
|
|
|
2020-01-21 15:16:38 +00:00
|
|
|
debug!("blk_daemon is created!\n");
|
|
|
|
|
2020-04-24 11:33:00 +00:00
|
|
|
if let Err(e) = blk_daemon.start(listener) {
|
2020-02-07 10:38:02 +00:00
|
|
|
error!(
|
|
|
|
"Failed to start daemon for vhost-user-block with error: {:?}\n",
|
2020-01-21 15:16:38 +00:00
|
|
|
e
|
|
|
|
);
|
|
|
|
process::exit(1);
|
|
|
|
}
|
|
|
|
|
2020-02-07 10:38:02 +00:00
|
|
|
if let Err(e) = blk_daemon.wait() {
|
|
|
|
error!("Error from the main thread: {:?}", e);
|
|
|
|
}
|
|
|
|
|
2020-04-16 16:50:12 +00:00
|
|
|
for thread in blk_backend.read().unwrap().threads.iter() {
|
|
|
|
if let Err(e) = thread.lock().unwrap().kill_evt.write(1) {
|
|
|
|
error!("Error shutting down worker thread: {:?}", e)
|
|
|
|
}
|
2020-02-07 10:38:02 +00:00
|
|
|
}
|
2020-01-21 15:16:38 +00:00
|
|
|
}
|