All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/7] accel/rocket: Fix teardown with a job on the NPU
@ 2026-12-05  6:51 ` Arun Iyengar
  0 siblings, 0 replies; 26+ messages in thread
From: Arun Iyengar via B4 Relay @ 2026-12-05  6:51 UTC (permalink / raw)
  To: Tomeu Vizoso, Oded Gabbay
  Cc: Heiko Stuebner, Jeff Hugo, Sumit Semwal, Christian König,
	Philipp Stanner, Danilo Krummrich, Matthew Brost, Igor Paunovic,
	Midgy BALON, Jiaxing Hu, dri-devel, linux-rockchip, linux-kernel,
	linux-media, linaro-mm-sig, stable, Arun Iyengar

Fixes for teardown with a job on the NPU: at file close, in the
timeout reset and at core unbind.

1: wait for the file's jobs before its BOs are released.
2: reset the core before detaching its IOMMU (same change as Midgy
   Balon's RK3568 RFC, linked in the patch).
3: stop the scheduler before releasing the IOMMU group.
4: serialise core probe and removal (the slot part overlaps Igor
   Paunovic's pending patch, linked in the patch).
5: reset the core at unbind, which also cancels the job on the NPU.
6: free the jobs left at scheduler teardown.
7: move open files off a core at unbind, and back onto it at bind.

Tested on an Orange Pi 5 (RK3588), 7.3, KASAN, unbinding the second of
the three cores. Before: SIGKILL during inference timed out 12 times in
10 kills, faulting jobs gave IOMMU stall timeouts, an unbind during a
timeout oopsed in iommu_detach_group(), close hung on a hung job, and
an unbind with queued jobs hit a use-after-free in
drm_sched_entity_select_rq(). After: none of these in 70 kills, 10
faulting jobs and 3-5 runs of each unbind case (job running, hung,
pending, idle, during a forced timeout or a slowed reset, two and three
cores at once). Inference is unchanged after the rebinds in the tests
of patches 3-5, and a file open across an unbind and rebind gets the
core back. The NULL detach from the interrupt handler in patch 5
follows from the code; I could not trigger it.

Developed with Claude (Anthropic), which wrote the code and the commit
messages. I reviewed every change.

Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
Changes in v3:
- Patch 1: wait for the last job that reached the NPU, set in
  rocket_job_run(), not the last one pushed: close no longer waits for
  killed jobs or their fences (Sashiko).
- New patch 4: serialise core probe and removal, take a free slot.
- Patch 5: timeouts during unbind leave the core to the unbind reset and
  do not restart the scheduler (Sashiko).
- Patch 5: the reset work sets reset.pending itself, so a concurrent
  timeout cannot skip the unbind reset (Sashiko).
- New patch 6: .cancel_job, so drm_sched_fini() frees the jobs left
  pending (Sashiko).
- New patch 7: move open files off a core at unbind (was "Not fixed"),
  and back at bind.
- Link to v2: https://patch.msgid.link/20261204-rocket-fixes-v2-0-e9f9bb6f1304@gmail.com

Changes in v2:
- New patch 3: stop the scheduler before releasing the IOMMU group
  (Sashiko).
- New patch 4: reset the core at unbind.
- Patch 1: drop a comment that repeated the commit message.
- Patch 2 unchanged.
- Link to v1: https://patch.msgid.link/20261201-rocket-fixes-v1-0-986c3e5ceb44@gmail.com

---
Arun Iyengar (7):
      accel/rocket: Wait for in-flight jobs before releasing the file's BOs
      accel/rocket: Reset the core before detaching its IOMMU
      accel/rocket: Stop the scheduler before releasing the IOMMU group
      accel/rocket: Serialise core probe and removal
      accel/rocket: Reset the core at unbind
      accel/rocket: Free the jobs left at scheduler teardown
      accel/rocket: Move open files off a core at unbind

 drivers/accel/rocket/rocket_core.c   |   4 +-
 drivers/accel/rocket/rocket_core.h   |   2 +
 drivers/accel/rocket/rocket_device.c |   7 +-
 drivers/accel/rocket/rocket_device.h |   2 +
 drivers/accel/rocket/rocket_drv.c    |  57 +++++++++++--
 drivers/accel/rocket/rocket_drv.h    |   8 ++
 drivers/accel/rocket/rocket_job.c    | 156 ++++++++++++++++++++++++++++++-----
 drivers/accel/rocket/rocket_job.h    |   4 +
 8 files changed, 210 insertions(+), 30 deletions(-)
---
base-commit: 502ea48d0d8fa5dd0c31dc449efb3d82deef8efe
change-id: 20261130-rocket-fixes-e1438ca23bee

Best regards,
--  
Arun Iyengar <aiyengar1990@gmail.com>



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

end of thread, other threads:[~2026-12-05  7:31 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05  6:51 [PATCH v3 0/7] accel/rocket: Fix teardown with a job on the NPU Arun Iyengar via B4 Relay
2026-12-05  6:51 ` Arun Iyengar via B4 Relay
2026-12-05  6:51 ` Arun Iyengar
2026-12-05  6:51 ` [PATCH v3 1/7] accel/rocket: Wait for in-flight jobs before releasing the file's BOs Arun Iyengar via B4 Relay
2026-12-05  6:51   ` Arun Iyengar via B4 Relay
2026-12-05  6:51   ` Arun Iyengar
2026-12-05  6:51 ` [PATCH v3 2/7] accel/rocket: Reset the core before detaching its IOMMU Arun Iyengar via B4 Relay
2026-12-05  6:51   ` Arun Iyengar via B4 Relay
2026-12-05  6:51   ` Arun Iyengar
2026-12-05  6:51 ` [PATCH v3 3/7] accel/rocket: Stop the scheduler before releasing the IOMMU group Arun Iyengar via B4 Relay
2026-12-05  6:51   ` Arun Iyengar via B4 Relay
2026-12-05  6:51   ` Arun Iyengar
2026-12-05  6:51 ` [PATCH v3 4/7] accel/rocket: Serialise core probe and removal Arun Iyengar via B4 Relay
2026-12-05  6:51   ` Arun Iyengar via B4 Relay
2026-12-05  6:51   ` Arun Iyengar
2026-12-05  7:16   ` sashiko-bot
2026-12-05  6:51 ` [PATCH v3 5/7] accel/rocket: Reset the core at unbind Arun Iyengar via B4 Relay
2026-12-05  6:51   ` Arun Iyengar via B4 Relay
2026-12-05  6:51   ` Arun Iyengar
2026-12-05  6:51 ` [PATCH v3 6/7] accel/rocket: Free the jobs left at scheduler teardown Arun Iyengar via B4 Relay
2026-12-05  6:51   ` Arun Iyengar via B4 Relay
2026-12-05  6:51   ` Arun Iyengar
2026-12-05  6:51 ` [PATCH v3 7/7] accel/rocket: Move open files off a core at unbind Arun Iyengar via B4 Relay
2026-12-05  6:51   ` Arun Iyengar via B4 Relay
2026-12-05  6:51   ` Arun Iyengar
2026-12-05  7:31   ` 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.