From: Caleb Sander Mateos <csander@purestorage.com>
To: Ming Lei <ming.lei@redhat.com>, Jens Axboe <axboe@kernel.dk>,
Shuah Khan <shuah@kernel.org>
Cc: linux-block@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org,
Stanley Zhang <stazhang@purestorage.com>,
Uday Shankar <ushankar@purestorage.com>,
Caleb Sander Mateos <csander@purestorage.com>
Subject: [PATCH 00/20] ublk: add support for integrity data
Date: Tue, 16 Dec 2025 22:34:34 -0700 [thread overview]
Message-ID: <20251217053455.281509-1-csander@purestorage.com> (raw)
Much work has recently gone into supporting block device integrity data
(sometimes called "metadata") in Linux. Many NVMe devices these days
support metadata transfers and/or automatic protection information
generation and verification. However, ublk devices can't yet advertise
integrity data capabilities. This patch series wires up support for
integrity data in ublk. The ublk feature is referred to as "integrity"
rather than "metadata" to match the block layer's name for it and to
avoid confusion with the existing and unrelated UBLK_IO_F_META.
To advertise support for integrity data, a ublk server fills out the
struct ublk_params's integrity field and sets UBLK_PARAM_TYPE_INTEGRITY.
The struct ublk_param_integrity flags and csum_type fields use the
existing LBMD_PI_* constants from the linux/fs.h UAPI header. The ublk
driver fills out a corresponding struct blk_integrity.
When a request with integrity data is issued to the ublk device, the
ublk driver sets UBLK_IO_F_INTEGRITY in struct ublksrv_io_desc's
op_flags field. This is necessary for a ublk server for which
bi_offload_capable() returns true to distinguish requests with integrity
data from those without.
Integrity data transfers can currently only be performed via the ublk
user copy mechanism. The overhead of zero-copy buffer registration makes
it less appealing for the small transfers typical of integrity data.
Additionally, neither io_uring NVMe passthru nor IORING_RW_ATTR_FLAG_PI
currently allow an io_uring registered buffer for the integrity data.
The ki_pos field of the struct kiocb passed to the user copy
->{read,write}_iter() callback gains a bit UBLKSRV_IO_INTEGRITY_FLAG for
a ublk server to indicate whether to access the request's data or
integrity data.
Not yet supported is an analogue for the IO_INTEGRITY_CHK_*/BIP_CHECK_*
flags to ask the ublk server to verify the guard, reftag, and/or apptag
of a request's protection information. The user copy mechanism currently
forbids a ublk server from reading the data/integrity buffer of a
read-direction request. We could potentially relax this restriction for
integrity data on reads. Alternatively, the ublk driver could verify the
requested fields as part of the user copy operation.
The first 2 commits harden blk_validate_integrity_limits() to reject
nonsensical pi_offset and interval_exp integrity limits.
Caleb Sander Mateos (17):
block: validate pi_offset integrity limit
block: validate interval_exp integrity limit
blk-integrity: take const pointer in blk_integrity_rq()
ublk: move ublk flag check functions earlier
ublk: set UBLK_IO_F_INTEGRITY in ublksrv_io_desc
ublk: add ublk_copy_user_bvec() helper
ublk: split out ublk_user_copy() helper
ublk: inline ublk_check_and_get_req() into ublk_user_copy()
ublk: move offset check out of __ublk_check_and_get_req()
ublk: optimize ublk_user_copy() on daemon task
selftests: ublk: add utility to get block device metadata size
selftests: ublk: add kublk support for integrity params
selftests: ublk: implement integrity user copy in kublk
selftests: ublk: support non-O_DIRECT backing files
selftests: ublk: add integrity data support to loop target
selftests: ublk: add integrity params test
selftests: ublk: add end-to-end integrity test
Stanley Zhang (3):
ublk: add integrity UAPI
ublk: support UBLK_PARAM_TYPE_INTEGRITY in device creation
ublk: implement integrity user copy
block/blk-settings.c | 14 +-
drivers/block/ublk_drv.c | 336 +++++++++++++------
include/linux/blk-integrity.h | 6 +-
include/uapi/linux/ublk_cmd.h | 20 +-
tools/testing/selftests/ublk/Makefile | 6 +-
tools/testing/selftests/ublk/common.c | 4 +-
tools/testing/selftests/ublk/fault_inject.c | 1 +
tools/testing/selftests/ublk/file_backed.c | 61 +++-
tools/testing/selftests/ublk/kublk.c | 85 ++++-
tools/testing/selftests/ublk/kublk.h | 37 +-
tools/testing/selftests/ublk/metadata_size.c | 37 ++
tools/testing/selftests/ublk/null.c | 1 +
tools/testing/selftests/ublk/stripe.c | 6 +-
tools/testing/selftests/ublk/test_common.sh | 10 +
tools/testing/selftests/ublk/test_loop_08.sh | 111 ++++++
tools/testing/selftests/ublk/test_null_04.sh | 166 +++++++++
16 files changed, 765 insertions(+), 136 deletions(-)
create mode 100644 tools/testing/selftests/ublk/metadata_size.c
create mode 100755 tools/testing/selftests/ublk/test_loop_08.sh
create mode 100755 tools/testing/selftests/ublk/test_null_04.sh
--
2.45.2
next reply other threads:[~2025-12-17 5:35 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-17 5:34 Caleb Sander Mateos [this message]
2025-12-17 5:34 ` [PATCH 01/20] block: validate pi_offset integrity limit Caleb Sander Mateos
2025-12-18 8:53 ` Christoph Hellwig
2025-12-17 5:34 ` [PATCH 02/20] block: validate interval_exp " Caleb Sander Mateos
2025-12-18 8:53 ` Christoph Hellwig
2025-12-17 5:34 ` [PATCH 03/20] blk-integrity: take const pointer in blk_integrity_rq() Caleb Sander Mateos
2025-12-19 14:16 ` Ming Lei
2025-12-17 5:34 ` [PATCH 04/20] ublk: add integrity UAPI Caleb Sander Mateos
2025-12-22 14:26 ` Ming Lei
2025-12-22 15:09 ` Caleb Sander Mateos
2025-12-23 1:51 ` Ming Lei
2025-12-17 5:34 ` [PATCH 05/20] ublk: move ublk flag check functions earlier Caleb Sander Mateos
2025-12-22 14:30 ` Ming Lei
2025-12-17 5:34 ` [PATCH 06/20] ublk: support UBLK_PARAM_TYPE_INTEGRITY in device creation Caleb Sander Mateos
2025-12-22 14:47 ` Ming Lei
2025-12-22 15:35 ` Caleb Sander Mateos
2025-12-23 1:58 ` Ming Lei
2025-12-17 5:34 ` [PATCH 07/20] ublk: set UBLK_IO_F_INTEGRITY in ublksrv_io_desc Caleb Sander Mateos
2025-12-22 14:48 ` Ming Lei
2025-12-17 5:34 ` [PATCH 08/20] ublk: add ublk_copy_user_bvec() helper Caleb Sander Mateos
2025-12-22 14:52 ` Ming Lei
2025-12-22 15:37 ` Caleb Sander Mateos
2025-12-17 5:34 ` [PATCH 09/20] ublk: split out ublk_user_copy() helper Caleb Sander Mateos
2025-12-22 14:58 ` Ming Lei
2025-12-17 5:34 ` [PATCH 10/20] ublk: inline ublk_check_and_get_req() into ublk_user_copy() Caleb Sander Mateos
2025-12-26 2:10 ` Ming Lei
2025-12-17 5:34 ` [PATCH 11/20] ublk: move offset check out of __ublk_check_and_get_req() Caleb Sander Mateos
2025-12-26 2:15 ` Ming Lei
2025-12-17 5:34 ` [PATCH 12/20] ublk: implement integrity user copy Caleb Sander Mateos
2025-12-26 2:38 ` Ming Lei
2025-12-17 5:34 ` [PATCH 13/20] ublk: optimize ublk_user_copy() on daemon task Caleb Sander Mateos
2025-12-26 2:51 ` Ming Lei
2025-12-17 5:34 ` [PATCH 14/20] selftests: ublk: add utility to get block device metadata size Caleb Sander Mateos
2025-12-17 5:34 ` [PATCH 15/20] selftests: ublk: add kublk support for integrity params Caleb Sander Mateos
2025-12-17 5:34 ` [PATCH 16/20] selftests: ublk: implement integrity user copy in kublk Caleb Sander Mateos
2025-12-17 5:34 ` [PATCH 17/20] selftests: ublk: support non-O_DIRECT backing files Caleb Sander Mateos
2025-12-17 5:34 ` [PATCH 18/20] selftests: ublk: add integrity data support to loop target Caleb Sander Mateos
2025-12-17 5:34 ` [PATCH 19/20] selftests: ublk: add integrity params test Caleb Sander Mateos
2025-12-17 5:34 ` [PATCH 20/20] selftests: ublk: add end-to-end integrity test Caleb Sander Mateos
2025-12-18 16:54 ` (subset) [PATCH 00/20] ublk: add support for integrity data 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=20251217053455.281509-1-csander@purestorage.com \
--to=csander@purestorage.com \
--cc=axboe@kernel.dk \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=shuah@kernel.org \
--cc=stazhang@purestorage.com \
--cc=ushankar@purestorage.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;
as well as URLs for NNTP newsgroup(s).