<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/io_uring/dma-buf.c, branch master</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>treewide: refresh kmalloc_obj() conversions</title>
<updated>2026-11-06T05:55:37+00:00</updated>
<author>
<name>Kees Cook</name>
<email>kees+treewide@kernel.org</email>
</author>
<published>2026-10-29T06:08:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=0af298e62e5cff4ebf9bec47b8711177a7e2f115'/>
<id>0af298e62e5cff4ebf9bec47b8711177a7e2f115</id>
<content type='text'>
Refresh the tree with run of the existing Coccinelle rules in
scripts/coccinelle/api/kmalloc_objs.cocci, now that they also convert
arrays of multi-byte integers.

The conversions break down as:

	435	kzalloc_objs()
	169	kmalloc_objs()
	 52	kvzalloc_objs()
	 47	kzalloc_obj()
	 42	kvmalloc_objs()
	  8	kmalloc_obj()
	  2	kzalloc_flex()
	  2	kvmalloc_flex()

and 37 existing kmalloc_obj() family calls drop a redundant GFP_KERNEL.

Build tested with allmodconfig on x86_64 with GCC 16.2.0, and, together
with the devm_kmalloc_obj() conversion that follows, on x86_64, arm64,
i386, arm, riscv, s390, m68k, mips, parisc, sparc, loongarch, arc,
xtensa, and openrisc with GCC 16.2.0 with no new warnings.

Signed-off-by: Kees Cook &lt;kees+treewide@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Refresh the tree with run of the existing Coccinelle rules in
scripts/coccinelle/api/kmalloc_objs.cocci, now that they also convert
arrays of multi-byte integers.

The conversions break down as:

	435	kzalloc_objs()
	169	kmalloc_objs()
	 52	kvzalloc_objs()
	 47	kzalloc_obj()
	 42	kvmalloc_objs()
	  8	kmalloc_obj()
	  2	kzalloc_flex()
	  2	kvmalloc_flex()

and 37 existing kmalloc_obj() family calls drop a redundant GFP_KERNEL.

Build tested with allmodconfig on x86_64 with GCC 16.2.0, and, together
with the devm_kmalloc_obj() conversion that follows, on x86_64, arm64,
i386, arm, riscv, s390, m68k, mips, parisc, sparc, loongarch, arc,
xtensa, and openrisc with GCC 16.2.0 with no new warnings.

Signed-off-by: Kees Cook &lt;kees+treewide@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>io_uring/dma-buf: allow cloning registered dma-bufs</title>
<updated>2026-10-16T14:23:04+00:00</updated>
<author>
<name>Pavel Begunkov</name>
<email>asml.silence@gmail.com</email>
</author>
<published>2026-10-16T09:26:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=f57b957778a33d98e15e394ab426e93c3ead659c'/>
<id>f57b957778a33d98e15e394ab426e93c3ead659c</id>
<content type='text'>
One problem that was brought up is that the file table size is often a
limiting factor when working with dma-bufs, which is quite an old
problem. With a single io_uring people can work it around by closing
the dma-buf fd after registration, but for more complex cases we need
a way to dynamically register it into another ring. We also need to
deduplicate internal registrations as each creates a new attachment and
related structures, which could involve large allocations and iommu
mappings. Solve it by enabling io_uring buffer cloning.

I made dma-bufs registered for io_uring not cloneable between rings
because the implementation could modify parts of struct io_buf_dma
without any locking and sharing it would've created races. That was an
optimisation that got dropped at some point for simplicity, so we can
safely enable cloning back as long as IORING_SETUP_IOPOLL rejection
is honoured. Kill the uncloneable flag as unused as well.

Reported-by: William Power &lt;william.power@intel.com&gt;
Reported-by: Tushar Gohad &lt;tushar.gohad@intel.com&gt;
Signed-off-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt;
Link: https://patch.msgid.link/b76cf21ee0e2362489c864e43781b20d95fd75f7.1792142588.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
One problem that was brought up is that the file table size is often a
limiting factor when working with dma-bufs, which is quite an old
problem. With a single io_uring people can work it around by closing
the dma-buf fd after registration, but for more complex cases we need
a way to dynamically register it into another ring. We also need to
deduplicate internal registrations as each creates a new attachment and
related structures, which could involve large allocations and iommu
mappings. Solve it by enabling io_uring buffer cloning.

I made dma-bufs registered for io_uring not cloneable between rings
because the implementation could modify parts of struct io_buf_dma
without any locking and sharing it would've created races. That was an
optimisation that got dropped at some point for simplicity, so we can
safely enable cloning back as long as IORING_SETUP_IOPOLL rejection
is honoured. Kill the uncloneable flag as unused as well.

Reported-by: William Power &lt;william.power@intel.com&gt;
Reported-by: Tushar Gohad &lt;tushar.gohad@intel.com&gt;
Signed-off-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt;
Link: https://patch.msgid.link/b76cf21ee0e2362489c864e43781b20d95fd75f7.1792142588.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>io_uring/rsrc: add dmabuf backed registered buffers</title>
<updated>2026-10-14T13:36:03+00:00</updated>
<author>
<name>Pavel Begunkov</name>
<email>asml.silence@gmail.com</email>
</author>
<published>2026-10-14T11:02:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=62e4bf5b25d4458cf8aa9dece9022359f39f2294'/>
<id>62e4bf5b25d4458cf8aa9dece9022359f39f2294</id>
<content type='text'>
Implement dmabuf backed registered buffers. To register them, the user
should specify IO_REGBUF_TYPE_DMABUF for the regitration and pass the
desired dmabuf fd and a file for which it should be registered.

&gt;From there, it can be used with io_uring read/write requests
IORING_OP_{READ,WRITE}_FIXED) as normal. The requests should be issued
against the file specified during registration, and otherwise they'll be
failed. The user should also be prepared to handle spurious -EAGAIN by
reissuing the request.

Internally, dmabuf registered buffers is an optin feature for io_uring
request opcodes and they should pass a special flag on import to use it.

Suggested-by: David Wei &lt;dw@davidwei.uk&gt;
Suggested-by: Vishal Verma &lt;vishal1.verma@intel.com&gt;
Suggested-by: Tushar Gohad &lt;tushar.gohad@intel.com&gt;
Signed-off-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt;
Link: https://patch.msgid.link/4aa230df871ee275536f367087b44ebfebb88cc1.1791975048.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Implement dmabuf backed registered buffers. To register them, the user
should specify IO_REGBUF_TYPE_DMABUF for the regitration and pass the
desired dmabuf fd and a file for which it should be registered.

&gt;From there, it can be used with io_uring read/write requests
IORING_OP_{READ,WRITE}_FIXED) as normal. The requests should be issued
against the file specified during registration, and otherwise they'll be
failed. The user should also be prepared to handle spurious -EAGAIN by
reissuing the request.

Internally, dmabuf registered buffers is an optin feature for io_uring
request opcodes and they should pass a special flag on import to use it.

Suggested-by: David Wei &lt;dw@davidwei.uk&gt;
Suggested-by: Vishal Verma &lt;vishal1.verma@intel.com&gt;
Suggested-by: Tushar Gohad &lt;tushar.gohad@intel.com&gt;
Signed-off-by: Pavel Begunkov &lt;asml.silence@gmail.com&gt;
Link: https://patch.msgid.link/4aa230df871ee275536f367087b44ebfebb88cc1.1791975048.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe &lt;axboe@kernel.dk&gt;
</pre>
</div>
</content>
</entry>
</feed>
