All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] accel/rocket: Fix BO creation and prep_bo handling
@ 2026-12-04 17:40 ` Sidong Yang
  0 siblings, 0 replies; 9+ messages in thread
From: Sidong Yang @ 2026-12-04 17:40 UTC (permalink / raw)
  To: Tomeu Vizoso, Oded Gabbay
  Cc: Heiko Stuebner, Jeff Hugo, Haoming Gao, Hu Xinyao, dri-devel,
	linux-rockchip, linux-kernel

This series fixes three bugs in drivers/accel/rocket/rocket_gem.c, based
on drm-misc-fixes:

1. Store iommu_map_sgtable() return values in ssize_t (avoiding int
   truncation and leaked IOMMU mappings on >= 2 GiB allocations), size
   the drm_mm node from gem_obj->size, and unmap short mappings on error.
2. Skip dma_sync_sgtable_for_cpu() in rocket_ioctl_prep_bo() when the
   fence wait fails.
3. Wait on DMA_RESV_USAGE_READ in rocket_ioctl_prep_bo() so PREP_BO also
   waits for in-flight jobs that published read fences on input BOs.

Tested on a ROCK 5B+ (RK3588).

Changes in v2:
- Dropped "Reject zero-sized BO creation". Its description was wrong
  (the ioctl already fails with -ENOSPC, nothing crashes) and Hu Xinyao's
  patch [1] covers it. On top of [1], 1/3 needs "git am -3".
- 1/3: rebased without that patch.
- 2/3: reworded the commit message, dropped Cc: stable.

v1: https://lore.kernel.org/r/20261128063844.1537615-1-sidong.yang@furiosa.ai
[1] https://lore.kernel.org/r/2287DB0FF71AB8B8+1796018957.205946-1-huxinyao@kylinsec.com.cn

Sidong Yang (3):
  accel/rocket: Fix iommu_map_sgtable() return handling in create_bo
  accel/rocket: Skip CPU cache sync when prep_bo wait fails
  accel/rocket: Wait for read fences in rocket_ioctl_prep_bo()

 drivers/accel/rocket/rocket_gem.c | 37 ++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 13 deletions(-)


base-commit: ae720e1e682846a3c23ba572d96a38f46709bef0
-- 
2.53.0


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 0/3] accel/rocket: Fix BO creation and prep_bo handling
@ 2026-12-04 17:40 ` Sidong Yang
  0 siblings, 0 replies; 9+ messages in thread
From: Sidong Yang @ 2026-12-04 17:40 UTC (permalink / raw)
  To: Tomeu Vizoso, Oded Gabbay
  Cc: Heiko Stuebner, Jeff Hugo, Haoming Gao, Hu Xinyao, dri-devel,
	linux-rockchip, linux-kernel

This series fixes three bugs in drivers/accel/rocket/rocket_gem.c, based
on drm-misc-fixes:

1. Store iommu_map_sgtable() return values in ssize_t (avoiding int
   truncation and leaked IOMMU mappings on >= 2 GiB allocations), size
   the drm_mm node from gem_obj->size, and unmap short mappings on error.
2. Skip dma_sync_sgtable_for_cpu() in rocket_ioctl_prep_bo() when the
   fence wait fails.
3. Wait on DMA_RESV_USAGE_READ in rocket_ioctl_prep_bo() so PREP_BO also
   waits for in-flight jobs that published read fences on input BOs.

Tested on a ROCK 5B+ (RK3588).

Changes in v2:
- Dropped "Reject zero-sized BO creation". Its description was wrong
  (the ioctl already fails with -ENOSPC, nothing crashes) and Hu Xinyao's
  patch [1] covers it. On top of [1], 1/3 needs "git am -3".
- 1/3: rebased without that patch.
- 2/3: reworded the commit message, dropped Cc: stable.

v1: https://lore.kernel.org/r/20261128063844.1537615-1-sidong.yang@furiosa.ai
[1] https://lore.kernel.org/r/2287DB0FF71AB8B8+1796018957.205946-1-huxinyao@kylinsec.com.cn

