aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaeyoon Choi <jaeyoon@FreeBSD.org>2026-08-10 01:53:27 +0000
committerJaeyoon Choi <jaeyoon@FreeBSD.org>2026-08-10 02:28:54 +0000
commita33860b0a2b98caf32c2ff62707f254ca92773f4 (patch)
tree1e6448ca997a807f010978ea1f44b83e443b35bd
parent2d32961316248fdff54a2a9fc24ac8b712fee9b0 (diff)
ufshci: do not reset the device in the XPT_RESET_DEV handler
CAM calls the SIM action callback with the SIM lock and the CAM device lock held. The XPT_RESET_DEV handler called ufshci_dev_reset(), which sleeps on device commands. Sleeping there panics when another thread contends for the lock: "panic: sleeping thread holds CAM device lock". Report success without touching the device, as nvme_sim(4) does. A real device reset needs the controller reset path. That rework is planned together with in-flight request recovery. Sponsored by: Samsung Electronics Reviewed by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D58671
-rw-r--r--sys/dev/ufshci/ufshci_sim.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sys/dev/ufshci/ufshci_sim.c b/sys/dev/ufshci/ufshci_sim.c
index e40079b23354..f969d9c8311b 100644
--- a/sys/dev/ufshci/ufshci_sim.c
+++ b/sys/dev/ufshci/ufshci_sim.c
@@ -288,13 +288,14 @@ ufshci_cam_action(struct cam_sim *sim, union ccb *ccb)
break;
}
case XPT_RESET_BUS:
- ccb->ccb_h.status = CAM_REQ_CMP;
- break;
case XPT_RESET_DEV:
- if (ufshci_dev_reset(ctrlr))
- ccb->ccb_h.status = CAM_REQ_CMP_ERR;
- else
- ccb->ccb_h.status = CAM_REQ_CMP;
+ /*
+ * This callback cannot sleep: CAM calls it with the SIM
+ * lock and the CAM device lock held. It cannot reset the
+ * device here. Report success so CAM keeps going, like
+ * nvme_sim(4) does.
+ */
+ ccb->ccb_h.status = CAM_REQ_CMP;
break;
case XPT_ABORT:
ccb->ccb_h.status = CAM_FUNC_NOTAVAIL;