Date: Mon, 21 Jul 2025 22:04:52 -0600 From: Warner Losh <imp@bsdimp.com> To: FreeBSD Current <freebsd-current@freebsd.org> Subject: Fwd: git: b4b166b8c46b - main - cam: Enforce real priorities in xpt_action for queued ccbs. Message-ID: <CANCZdfp1Z0-LXHEECPiBpygVQq5Mh5_BhH7UDqQhX3yUD9bZdw@mail.gmail.com> In-Reply-To: <202507220400.56M40udG032587@gitrepo.freebsd.org> References: <202507220400.56M40udG032587@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Heads up: I added some enforcement of the rules to CAM. I'd been bitten by this condition with some cleanup I did that caused mmccam to no longer probe devices. I've tested it locally on a couple of machines that have a couple of different SIMs/HBAs, for scsi, ata, nvme and mmc. I fixed what I could find, but if you hit this assert, please let me know. Warner ---------- Forwarded message --------- From: Warner Losh <imp@freebsd.org> Date: Mon, Jul 21, 2025 at 10:01=E2=80=AFPM Subject: git: b4b166b8c46b - main - cam: Enforce real priorities in xpt_action for queued ccbs. To: <src-committers@freebsd.org>, <dev-commits-src-all@freebsd.org>, <dev-commits-src-main@freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3Db4b166b8c46b86df855f1621d2aa= 4b6ab26b3a5e commit b4b166b8c46b86df855f1621d2aa4b6ab26b3a5e Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2025-07-22 03:52:22 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2025-07-22 04:00:53 +0000 cam: Enforce real priorities in xpt_action for queued ccbs. All queued CCBs should be created with a real priority (one that's not CAM_PRIORITY_NONE). Recently, I introduced a bug that revealed a latent MMC bug where it would stop enumerating due to a bad priority. Add an assert to catch that (the other bug in mmc_da that it found has been fixed). Sponsored by: Netflix --- sys/cam/cam_xpt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index 2ec736e7f4ac..cae29226d13c 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -2515,6 +2515,15 @@ xpt_action(union ccb *start_ccb) ("xpt_action: func %#x %s\n", start_ccb->ccb_h.func_code, xpt_action_name(start_ccb->ccb_h.func_code))); + /* + * Either it isn't queued, or it has a real priority. There still t= oo + * many places that reuse CCBs with a real priority to do immediate + * queries to do the other side of this assert. + */ + KASSERT((start_ccb->ccb_h.func_code & XPT_FC_QUEUED) =3D=3D 0 || + start_ccb->ccb_h.pinfo.priority !=3D CAM_PRIORITY_NONE, + ("%s: queued ccb and CAM_PRIORITY_NONE illegal.", __func__)); + start_ccb->ccb_h.status =3D CAM_REQ_INPROG; (*(start_ccb->ccb_h.path->bus->xport->ops->action))(start_ccb); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfp1Z0-LXHEECPiBpygVQq5Mh5_BhH7UDqQhX3yUD9bZdw>