Sidong Yang (3):
  accel/rocket: Fix iommu_map_sgtable() return handling in create_bo
  accel/rocket: Skip CPU cache sync when prep_bo wait fails
  accel/rocket: Wait for read fences in rocket_ioctl_prep_bo()

 drivers/accel/rocket/rocket_gem.c | 37 ++++++++++++++++++++-----------
 1 file changed, 24 insertions(+), 13 deletions(-)


base-commit: ae720e1e682846a3c23ba572d96a38f46709bef0
-- 
2.53.0


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/3] accel/rocket: Fix iommu_map_sgtable() return handling in create_bo
  2026-12-04 17:40 ` Sidong Yang
@ 2026-12-04 17:40   ` Sidong Yang
  -1 siblings, 0 replies; 9+ messages in thread
From: Sidong Yang @ 2026-12-04 17:40 UTC (permalink / raw)
  To: Tomeu Vizoso, Oded Gabbay
  Cc: Heiko Stuebner, Jeff Hugo, Haoming Gao, Hu Xinyao, dri-devel,
	linux-rockchip, linux-kernel, stable

iommu_map_sgtable() returns ssize_t, not int. Storing its return value
in int ret truncates any mapping of 2 GiB or larger (reachable via the
__u32 args->size) to a negative value. The error path then removes the
drm_mm node without calling iommu_unmap(), leaking the IOMMU mapping and
causing subsequent allocations at the same IOVA to fail.

In addition, if iommu_map_sgtable() ever returns a short mapping, the
error path fails to unmap the already mapped range, and the drm_mm node
was sized from the unaligned args->size rather than gem_obj->size.

Store the return value of iommu_map_sgtable() in ssize_t, size the
drm_mm node from gem_obj->size, propagate negative errors directly, and
unmap partial mappings before returning -ENOMEM.

Fixes: 658ebeac3351 ("accel/rocket: Add IOCTL for BO creation")
Cc: stable@vger.kernel.org
Signed-off-by: Sidong Yang <sidong.yang@furiosa.ai>
---
 drivers/accel/rocket/rocket_gem.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/accel/rocket/rocket_gem.c b/drivers/accel/rocket/rocket_gem.c
index 8f802df3e0f1..c50b685bf6df 100644
--- a/drivers/accel/rocket/rocket_gem.c
+++ b/drivers/accel/rocket/rocket_gem.c
@@ -66,6 +66,7 @@ int rocket_ioctl_create_bo(struct drm_device *dev, void *data, struct drm_file *
 	struct drm_gem_object *gem_obj;
 	struct rocket_vm *vm;
 	struct sg_table *sgt;
+	ssize_t mapped;
 	int ret;
 
 	shmem_obj = drm_gem_shmem_create(dev, args->size);
@@ -77,7 +78,7 @@ int rocket_ioctl_create_bo(struct drm_device *dev, void *data, struct drm_file *
 
 	vm = rocket_vm_get(rocket_priv);
 	rkt_obj->vm = vm;
-	rkt_obj->size = args->size;
+	rkt_obj->size = gem_obj->size;
 	rkt_obj->offset = 0;
 
 	sgt = drm_gem_shmem_get_pages_sgt(shmem_obj);
@@ -94,19 +95,27 @@ int rocket_ioctl_create_bo(struct drm_device *dev, void *data, struct drm_file *
 	if (ret)
 		goto err;
 
-	ret = iommu_map_sgtable(vm->domain,
-				rkt_obj->mm.start,
-				shmem_obj->sgt,
-				IOMMU_READ | IOMMU_WRITE);
-	if (ret < 0 || ret < args->size) {
-		drm_err(dev, "failed to map buffer: size=%d request_size=%u\n",
-			ret, args->size);
+	mapped = iommu_map_sgtable(vm->domain,
+				   rkt_obj->mm.start,
+				   shmem_obj->sgt,
+				   IOMMU_READ | IOMMU_WRITE);
+	if (mapped < 0) {
+		drm_err(dev, "failed to map buffer: err=%zd request_size=%zu\n",
+			mapped, gem_obj->size);
+		ret = mapped;
+		goto err_remove_node;
+	}
+	if ((size_t)mapped < gem_obj->size) {
+		drm_err(dev, "failed to map buffer: size=%zd request_size=%zu\n",
+			mapped, gem_obj->size);
+		if (mapped)
+			iommu_unmap(vm->domain, rkt_obj->mm.start, mapped);
 		ret = -ENOMEM;
 		goto err_remove_node;
 	}
 
 	/* iommu_map_sgtable might have aligned the size */
-	rkt_obj->size = ret;
+	rkt_obj->size = mapped;
 	args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node);
 	args->dma_address = rkt_obj->mm.start;
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 1/3] accel/rocket: Fix iommu_map_sgtable() return handling in create_bo
@ 2026-12-04 17:40   ` Sidong Yang
  0 siblings, 0 replies; 9+ messages in thread
From: Sidong Yang @ 2026-12-04 17:40 UTC (permalink / raw)
  To: Tomeu Vizoso, Oded Gabbay
  Cc: Heiko Stuebner, Jeff Hugo, Haoming Gao, Hu Xinyao, dri-devel,
	linux-rockchip, linux-kernel, stable

iommu_map_sgtable() returns ssize_t, not int. Storing its return value
in int ret truncates any mapping of 2 GiB or larger (reachable via the
__u32 args->size) to a negative value. The error path then removes the
drm_mm node without calling iommu_unmap(), leaking the IOMMU mapping and
causing subsequent allocations at the same IOVA to fail.

In addition, if iommu_map_sgtable() ever returns a short mapping, the
error path fails to unmap the already mapped range, and the drm_mm node
was sized from the unaligned args->size rather than gem_obj->size.

Store the return value of iommu_map_sgtable() in ssize_t, size the
drm_mm node from gem_obj->size, propagate negative errors directly, and
unmap partial mappings before returning -ENOMEM.

Fixes: 658ebeac3351 ("accel/rocket: Add IOCTL for BO creation")
Cc: stable@vger.kernel.org
Signed-off-by: Sidong Yang <sidong.yang@furiosa.ai>
---
 drivers/accel/rocket/rocket_gem.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/accel/rocket/rocket_gem.c b/drivers/accel/rocket/rocket_gem.c
index 8f802df3e0f1..c50b685bf6df 100644
--- a/drivers/accel/rocket/rocket_gem.c
+++ b/drivers/accel/rocket/rocket_gem.c
@@ -66,6 +66,7 @@ int rocket_ioctl_create_bo(struct drm_device *dev, void *data, struct drm_file *
 	struct drm_gem_object *gem_obj;
 	struct rocket_vm *vm;
 	struct sg_table *sgt;
+	ssize_t mapped;
 	int ret;
 
 	shmem_obj = drm_gem_shmem_create(dev, args->size);
@@ -77,7 +78,7 @@ int rocket_ioctl_create_bo(struct drm_device *dev, void *data, struct drm_file *
 
 	vm = rocket_vm_get(rocket_priv);
 	rkt_obj->vm = vm;
-	rkt_obj->size = args->size;
+	rkt_obj->size = gem_obj->size;
 	rkt_obj->offset = 0;
 
 	sgt = drm_gem_shmem_get_pages_sgt(shmem_obj);
@@ -94,19 +95,27 @@ int rocket_ioctl_create_bo(struct drm_device *dev, void *data, struct drm_file *
 	if (ret)
 		goto err;
 
-	ret = iommu_map_sgtable(vm->domain,
-				rkt_obj->mm.start,
-				shmem_obj->sgt,
-				IOMMU_READ | IOMMU_WRITE);
-	if (ret < 0 || ret < args->size) {
-		drm_err(dev, "failed to map buffer: size=%d request_size=%u\n",
-			ret, args->size);
+	mapped = iommu_map_sgtable(vm->domain,
+				   rkt_obj->mm.start,
+				   shmem_obj->sgt,
+				   IOMMU_READ | IOMMU_WRITE);
+	if (mapped < 0) {
+		drm_err(dev, "failed to map buffer: err=%zd request_size=%zu\n",
+			mapped, gem_obj->size);
+		ret = mapped;
+		goto err_remove_node;
+	}
+	if ((size_t)mapped < gem_obj->size) {
+		drm_err(dev, "failed to map buffer: size=%zd request_size=%zu\n",
+			mapped, gem_obj->size);
+		if (mapped)
+			iommu_unmap(vm->domain, rkt_obj->mm.start, mapped);
 		ret = -ENOMEM;
 		goto err_remove_node;
 	}
 
 	/* iommu_map_sgtable might have aligned the size */
-	rkt_obj->size = ret;
+	rkt_obj->size = mapped;
 	args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node);
 	args->dma_address = rkt_obj->mm.start;
 
-- 
2.53.0


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/3] accel/rocket: Skip CPU cache sync when prep_bo wait fails
  2026-12-04 17:40 ` Sidong Yang
@ 2026-12-04 17:40   ` Sidong Yang
  -1 siblings, 0 replies; 9+ messages in thread
From: Sidong Yang @ 2026-12-04 17:40 UTC (permalink / raw)
  To: Tomeu Vizoso, Oded Gabbay
  Cc: Heiko Stuebner, Jeff Hugo, Haoming Gao, Hu Xinyao, dri-devel,
	linux-rockchip, linux-kernel

rocket_ioctl_prep_bo() calls dma_sync_sgtable_for_cpu() unconditionally,
even when dma_resv_wait_timeout() fails with -ETIMEDOUT, -EBUSY, or
-ERESTARTSYS.

When the wait fails, the job may still be running and the device still
owns the buffer, so it must not be synced for CPU access. The caller
gets an error and cannot use the buffer anyway.

Only sync the buffer for CPU access when the wait succeeds.

Fixes: 525ad89dd904 ("accel/rocket: Add IOCTLs for synchronizing memory accesses")
Signed-off-by: Sidong Yang <sidong.yang@furiosa.ai>
---
 drivers/accel/rocket/rocket_gem.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/accel/rocket/rocket_gem.c b/drivers/accel/rocket/rocket_gem.c
index c50b685bf6df..2fdf9cf6548b 100644
--- a/drivers/accel/rocket/rocket_gem.c
+++ b/drivers/accel/rocket/rocket_gem.c
@@ -167,9 +167,11 @@ int rocket_ioctl_prep_bo(struct drm_device *dev, void *data, struct drm_file *fi
 	else if (ret > 0)
 		ret = 0;
 
-	shmem_obj = &to_rocket_bo(gem_obj)->base;
-
-	dma_sync_sgtable_for_cpu(dev->dev, shmem_obj->sgt, DMA_BIDIRECTIONAL);
+	if (!ret) {
+		shmem_obj = &to_rocket_bo(gem_obj)->base;
+		dma_sync_sgtable_for_cpu(dev->dev, shmem_obj->sgt,
+					 DMA_BIDIRECTIONAL);
+	}
 
 	drm_gem_object_put(gem_obj);
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/3] accel/rocket: Skip CPU cache sync when prep_bo wait fails
@ 2026-12-04 17:40   ` Sidong Yang
  0 siblings, 0 replies; 9+ messages in thread
From: Sidong Yang @ 2026-12-04 17:40 UTC (permalink / raw)
  To: Tomeu Vizoso, Oded Gabbay
  Cc: Heiko Stuebner, Jeff Hugo, Haoming Gao, Hu Xinyao, dri-devel,
	linux-rockchip, linux-kernel

rocket_ioctl_prep_bo() calls dma_sync_sgtable_for_cpu() unconditionally,
even when dma_resv_wait_timeout() fails with -ETIMEDOUT, -EBUSY, or
-ERESTARTSYS.

When the wait fails, the job may still be running and the device still
owns the buffer, so it must not be synced for CPU access. The caller
gets an error and cannot use the buffer anyway.

Only sync the buffer for CPU access when the wait succeeds.

Fixes: 525ad89dd904 ("accel/rocket: Add IOCTLs for synchronizing memory accesses")
Signed-off-by: Sidong Yang <sidong.yang@furiosa.ai>
---
 drivers/accel/rocket/rocket_gem.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/accel/rocket/rocket_gem.c b/drivers/accel/rocket/rocket_gem.c
index c50b685bf6df..2fdf9cf6548b 100644
--- a/drivers/accel/rocket/rocket_gem.c
+++ b/drivers/accel/rocket/rocket_gem.c
@@ -167,9 +167,11 @@ int rocket_ioctl_prep_bo(struct drm_device *dev, void *data, struct drm_file *fi
 	else if (ret > 0)
 		ret = 0;
 
-	shmem_obj = &to_rocket_bo(gem_obj)->base;
-
-	dma_sync_sgtable_for_cpu(dev->dev, shmem_obj->sgt, DMA_BIDIRECTIONAL);
+	if (!ret) {
+		shmem_obj = &to_rocket_bo(gem_obj)->base;
+		dma_sync_sgtable_for_cpu(dev->dev, shmem_obj->sgt,
+					 DMA_BIDIRECTIONAL);
+	}
 
 	drm_gem_object_put(gem_obj);
 
-- 
2.53.0


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/3] accel/rocket: Wait for read fences in rocket_ioctl_prep_bo()
  2026-12-04 17:40 ` Sidong Yang
@ 2026-12-04 17:40   ` Sidong Yang
  -1 siblings, 0 replies; 9+ messages in thread
From: Sidong Yang @ 2026-12-04 17:40 UTC (permalink / raw)
  To: Tomeu Vizoso, Oded Gabbay
  Cc: Heiko Stuebner, Jeff Hugo, Haoming Gao, Hu Xinyao, dri-devel,
	linux-rockchip, linux-kernel

DRM_IOCTL_ROCKET_PREP_BO begins CPU ownership of a BO and has no
read/write direction flag: userspace calls it before reading an output
buffer as well as before overwriting an input buffer for reuse.

Since commit 4d8cb7be620e ("accel/rocket: publish read fences for input
buffers"), in-flight jobs attach DMA_RESV_USAGE_READ fences to their
input BOs. Waiting only for DMA_RESV_USAGE_WRITE therefore returns
immediately while an NPU job is still reading the buffer.

Wait for DMA_RESV_USAGE_READ so PREP_BO waits for both write and read
fences before transferring ownership back to the CPU.

Fixes: 4d8cb7be620e ("accel/rocket: publish read fences for input buffers")
Signed-off-by: Sidong Yang <sidong.yang@furiosa.ai>
---
 drivers/accel/rocket/rocket_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/accel/rocket/rocket_gem.c b/drivers/accel/rocket/rocket_gem.c
index 2fdf9cf6548b..586b7230872d 100644
--- a/drivers/accel/rocket/rocket_gem.c
+++ b/drivers/accel/rocket/rocket_gem.c
@@ -161,7 +161,7 @@ int rocket_ioctl_prep_bo(struct drm_device *dev, void *data, struct drm_file *fi
 	if (!gem_obj)
 		return -ENOENT;
 
-	ret = dma_resv_wait_timeout(gem_obj->resv, DMA_RESV_USAGE_WRITE, true, timeout);
+	ret = dma_resv_wait_timeout(gem_obj->resv, DMA_RESV_USAGE_READ, true, timeout);
 	if (!ret)
 		ret = timeout ? -ETIMEDOUT : -EBUSY;
 	else if (ret > 0)
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/3] accel/rocket: Wait for read fences in rocket_ioctl_prep_bo()
@ 2026-12-04 17:40   ` Sidong Yang
  0 siblings, 0 replies; 9+ messages in thread
From: Sidong Yang @ 2026-12-04 17:40 UTC (permalink / raw)
  To: Tomeu Vizoso, Oded Gabbay
  Cc: Heiko Stuebner, Jeff Hugo, Haoming Gao, Hu Xinyao, dri-devel,
	linux-rockchip, linux-kernel

DRM_IOCTL_ROCKET_PREP_BO begins CPU ownership of a BO and has no
read/write direction flag: userspace calls it before reading an output
buffer as well as before overwriting an input buffer for reuse.

Since commit 4d8cb7be620e ("accel/rocket: publish read fences for input
buffers"), in-flight jobs attach DMA_RESV_USAGE_READ fences to their
input BOs. Waiting only for DMA_RESV_USAGE_WRITE therefore returns
immediately while an NPU job is still reading the buffer.

Wait for DMA_RESV_USAGE_READ so PREP_BO waits for both write and read
fences before transferring ownership back to the CPU.

Fixes: 4d8cb7be620e ("accel/rocket: publish read fences for input buffers")
Signed-off-by: Sidong Yang <sidong.yang@furiosa.ai>
---
 drivers/accel/rocket/rocket_gem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/accel/rocket/rocket_gem.c b/drivers/accel/rocket/rocket_gem.c
index 2fdf9cf6548b..586b7230872d 100644
--- a/drivers/accel/rocket/rocket_gem.c
+++ b/drivers/accel/rocket/rocket_gem.c
@@ -161,7 +161,7 @@ int rocket_ioctl_prep_bo(struct drm_device *dev, void *data, struct drm_file *fi
 	if (!gem_obj)
 		return -ENOENT;
 
-	ret = dma_resv_wait_timeout(gem_obj->resv, DMA_RESV_USAGE_WRITE, true, timeout);
+	ret = dma_resv_wait_timeout(gem_obj->resv, DMA_RESV_USAGE_READ, true, timeout);
 	if (!ret)
 		ret = timeout ? -ETIMEDOUT : -EBUSY;
 	else if (ret > 0)
-- 
2.53.0


_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/3] accel/rocket: Wait for read fences in rocket_ioctl_prep_bo()
  2026-12-04 17:40   ` Sidong Yang
  (?)
@ 2026-12-04 17:52   ` sashiko-bot
  -1 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-12-04 17:52 UTC (permalink / raw)
  To: Sidong Yang; +Cc: dri-devel

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] accel/rocket: Fixes trailer cites wrong commit for
  rocket_ioctl_prep_bo()
--

commit a970bdabf5bfb0b280ea79229cdb58bc77903830
Author: Sidong Yang <sidong.yang@furiosa.ai>

> accel/rocket: Wait for read fences in rocket_ioctl_prep_bo()
>
> DRM_IOCTL_ROCKET_PREP_BO begins CPU ownership of a BO and has no
> read/write direction flag: userspace calls it before reading an output
> buffer as well as before overwriting an input buffer for reuse.
>
> Since commit 4d8cb7be620e ("accel/rocket: publish read fences for input
> buffers"), in-flight jobs attach DMA_RESV_USAGE_READ fences to their
> input BOs. Waiting only for DMA_RESV_USAGE_WRITE therefore returns
> immediately while an NPU job is still reading the buffer.
>
> Wait for DMA_RESV_USAGE_READ so PREP_BO waits for both write and read
> fences before transferring ownership back to the CPU.
>
> Fixes: 4d8cb7be620e ("accel/rocket: publish read fences for input buffers")
> Signed-off-by: Sidong Yang <sidong.yang@furiosa.ai>

[Severity: Low]
Should the Fixes tag cite 525ad89dd904 ("accel/rocket: Add IOCTLs for
synchronizing memory accesses") instead?

Commit 4d8cb7be620e ("accel/rocket: publish read fences for input buffers")
only added read fences in rocket_job.c and did not introduce the bug in
rocket_ioctl_prep_bo().  The DMA_RESV_USAGE_WRITE wait in
rocket_ioctl_prep_bo() was introduced by 525ad89dd904 ("accel/rocket: Add
IOCTLs for synchronizing memory accesses"), and already missed read fences
such as those attached by a foreign PRIME importer reading an exported BO.

  Fixes: 525ad89dd904 ("accel/rocket: Add IOCTLs for synchronizing memory accesses")

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261204174009.274509-1-sidong.yang@furiosa.ai?part=3

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-12-04 17:52 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 17:40 [PATCH v2 0/3] accel/rocket: Fix BO creation and prep_bo handling Sidong Yang
2026-12-04 17:40 ` Sidong Yang
2026-12-04 17:40 ` [PATCH v2 1/3] accel/rocket: Fix iommu_map_sgtable() return handling in create_bo Sidong Yang
2026-12-04 17:40   ` Sidong Yang
2026-12-04 17:40 ` [PATCH v2 2/3] accel/rocket: Skip CPU cache sync when prep_bo wait fails Sidong Yang
2026-12-04 17:40   ` Sidong Yang
2026-12-04 17:40 ` [PATCH v2 3/3] accel/rocket: Wait for read fences in rocket_ioctl_prep_bo() Sidong Yang
2026-12-04 17:40   ` Sidong Yang
2026-12-04 17:52   ` sashiko-bot

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.