[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YoS7tNfivgBpjTyB@stefanha-x1.localdomain>
Date: Wed, 18 May 2022 10:26:12 +0100
From: Stefan Hajnoczi <stefanha@...hat.com>
To: Ming Lei <ming.lei@...hat.com>
Cc: Jens Axboe <axboe@...nel.dk>, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org,
Harris James R <james.r.harris@...el.com>,
io-uring@...r.kernel.org,
Gabriel Krisman Bertazi <krisman@...labora.com>,
ZiyangZhang <ZiyangZhang@...ux.alibaba.com>,
Xiaoguang Wang <xiaoguang.wang@...ux.alibaba.com>
Subject: Re: [PATCH V2 0/1] ubd: add io_uring based userspace block driver
On Tue, May 17, 2022 at 01:53:57PM +0800, Ming Lei wrote:
> Another thing ubd driver handles is to copy data between user space buffer
> and request/bio's pages, or take zero copy if mm is ready for support it in
> future. ubd driver doesn't handle any IO logic of the specific driver, so
> it is small/simple, and all io logics are done by the target code in ubdserver.
On the topic of zero copy I guess there are two obvious approaches:
1. An mm solution that grants ubdsrv access to the I/O buffer pages. I
think ZUFS had a strategy based on pinning server threads to CPUs and
then having a per-CPU vma that can be changed cheaply
(https://lwn.net/Articles/756625/).
2. A sendfile/splice solution where ubdsrv replies with <fd, offset,
length> tuples instead of I/O completion and the UBD driver performs
the I/O on behalf of ubdsrv.
(A variation is to give ubdsrv a file descriptor so it can call
sendfile(2) or related syscalls itself without ever having direct
access to the I/O buffer pages.)
This direction leads to LBA TLB designs like the old dm-userspace
target
(https://listman.redhat.com/archives/dm-devel/2006-April/msg00114.html)
where the kernel keeps a TLB of <lba, length, fd, offset> so it can
avoid sending requests to userspace when there is a TLB hit.
Userspace's job is to program mappings into the LBA TLB and handle
the slow path (e.g. allocating writes or compressed blocks). IMO the
downside of this approach is that it's best to have it from the
beginning - it's hard to retrofit existing ubdsrv code that is
intended to process every I/O request instead of populating the LBA
TLB.
Stefan
Download attachment "signature.asc" of type "application/pgp-signature" (489 bytes)
Powered by blists - more mailing lists