From: Jens Axboe <axboe@kernel.dk>
To: Ming Lei <ming.lei@redhat.com>,
Caleb Sander Mateos <csander@purestorage.com>
Cc: linux-block@vger.kernel.org
Subject: Re: [PATCH v2 00/10] ublk: add shared memory zero-copy support
Date: Wed, 8 Apr 2026 06:52:48 -0600 [thread overview]
Message-ID: <0f4ef4e8-ad8c-4ea6-9b86-04aad5fc84b7@kernel.dk> (raw)
In-Reply-To: <adXFm1dlDzcikarF@fedora>
On 4/7/26 9:03 PM, Ming Lei wrote:
> On Tue, Apr 07, 2026 at 12:29:39PM -0700, Caleb Sander Mateos wrote:
>> On Mon, Apr 6, 2026 at 7:39 PM Ming Lei <ming.lei@redhat.com> wrote:
>>>
>>> On Tue, Mar 31, 2026 at 11:31:51PM +0800, Ming Lei wrote:
>>>> Hello,
>>>>
>>>> Add shared memory based zero-copy (UBLK_F_SHMEM_ZC) support for ublk.
>>>>
>>>> The ublk server and its client share a memory region (e.g. memfd or
>>>> hugetlbfs file) via MAP_SHARED mmap. The server registers this region
>>>> with the kernel via UBLK_U_CMD_REG_BUF, which pins the pages and
>>>> builds a PFN maple tree. When I/O arrives, the driver looks up bio
>>>> pages in the maple tree — if they match registered buffer pages, the
>>>> data is used directly without copying.
>>>>
>>>> Please see details on document added in patch 3.
>>>>
>>>> Patches 1-4 implement the kernel side:
>>>> - buffer register/unregister control commands with PFN coalescing,
>>>> including read-only buffer support (UBLK_SHMEM_BUF_READ_ONLY)
>>>> - PFN-based matching in the I/O path, with enforcement that read-only
>>>> buffers reject non-WRITE requests
>>>> - UBLK_F_SHMEM_ZC feature flag
>>>> - eliminate permanent pages[] array from struct ublk_buf; the maple
>>>> tree already stores PFN ranges, so pages[] becomes temporary
>>>>
>>>> Patches 5-10 add kublk (selftest server) support and tests:
>>>> - hugetlbfs buffer sharing (both kublk and fio mmap the same file)
>>>> - null target and loop target tests with fio verify
>>>> - filesystem-level test (ext4 on ublk, fio verify on a file)
>>>> - read-only buffer registration test (--rdonly_shmem_buf)
>>>>
>>>> Changes since V1:
>>>> - rename struct ublk_buf_reg to struct ublk_shmem_buf_reg, add __u32
>>>> flags field for extensibility, narrow __u64 len to __u32 (max 4GB
>>>> per UBLK_SHMEM_ZC_OFF_MASK), remove __u32 reserved (patch 1)
>>>> - add UBLK_SHMEM_BUF_READ_ONLY flag: pin pages without FOLL_WRITE,
>>>> enabling registration of write-sealed memfd buffers (patch 1)
>>>> - use backward-compatible struct reading: memset zero + copy
>>>> min(header->len, sizeof(struct)) (patch 1)
>>>> - reorder struct ublk_buf_range fields for better packing (16 bytes
>>>> vs 24 bytes), change buf_index to unsigned short, add unsigned short
>>>> flags to store per-range read-only state (patch 1)
>>>> - enforce read-only buffer semantics in ublk_try_buf_match(): reject
>>>> non-WRITE requests on read-only buffers since READ I/O needs to
>>>> write data into the buffer (patch 2)
>>>> - narrow struct ublk_buf::nr_pages to unsigned int, narrow struct
>>>> ublk_buf_range::base_offset to unsigned int (patch 1)
>>>> - add new patch 4: eliminate permanent pages[] array from struct
>>>> ublk_buf — recover struct page pointers via pfn_to_page() from the
>>>> maple tree during unregistration, saving 2MB per 1GB buffer
>>>> - add UBLK_F_SHMEM_ZC to feat_map in kublk (patch 5)
>>>> - add new patch 10: read-only buffer registration selftest with
>>>> --rdonly_shmem_buf option on null target + hugetlbfs
>>>
>>> Hello,
>>>
>>> Ping...
>>
>> Sorry I didn't get a chance to look at this earlier. It looks really
>> nice, thank you for implementing it! I have just a few comments. One
>> is about the UAPI (can we just use virtual addresses instead of buffer
>> index + offset), so I might wait on landing this patchset until we've
>> finalized that.
>
> Hi Jens,
>
> Can you drop V2 from for-7.1/block so that we can polish up it in V3?
>
> Or I am fine to cook up a followup for misc clean & fix?
Please just do a fixup series. If I drop it now, it's not going into
7.1, and the issues aren't that big of a deal to fix up.
--
Jens Axboe
next prev parent reply other threads:[~2026-04-08 12:52 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-31 15:31 [PATCH v2 00/10] ublk: add shared memory zero-copy support Ming Lei
2026-03-31 15:31 ` [PATCH v2 01/10] ublk: add UBLK_U_CMD_REG_BUF/UNREG_BUF control commands Ming Lei
2026-04-07 19:35 ` Caleb Sander Mateos
2026-04-08 2:23 ` Ming Lei
2026-04-08 15:20 ` Caleb Sander Mateos
2026-03-31 15:31 ` [PATCH v2 02/10] ublk: add PFN-based buffer matching in I/O path Ming Lei
2026-04-07 19:47 ` Caleb Sander Mateos
2026-04-08 2:36 ` Ming Lei
2026-04-08 15:28 ` Caleb Sander Mateos
2026-03-31 15:31 ` [PATCH v2 03/10] ublk: enable UBLK_F_SHMEM_ZC feature flag Ming Lei
2026-04-07 19:47 ` Caleb Sander Mateos
2026-04-08 2:50 ` Ming Lei
2026-03-31 15:31 ` [PATCH v2 04/10] ublk: eliminate permanent pages[] array from struct ublk_buf Ming Lei
2026-04-07 19:50 ` Caleb Sander Mateos
2026-04-08 2:58 ` Ming Lei
2026-03-31 15:31 ` [PATCH v2 05/10] selftests/ublk: add shared memory zero-copy support in kublk Ming Lei
2026-03-31 15:31 ` [PATCH v2 06/10] selftests/ublk: add UBLK_F_SHMEM_ZC support for loop target Ming Lei
2026-03-31 15:31 ` [PATCH v2 07/10] selftests/ublk: add shared memory zero-copy test Ming Lei
2026-03-31 15:31 ` [PATCH v2 08/10] selftests/ublk: add hugetlbfs shmem_zc test for loop target Ming Lei
2026-03-31 15:32 ` [PATCH v2 09/10] selftests/ublk: add filesystem fio verify test for shmem_zc Ming Lei
2026-03-31 15:32 ` [PATCH v2 10/10] selftests/ublk: add read-only buffer registration test Ming Lei
2026-04-07 2:38 ` [PATCH v2 00/10] ublk: add shared memory zero-copy support Ming Lei
2026-04-07 13:34 ` Jens Axboe
2026-04-07 19:29 ` Caleb Sander Mateos
2026-04-08 3:03 ` Ming Lei
2026-04-08 12:52 ` Jens Axboe [this message]
2026-04-07 13:44 ` Jens Axboe
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=0f4ef4e8-ad8c-4ea6-9b86-04aad5fc84b7@kernel.dk \
--to=axboe@kernel.dk \
--cc=csander@purestorage.com \
--cc=linux-block@vger.kernel.org \
--cc=ming.lei@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox