From: Li Wang <liwang@kylinos.cn>
To: Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>,
"Pavel Begunkov" <asml.silence@gmail.com>,
linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org,
linaro-mm-sig@lists.linaro.org, io-uring@vger.kernel.org,
linux-kernel@vger.kernel.org, "Li Wang" <liwang@kylinos.cn>
Subject: [RFC PATCH v2 0/1] misc: fgds: introduce GPU-File direct I/O via dma-buf
Date: Tue, 27 Oct 2026 17:08:52 +0800 [thread overview]
Message-ID: <20261027090853.30099-1-liwang@kylinos.cn> (raw)
In-Reply-To: <20260908131545.105987-1-liwang@kylinos.cn>
This patch introduces a driver named fgds that allows moving data between
a GPU dma-buf and a regular file on NVME without staging it through the
page cache. This is particularly useful for LLM workloads, such as model
loading, KV cache offloading, and checkpointing. The fgds device
corresponds one-to-one with the PCIe GPU on the machine. The usage is
straightforward: an application first calls ioctl on the corresponding
fgds device with REGISTER_BUF, passing the target GPU memory buffer
address (represented as a dma-buf fd). Subsequently, the application can
perform direct data transfer between a regular file on NVMe and GPU memory
by invoking ioctl on the fgds device with READ/WRITE, passing the file
descriptor and the handle returned by REGISTER_BUF.
This solution allows both applications and the fgds device to work
seamlessly with GPUs from different vendors without any modifications.
Furthermore, applications no longer need to call vendor-specific
proprietary APIs (such as NVIDIA's cuFile API) or install vendor-specific
kernel modules (such as NVIDIA's nvidia-fs.ko) for different GPU vendors.
We have tested fgds on NVDIA and AMD GPU cards, and theoretically, it also
works on GPUs from other vendors that support exporting GPU memory via
dma-buf. Some performance test results can be found in [1].
This implementation offers several advantages:
- Simplicity and Efficiency: It provides a lightweight and intuitive
interface. The single ioctl call mimics the parameter structure of
pread/pwrite, and its return value semantics are fully compatible with
pread/pwrite
- Isolation and Security: The interface is independent and has a minimal
impact scope. This isolation facilitates fine-grained permission control
on the device node, enhancing security management
Changes since v1:
- Refactor implementation per Christian's feedback, on top of Pavel's
DMA-buf support for io_uring [2]
- Add validation checks in the XFS I/O submission path to ensure that
bios with the REQ_DMABUF flag are only processed via direct I/O, and
prevents the kernel from attempting to fall back to buffered I/O, which
is incompatible with DMA-buf backed GPU memory regions. While currently
supports only XFS, the underlying mechanism is filesystem-agnostic and
can be adapted for other filesystems with similar minor changes
- Address the comments from Greg and the Sashiko AI
[1] https://github.com/Storage-and-OS-for-AI/fgds
[2] https://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux.git/
tag/?h=for-7.4/io_uring-dmabuf-20261023
Mengmeng Zhao (1):
misc: fgds: introduce GPU-File direct I/O via dma-buf
.../userspace-api/ioctl/ioctl-number.rst | 2 +
drivers/dma-buf/dma-buf-io.c | 3 +
drivers/misc/Kconfig | 16 +
drivers/misc/Makefile | 1 +
drivers/misc/fgds.c | 506 ++++++++++++++++++
fs/iomap/buffered-io.c | 11 +
fs/iomap/direct-io.c | 23 +-
fs/xfs/xfs_file.c | 4 +
include/linux/iov_iter.h | 4 +
include/uapi/linux/fgds.h | 124 +++++
lib/iov_iter.c | 1 +
mm/filemap.c | 22 +-
12 files changed, 713 insertions(+), 4 deletions(-)
create mode 100644 drivers/misc/fgds.c
create mode 100644 include/uapi/linux/fgds.h
--
2.34.1
next prev parent reply other threads:[~2026-10-27 9:09 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 13:15 [RFC PATCH] misc: fgds: enable GPU-NVMe direct I/O via POSIX and io_uring Li Wang
2026-09-09 6:10 ` Greg Kroah-Hartman
2026-09-09 10:42 ` Li Wang
2026-09-09 13:35 ` Greg Kroah-Hartman
2026-09-09 13:45 ` Christian König
2026-09-10 3:57 ` Li Wang
2026-09-10 8:35 ` Christian König
2026-09-12 12:45 ` Pavel Begunkov
2026-10-27 9:08 ` Li Wang [this message]
2026-10-27 9:08 ` [RFC PATCH v2 1/1] misc: fgds: introduce GPU-File direct I/O via dma-buf Li Wang
2026-10-27 13:03 ` Jens Axboe
2026-10-27 13:12 ` Greg Kroah-Hartman
2026-10-27 13:12 ` Christian König
2026-10-27 13:54 ` [RFC PATCH v2 0/1] " Pavel Begunkov
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=20261027090853.30099-1-liwang@kylinos.cn \
--to=liwang@kylinos.cn \
--cc=arnd@arndb.de \
--cc=asml.silence@gmail.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=gregkh@linuxfoundation.org \
--cc=io-uring@vger.kernel.org \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=sumit.semwal@linaro.org \
/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
all inboxes | Powered by JetHome®