All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: Ferry Meng <mengferry@linux.alibaba.com>
Cc: "Michael S . Tsirkin" <mst@redhat.com>,
	Jason Wang <jasowang@redhat.com>,
	linux-block@vger.kernel.org, Jens Axboe <axboe@kernel.dk>,
	virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
	io-uring@vger.kernel.org, Christoph Hellwig <hch@infradead.org>,
	Joseph Qi <joseph.qi@linux.alibaba.com>,
	Jeffle Xu <jefflexu@linux.alibaba.com>
Subject: Re: [PATCH v1 0/3] virtio-blk: add io_uring passthrough support.
Date: Thu, 9 Jan 2025 12:27:10 -0500	[thread overview]
Message-ID: <20250109172710.GA192961@fedora> (raw)
In-Reply-To: <20241218092435.21671-1-mengferry@linux.alibaba.com>

[-- Attachment #1: Type: text/plain, Size: 3608 bytes --]

On Wed, Dec 18, 2024 at 05:24:32PM +0800, Ferry Meng wrote:
> This patchset implements io_uring passthrough surppot in virtio-blk
> driver, bypass vfs and part of block layer logic, resulting in lower
> submit latency and increased flexibility when utilizing virtio-blk.
> 
> In this version, currently only supports READ/WRITE vec/no-vec operations,
> others like discard or zoned ops not considered in. So the userspace-related

If WRITE is supported then FLUSH is also required so that written data
can be persisted without falling back to another API.

> struct is not complicated.
> 
> struct virtblk_uring_cmd {
> 	__u32 type;
> 	__u32 ioprio;
> 	__u64 sector;
> 	/* above is related to out_hdr */
> 	__u64 data;  // user buffer addr or iovec base addr.
> 	__u32 data_len; // user buffer length or iovec count.
> 	__u32 flag;  // only contains whether a vector rw or not.
> }; 
> 
> To test this patch series, I changed fio's code: 
> 1. Added virtio-blk support to engines/io_uring.c.
> 2. Added virtio-blk support to the t/io_uring.c testing tool.
> Link: https://github.com/jdmfr/fio
> 
> 
> ===========
> Performance
> ===========
> 
> Using t/io_uring-vblk, the performance of virtio-blk based on uring-cmd
> scales better than block device access. (such as below, Virtio-Blk with QEMU,
> 1-depth fio) 
> (passthru) read: IOPS=17.2k, BW=67.4MiB/s (70.6MB/s) 
> slat (nsec): min=2907, max=43592, avg=3981.87, stdev=595.10 
> clat (usec): min=38, max=285,avg=53.47, stdev= 8.28 
> lat (usec): min=44, max=288, avg=57.45, stdev= 8.28
> (block) read: IOPS=15.3k, BW=59.8MiB/s (62.7MB/s) 
> slat (nsec): min=3408, max=35366, avg=5102.17, stdev=790.79 
> clat (usec): min=35, max=343, avg=59.63, stdev=10.26 
> lat (usec): min=43, max=349, avg=64.73, stdev=10.21
> 
> Testing the virtio-blk device with fio using 'engines=io_uring_cmd'
> and 'engines=io_uring' also demonstrates improvements in submit latency.
> (passthru) taskset -c 0 t/io_uring-vblk -b4096 -d8 -c4 -s4 -p0 -F1 -B0 -O0 -n1 -u1 /dev/vdcc0 
> IOPS=189.80K, BW=741MiB/s, IOS/call=4/3
> IOPS=187.68K, BW=733MiB/s, IOS/call=4/3 
> (block) taskset -c 0 t/io_uring-vblk -b4096 -d8 -c4 -s4 -p0 -F1 -B0 -O0 -n1 -u0 /dev/vdc 
> IOPS=101.51K, BW=396MiB/s, IOS/call=4/3
> IOPS=100.01K, BW=390MiB/s, IOS/call=4/4

This iodepth=8 (submission/completion batching 4) result surprised me
because the io_uring calls are already batched but there is still a 4
microsecond improvement per request.

I was expecting to see less improvement when iodepth is increased
because the syscall, io_uring, and some block layer cost is amortized
thanks to batching and block plugging.

Is the virtio-blk driver submitting 4 requests at a time for both
passthru and block? I wonder if something else is going on here.

> 
> =======
> Changes
> =======
> 
> Changes in v1:
> --------------
> * remove virtblk_is_write() helper
> * fix rq_flags type definition (blk_opf_t), add REQ_ALLOC_CACHE flag.
> https://lore.kernel.org/io-uring/202412042324.uKQ5KdkE-lkp@intel.com/
> 
> RFC discussion:
> ---------------
> https://lore.kernel.org/io-uring/20241203121424.19887-1-mengferry@linux.alibaba.com/
> 
> Ferry Meng (3):
>   virtio-blk: add virtio-blk chardev support.
>   virtio-blk: add uring_cmd support for I/O passthru on chardev.
>   virtio-blk: add uring_cmd iopoll support.
> 
>  drivers/block/virtio_blk.c      | 320 +++++++++++++++++++++++++++++++-
>  include/uapi/linux/virtio_blk.h |  16 ++
>  2 files changed, 331 insertions(+), 5 deletions(-)
> 
> -- 
> 2.43.5
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2025-01-09 17:27 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18  9:24 [PATCH v1 0/3] virtio-blk: add io_uring passthrough support Ferry Meng
2024-12-18  9:24 ` [PATCH v1 1/3] virtio-blk: add virtio-blk chardev support Ferry Meng
2024-12-30  7:47   ` Joseph Qi
2025-01-07  4:53   ` Jingbo Xu
2024-12-18  9:24 ` [PATCH v1 2/3] virtio-blk: add uring_cmd support for I/O passthru on chardev Ferry Meng
2024-12-30  8:00   ` Joseph Qi
2025-01-07 13:14   ` lizetao
2025-02-26 12:04     ` Ferry Meng
2024-12-18  9:24 ` [PATCH v1 3/3] virtio-blk: add uring_cmd iopoll support Ferry Meng
2025-01-09 17:27 ` Stefan Hajnoczi [this message]
2025-02-19  2:01 ` [PATCH v1 0/3] virtio-blk: add io_uring passthrough support Stefan Hajnoczi
2025-02-26 11:10   ` Ferry Meng
2025-02-27  6:57     ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250109172710.GA192961@fedora \
    --to=stefanha@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=io-uring@vger.kernel.org \
    --cc=jasowang@redhat.com \
    --cc=jefflexu@linux.alibaba.com \
    --cc=joseph.qi@linux.alibaba.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mengferry@linux.alibaba.com \
    --cc=mst@redhat.com \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.