Skip to contentSkip to conversation

Recent changes (master)

PATCH Jens Axboe 1 participant 1 message Oct 13

lore
Share & tools
lore

Jens Axboe

author
#0 lore raw

The following changes since commit daf3f3b837f81ac2464c6a67bba829c984d65a3f:

Merge branch 'master' of https://github.com/rorychen/fio-HSMR (2026-10-01 14:26:20 -0400)

are available in the Git repository at:

git://git.kernel.dk/fio.git master

for you to fetch changes up to acb7a302059b0cc397c95a232a44cb14c524bbde:

Merge branch 'dmabuf-io_uringv1' of https://github.com/swarnagh6/fio (2026-10-12 19:21:58 -0400)

----------------------------------------------------------------
Swarna Prabhu (1):
engines/io_uring: add support for dmabuf backed fixed buffers

Vincent Fu (1):
Merge branch 'dmabuf-io_uringv1' of https://github.com/swarnagh6/fio

 HOWTO.rst           |  16 +++
 configure           |  32 +++++
 engines/io_uring.c  | 344 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 examples/dmabuf.fio |  14 +++
 fio.1               |  16 +++
 os/linux/io_uring.h |  23 +++-
 6 files changed, 439 insertions(+), 6 deletions(-)
 create mode 100644 examples/dmabuf.fio

---

Diff of recent changes:

HOWTO.rst +16 -0
index 3684fe70..0b39b01a 100644
@@ -2559,6 +2559,22 @@ with the caveat that when used on the command line, they must come after the
 	map and release for each IO. This is more efficient, and reduces the
 	IO latency as well.
 
+.. option:: dmabuf=str : [io_uring]
+
+	Select the DMA-BUF exporter for the IO buffers. Allowed values are:
+
+		**none**
+			Do not use DMA-BUF-backed buffers. This is the default.
+
+		**udmabuf**
+			Allocate the IO buffers from a udmabuf (``/dev/udmabuf``)
+			region and register them with io_uring as DMA-BUF-backed
+			fixed buffers, so that the device DMAs directly to/from the
+			DMA-BUF. Requires :option:`direct` =1; buffered IO is not
+			supported. Requires a kernel that supports the extended
+			buffer registration update. Not supported io_uring_cmd mode
+			as kernel lacks support for passthrough.
+
 .. option:: nonvectored=int : [io_uring] [io_uring_cmd]
 
 	With this option, fio will use non-vectored read/write commands, where
configure +32 -0
index 2ab83371..60d0ef98 100755
@@ -2709,6 +2709,38 @@ else
   nvme_uring_cmd="no"
 fi
 print_config "NVMe uring command support" "$nvme_uring_cmd"
+
+##########################################
+# Check udmabuf allocation support
+cat > $TMPC << EOF
+#define _GNU_SOURCE
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/ioctl.h>
+#include <linux/udmabuf.h>
+int main(void)
+{
+  struct udmabuf_create create = {
+    .memfd = 0,
+    .flags = 0,
+    .offset = 0,
+    .size = 4096,
+  };
+  int (*create_memfd)(const char *, unsigned int) = memfd_create;
+  int fd = create_memfd("fio-udmabuf", MFD_ALLOW_SEALING);
+
+  if (fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK) < 0)
+    return 1;
+  return ioctl(fd, UDMABUF_CREATE, &create);
+}
+EOF
+if compile_prog "" "" "udmabuf"; then
+  output_sym "CONFIG_UDMABUF"
+  udmabuf="yes"
+else
+  udmabuf="no"
+fi
+print_config "udmabuf allocation support" "$udmabuf"
 fi
 
 ##########################################
engines/io_uring.c +340 -4

426 lines not on this page · raw message

examples/dmabuf.fio new file +14 -0
new file mode 100644
index 00000000..49037bf1
@@ -0,0 +1,14 @@
+[global]
+filename=/dev/nvme1n1
+rw=write
+bs=4096
+direct=1
+runtime=30
+time_based=1
+group_reporting=1
+
+[file1]
+iodepth=128
+fixedbufs=0
+dmabuf=udmabuf
+ioengine=io_uring
\ No newline at end of file
fio.1 +16 -0
index 7dc5c353..08153d30 100644
@@ -2342,6 +2342,22 @@ release them when IO is done. If this option is set, the pages are pre-mapped
 before IO is started. This eliminates the need to map and release for each IO.
 This is more efficient, and reduces the IO latency as well.
 .TP
+.BI (io_uring)dmabuf \fR=\fPstr
+Select the DMA-BUF exporter for the IO buffers. Allowed values are:
+.RS
+.TP
+.B none
+Do not use DMA-BUF-backed buffers. This is the default.
+.TP
+.B udmabuf
+Allocate the IO buffers from a udmabuf (\fB/dev/udmabuf\fR) region and
+register them with io_uring as DMA-BUF-backed fixed buffers, so that the
+device DMAs directly to/from the DMA-BUF. Requires \fBdirect\fR=1;
+buffered IO is not supported. Requires a kernel that supports
+the extended buffer registration update. Not supported io_uring_cmd mode
+as kernel lacks support for passthrough.
+.RE
+.TP
 .BI (io_uring,io_uring_cmd)nonvectored \fR=\fPint
 With this option, fio will use non-vectored read/write commands, where address
 must contain the address directly. Default is -1.
os/linux/io_uring.h +21 -2
index cadcadae..00c86293 100644
@@ -463,7 +463,7 @@ struct io_uring_files_update {
 
 struct io_uring_rsrc_register {
 	__u32 nr;
-	__u32 resv;
+	__u32 flags;
 	__u64 resv2;
 	__aligned_u64 data;
 	__aligned_u64 tags;
@@ -477,7 +477,7 @@ struct io_uring_rsrc_update {
 
 struct io_uring_rsrc_update2 {
 	__u32 offset;
-	__u32 resv;
+	__u32 flags;
 	__aligned_u64 data;
 	__aligned_u64 tags;
 	__u32 nr;
@@ -541,4 +541,23 @@ struct io_uring_getevents_arg {
 	__u64	ts;
 };
 
+#define IORING_RSRC_REGISTER_SPARSE    (1U << 0)
+#define IORING_RSRC_UPDATE_EXTENDED   (1U << 1)
+
+enum io_uring_regbuf_type {
+	IO_REGBUF_TYPE_EMPTY,
+	IO_REGBUF_TYPE_UADDR,
+	IO_REGBUF_TYPE_DMABUF,
+};
+
+struct io_uring_regbuf_desc {
+	__u32 type;
+	__u32 flags;
+	__u64 size;
+	__u64 uaddr;
+	__s32 dmabuf_fd;
+	__s32 target_fd;
+	__u64 __resv[6];
+};
+
 #endif