* [blktests v2 0/2] io_uring PI interface test
[not found] <CGME20250919101117epcas5p3db87ea9641b5694dc0a44a24d7b898fb@epcas5p3.samsung.com>
@ 2025-09-19 10:10 ` Anuj Gupta
2025-09-19 10:10 ` [blktests v2 1/2] common/nvme: move NVMe helper checks out of tests/nvme/rc Anuj Gupta
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Anuj Gupta @ 2025-09-19 10:10 UTC (permalink / raw)
To: vincent.fu, anuj1072538, axboe, hch, martin.petersen,
shinichiro.kawasaki
Cc: linux-block, joshi.k, Anuj Gupta
Hi all,
This series adds test for io_uring PI interface.
Patch 1 is a prep patch and moves helpers from tests/nvme/rc to
common/nvme
Patch 2 adds the test for the interface
Anuj Gupta (2):
common/nvme: move NVMe helper checks out of tests/nvme/rc
block: add test for io_uring Protection Information (PI) interface
using FS_IOC_GETLBMD_CAP
common/nvme | 41 +++++++++++++++++++++++++
src/.gitignore | 1 +
src/Makefile | 1 +
src/ioctl-lbmd-query.c | 65 +++++++++++++++++++++++++++++++++++++++
tests/block/041 | 70 ++++++++++++++++++++++++++++++++++++++++++
tests/block/041.out | 2 ++
tests/nvme/rc | 41 -------------------------
7 files changed, 180 insertions(+), 41 deletions(-)
create mode 100644 src/ioctl-lbmd-query.c
create mode 100755 tests/block/041
create mode 100644 tests/block/041.out
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [blktests v2 1/2] common/nvme: move NVMe helper checks out of tests/nvme/rc
2025-09-19 10:10 ` [blktests v2 0/2] io_uring PI interface test Anuj Gupta
@ 2025-09-19 10:10 ` Anuj Gupta
2025-09-24 2:19 ` Martin K. Petersen
2025-09-19 10:10 ` [blktests v2 2/2] block: add test for io_uring Protection Information (PI) interface using FS_IOC_GETLBMD_CAP Anuj Gupta
2025-09-24 8:34 ` [blktests v2 0/2] io_uring PI interface test Shinichiro Kawasaki
2 siblings, 1 reply; 5+ messages in thread
From: Anuj Gupta @ 2025-09-19 10:10 UTC (permalink / raw)
To: vincent.fu, anuj1072538, axboe, hch, martin.petersen,
shinichiro.kawasaki
Cc: linux-block, joshi.k, Anuj Gupta
Move some of the NVMe capability helpers from tests/nvme/rc to
common/nvme/ so they can be sourced from tests outside the nvme/ group
(e.g. tests/block). No functional changes.
Suggested-by: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
---
common/nvme | 41 +++++++++++++++++++++++++++++++++++++++++
tests/nvme/rc | 41 -----------------------------------------
2 files changed, 41 insertions(+), 41 deletions(-)
diff --git a/common/nvme b/common/nvme
index 8de41fa..e893f29 100644
--- a/common/nvme
+++ b/common/nvme
@@ -1102,3 +1102,44 @@ _nvmet_target_cleanup() {
_cleanup_blkdev
fi
}
+
+_require_test_dev_is_nvme() {
+ if ! readlink -f "$TEST_DEV_SYSFS/device" | grep -q nvme; then
+ SKIP_REASONS+=("$TEST_DEV is not a NVMe device")
+ return 1
+ fi
+ return 0
+}
+
+_test_dev_has_metadata() {
+ if [ ! -e "${TEST_DEV_SYSFS}/metadata_bytes" ] || \
+ (( ! $(<"${TEST_DEV_SYSFS}/metadata_bytes") )); then
+ SKIP_REASONS+=("$TEST_DEV does not have metadata")
+ return 1
+ fi
+ return 0
+}
+
+_test_dev_has_no_metadata() {
+ if [ -e "${TEST_DEV_SYSFS}/metadata_bytes" ] &&
+ (( $(<"${TEST_DEV_SYSFS}/metadata_bytes") )); then
+ SKIP_REASONS+=("$TEST_DEV has metadata")
+ return 1
+ fi
+ return 0
+}
+
+_test_dev_disables_extended_lba() {
+ local flbas
+
+ if ! flbas=$(nvme id-ns "$TEST_DEV" | grep flbas | \
+ sed --quiet 's/.*: \(.*\)/\1/p'); then
+ SKIP_REASONS+=("$TEST_DEV does not have namespace flbas field")
+ return 1
+ fi
+ if (( flbas & 0x10 )); then
+ SKIP_REASONS+=("$TEST_DEV enables NVME_NS_FLBAS_META_EXT")
+ return 1
+ fi
+ return 0
+}
diff --git a/tests/nvme/rc b/tests/nvme/rc
index a1a4ce2..23c6c51 100644
--- a/tests/nvme/rc
+++ b/tests/nvme/rc
@@ -129,14 +129,6 @@ group_device_requires() {
_require_test_dev_is_nvme
}
-_require_test_dev_is_nvme() {
- if ! readlink -f "$TEST_DEV_SYSFS/device" | grep -q nvme; then
- SKIP_REASONS+=("$TEST_DEV is not a NVMe device")
- return 1
- fi
- return 0
-}
-
_require_test_dev_is_nvme_pci() {
if [[ ! "$(readlink -f "$TEST_DEV_SYSFS/device")" =~ devices/pci ]]; then
SKIP_REASONS+=("$TEST_DEV is not a PCI NVMe device")
@@ -165,39 +157,6 @@ _require_test_dev_support_sed() {
return 1
}
-_test_dev_has_metadata() {
- if [ ! -e "${TEST_DEV_SYSFS}/metadata_bytes" ] || \
- (( ! $(<"${TEST_DEV_SYSFS}/metadata_bytes") )); then
- SKIP_REASONS+=("$TEST_DEV does not have metadata")
- return 1
- fi
- return 0
-}
-
-_test_dev_has_no_metadata() {
- if [ -e "${TEST_DEV_SYSFS}/metadata_bytes" ] &&
- (( $(<"${TEST_DEV_SYSFS}/metadata_bytes") )); then
- SKIP_REASONS+=("$TEST_DEV has metadata")
- return 1
- fi
- return 0
-}
-
-_test_dev_disables_extended_lba() {
- local flbas
-
- if ! flbas=$(nvme id-ns "$TEST_DEV" | grep flbas | \
- sed --quiet 's/.*: \(.*\)/\1/p'); then
- SKIP_REASONS+=("$TEST_DEV does not have namespace flbas field")
- return 1
- fi
- if (( flbas & 0x10 )); then
- SKIP_REASONS+=("$TEST_DEV enables NVME_NS_FLBAS_META_EXT")
- return 1
- fi
- return 0
-}
-
_require_nvme_test_img_size() {
local require_sz_mb
local nvme_img_size_mb
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [blktests v2 2/2] block: add test for io_uring Protection Information (PI) interface using FS_IOC_GETLBMD_CAP
2025-09-19 10:10 ` [blktests v2 0/2] io_uring PI interface test Anuj Gupta
2025-09-19 10:10 ` [blktests v2 1/2] common/nvme: move NVMe helper checks out of tests/nvme/rc Anuj Gupta
@ 2025-09-19 10:10 ` Anuj Gupta
2025-09-24 8:34 ` [blktests v2 0/2] io_uring PI interface test Shinichiro Kawasaki
2 siblings, 0 replies; 5+ messages in thread
From: Anuj Gupta @ 2025-09-19 10:10 UTC (permalink / raw)
To: vincent.fu, anuj1072538, axboe, hch, martin.petersen,
shinichiro.kawasaki
Cc: linux-block, joshi.k, Anuj Gupta
This test verifies end-to-end support for integrity metadata via the
io-uring interface. It uses the FS_IOC_GETLBMD_CAP ioctl to query the
logical block metadata capabilities of the device. These values are then
passed to fio using the md_per_io_size option.
io_uring PI interface: https://lore.kernel.org/all/20241128112240.8867-1-anuj20.g@samsung.com/
fio support for interface: https://lore.kernel.org/all/20250725175808.2632-2-vincent.fu@samsung.com/
ioctl: https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git/log/?h=vfs-6.17.integrity
Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
---
src/.gitignore | 1 +
src/Makefile | 1 +
src/ioctl-lbmd-query.c | 65 ++++++++++++++++++++++++++++++++++++++
tests/block/041 | 71 ++++++++++++++++++++++++++++++++++++++++++
tests/block/041.out | 2 ++
5 files changed, 140 insertions(+)
create mode 100644 src/ioctl-lbmd-query.c
create mode 100755 tests/block/041
create mode 100644 tests/block/041.out
diff --git a/src/.gitignore b/src/.gitignore
index 399a046..2ece754 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -10,3 +10,4 @@
/zbdioctl
/miniublk
/nvme-passthrough-meta
+/ioctl-lbmd-query
diff --git a/src/Makefile b/src/Makefile
index f91ac62..ba0d9b7 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -14,6 +14,7 @@ C_TARGETS := \
loop_get_status_null \
mount_clear_sock \
nvme-passthrough-meta \
+ ioctl-lbmd-query \
nbdsetsize \
openclose \
sg/dxfer-from-dev \
diff --git a/src/ioctl-lbmd-query.c b/src/ioctl-lbmd-query.c
new file mode 100644
index 0000000..cf6344d
--- /dev/null
+++ b/src/ioctl-lbmd-query.c
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: GPL-3.0+
+// Copyright (C) 2025 Anuj Gupta
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <linux/fs.h>
+#include <errno.h>
+
+#ifndef FS_IOC_GETLBMD_CAP
+#define FS_IOC_GETLBMD_CAP _IOWR(0x15, 2, struct logical_block_metadata_cap)
+
+#define LBMD_PI_CAP_INTEGRITY (1 << 0)
+
+struct logical_block_metadata_cap {
+ __u32 lbmd_flags;
+ __u16 lbmd_interval;
+ __u8 lbmd_size;
+ __u8 lbmd_opaque_size;
+ __u8 lbmd_opaque_offset;
+ __u8 lbmd_pi_size;
+ __u8 lbmd_pi_offset;
+ __u8 lbmd_guard_tag_type;
+ __u8 lbmd_app_tag_size;
+ __u8 lbmd_ref_tag_size;
+ __u8 lbmd_storage_tag_size;
+ __u8 pad;
+};
+#endif
+
+int main(int argc, char *argv[])
+{
+ if (argc != 2) {
+ fprintf(stderr, "Usage: %s <block-device>\n", argv[0]);
+ return 1;
+ }
+
+ const char *dev = argv[1];
+ int fd = open(dev, O_RDONLY);
+
+ if (fd < 0) {
+ perror("open");
+ return 1;
+ }
+
+ struct logical_block_metadata_cap cap = {};
+
+ if (ioctl(fd, FS_IOC_GETLBMD_CAP, &cap) < 0) {
+ perror("FS_IOC_GETLBMD_CAP");
+ close(fd);
+ return 1;
+ }
+ close(fd);
+
+ if (!(cap.lbmd_flags & LBMD_PI_CAP_INTEGRITY)) {
+ printf("unsupported\n");
+ return 0;
+ }
+
+ printf("lbmd_flags=%u lbmd_interval=%u lbmd_size=%u\n",
+ cap.lbmd_flags, cap.lbmd_interval, cap.lbmd_size);
+ return 0;
+}
diff --git a/tests/block/041 b/tests/block/041
new file mode 100755
index 0000000..1237982
--- /dev/null
+++ b/tests/block/041
@@ -0,0 +1,71 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2025 Anuj Gupta, Samsung Electronics
+
+# Test: io_uring read with metadata buffer using FIO's io_uring PI interface
+
+. tests/block/rc
+. common/nvme
+
+DESCRIPTION="io_uring read with PI metadata buffer on block device"
+
+device_requires() {
+ _require_test_dev_is_nvme
+ _test_dev_has_metadata
+ _test_dev_disables_extended_lba
+}
+
+requires() {
+ _have_fio
+ _have_kernel_option IO_URING
+ _have_kernel_option BLK_DEV_INTEGRITY
+ _have_fio_ver 3 40
+}
+
+test_device() {
+ echo "Running ${TEST_NAME}"
+
+ # shellcheck disable=SC2034
+ local lbmd_flags lbmd_size lbmd_interval
+ local cap_out bs md_per_io_size
+
+ # Query integrity capabilities via ioctl helper
+ cap_out=$(src/ioctl-lbmd-query "$TEST_DEV")
+ ret=$?
+ if [[ $ret != 0 ]]; then
+ SKIP_REASONS+=("FS_IOC_GETLBMD_CAP ioctl not supported")
+ return
+ fi
+ if [[ $cap_out == "unsupported" ]]; then
+ SKIP_REASONS+=("Integrity not supported on $TEST_DEV")
+ return
+ fi
+
+ # Parse fields
+ eval "$cap_out" # sets lbmd_flags, lbmd_size, lbmd_interval
+
+ # Calculate md_per_io_size = (bs / interval) * size
+ bs=$(_min_io "$TEST_DEV")
+ md_per_io_size=$((bs * lbmd_size / lbmd_interval))
+
+ local fio_args=(
+ --name=pi_read_test
+ --filename="$TEST_DEV"
+ --size=1M
+ --bs="$bs"
+ --rw=write
+ --ioengine=io_uring
+ --iodepth=8
+ --numjobs=1
+ --direct=1
+ --time_based
+ --runtime=3
+ --md_per_io_size="$md_per_io_size"
+ --pi_act=0 # Host supplies metadata
+ --pi_chk=APPTAG # Only check app tag
+ --apptag=0x1234
+ )
+
+ _run_fio "${fio_args[@]}"
+ echo "Test complete"
+}
diff --git a/tests/block/041.out b/tests/block/041.out
new file mode 100644
index 0000000..6706a76
--- /dev/null
+++ b/tests/block/041.out
@@ -0,0 +1,2 @@
+Running block/041
+Test complete
--
2.25.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [blktests v2 1/2] common/nvme: move NVMe helper checks out of tests/nvme/rc
2025-09-19 10:10 ` [blktests v2 1/2] common/nvme: move NVMe helper checks out of tests/nvme/rc Anuj Gupta
@ 2025-09-24 2:19 ` Martin K. Petersen
0 siblings, 0 replies; 5+ messages in thread
From: Martin K. Petersen @ 2025-09-24 2:19 UTC (permalink / raw)
To: Anuj Gupta
Cc: vincent.fu, anuj1072538, axboe, hch, martin.petersen,
shinichiro.kawasaki, linux-block, joshi.k
Anuj,
> Move some of the NVMe capability helpers from tests/nvme/rc to
> common/nvme/ so they can be sourced from tests outside the nvme/ group
> (e.g. tests/block). No functional changes.
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
--
Martin K. Petersen
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [blktests v2 0/2] io_uring PI interface test
2025-09-19 10:10 ` [blktests v2 0/2] io_uring PI interface test Anuj Gupta
2025-09-19 10:10 ` [blktests v2 1/2] common/nvme: move NVMe helper checks out of tests/nvme/rc Anuj Gupta
2025-09-19 10:10 ` [blktests v2 2/2] block: add test for io_uring Protection Information (PI) interface using FS_IOC_GETLBMD_CAP Anuj Gupta
@ 2025-09-24 8:34 ` Shinichiro Kawasaki
2 siblings, 0 replies; 5+ messages in thread
From: Shinichiro Kawasaki @ 2025-09-24 8:34 UTC (permalink / raw)
To: Anuj Gupta
Cc: vincent.fu@samsung.com, anuj1072538@gmail.com, axboe@kernel.dk,
hch@infradead.org, martin.petersen@oracle.com,
linux-block@vger.kernel.org, joshi.k@samsung.com
On Sep 19, 2025 / 15:40, Anuj Gupta wrote:
> Hi all,
> This series adds test for io_uring PI interface.
> Patch 1 is a prep patch and moves helpers from tests/nvme/rc to
> common/nvme
> Patch 2 adds the test for the interface
>
> Anuj Gupta (2):
> common/nvme: move NVMe helper checks out of tests/nvme/rc
> block: add test for io_uring Protection Information (PI) interface
> using FS_IOC_GETLBMD_CAP
Anuj, thanks for this v2 series. I applied it.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-24 8:34 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20250919101117epcas5p3db87ea9641b5694dc0a44a24d7b898fb@epcas5p3.samsung.com>
2025-09-19 10:10 ` [blktests v2 0/2] io_uring PI interface test Anuj Gupta
2025-09-19 10:10 ` [blktests v2 1/2] common/nvme: move NVMe helper checks out of tests/nvme/rc Anuj Gupta
2025-09-24 2:19 ` Martin K. Petersen
2025-09-19 10:10 ` [blktests v2 2/2] block: add test for io_uring Protection Information (PI) interface using FS_IOC_GETLBMD_CAP Anuj Gupta
2025-09-24 8:34 ` [blktests v2 0/2] io_uring PI interface test Shinichiro Kawasaki
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.