From nobody Thu Jan 8 06:24:35 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dmvyC71KCz5hskb for ; Thu, 08 Jan 2026 06:24:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dmvyC4yWXz3Rqp for ; Thu, 08 Jan 2026 06:24:35 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767853475; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JrQGwT3XuOFxY1PXW9kxZjYWb6fQGU3akYAkcsLSAbc=; b=aVQ4byeBt8m/co80i1ooExteBjWmegaZtAjO3OI9QnfCSPsco4G7I+QvpagBGDdjpc0XmM fgO6jLsiBLVMTU1AwAaYK052lsqm0Io1MS0TDQOOUaLjfS0ygjcpnzrfrhF3YrYw/NTSxN 1IQCz6D5lAONachJG30IibfsP7KW0uItwZl+2fhcUNcoAzSEqx3SHS4rnMl6FRDzKdUgJm T0R4Rg8isOz3QtxKuLc2yKSolVhj0jdLvPYcfMwZVBLAAozO2XqRGavFolufAMycNny2S0 fkqyQ3n+50M/4OG5mkDemiYP+8WU+ELCDJ7JGGqEwquvYxfve3LiPAxoJlNm+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767853475; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=JrQGwT3XuOFxY1PXW9kxZjYWb6fQGU3akYAkcsLSAbc=; b=fGLuGdkKkkjJ+4EbD52nQ9NVNTNzL8cfgIXk4lG94jQUTESJhw49ZJ0PML4kxjc2cdI1qf LRFaXCC/yYuzYI/n4wnDfNCOnq4uK8l5GWWt6n2jtFNgZLlRz7VFdyiXLnjXgqGX1PpULl G2QpQgrQHRVrUSsHgly9fnhfsGI7GpLA0yUKFVeN324zstQQ2OJUrprMPDoL1uKbwvr8ON qCDMcrQz3g4Lunmm8RvpAaqihTa3o82J2t5Te8+AoWxxHPLi1/945BLNUDJKBFUMrvsH6g 0uC+wYIiF/gENDHOw4zXGm0VbEsQ4ubC5fWbywY39OtM7aQAug5Fok6aQ2t80Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1767853475; a=rsa-sha256; cv=none; b=P8teEc14lRC2ZEq3/q9Sgtr9VfX1lgrGkjmXqc+Iex4SpFw9Bz9csQuaTeGsVVkh9BigxV vSunZMGGb4YakQR8GzmcnNoLKGDIjglwycwZgdei2VYowHUxIdqS11jjGQFt9/pnVc327p KCYKlOZITp7/ZRN31O+G5dtfM0m3RHxejWYk3C9Hp3osp44q9uzut6YjJBoq56ZLkP+0b8 ptVdMzn6EyNPtDiP6oEmgWkSngDJM2mZVyOSVHs+MnV/5WqOHuJgsJRt+KHrKHXtUk+5JD gORCknY+BtNFifr2zRCByyUF4F8fDnaYq0o8KwIHSA3oQsEj3/e6edYCTfYykw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dmvyC2jzMz9vR for ; Thu, 08 Jan 2026 06:24:35 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 38816 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 08 Jan 2026 06:24:35 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 1a7151f79664 - main - cam: Add probes for xpt actions List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1a7151f79664644b2e7c8e69427be8b846e9c1a4 Auto-Submitted: auto-generated Date: Thu, 08 Jan 2026 06:24:35 +0000 Message-Id: <695f4da3.38816.50c8100@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=1a7151f79664644b2e7c8e69427be8b846e9c1a4 commit 1a7151f79664644b2e7c8e69427be8b846e9c1a4 Author: Warner Losh AuthorDate: 2026-01-08 06:19:10 +0000 Commit: Warner Losh CommitDate: 2026-01-08 06:19:10 +0000 cam: Add probes for xpt actions cam::xpt:action(union ccb *) cam::xpt:done((union ccb *) cam::xpt:async-cb(void *cbarg, uint32_t async_code, struct cam_path *path, void *async_arg); Called when xpt_action(), xpt_done*() and the xpt async callbacks are called. Sponsored by: Netflix Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D54469 --- share/man/man4/Makefile | 1 + share/man/man4/dtrace_cam.4 | 42 ++++++++++++++++++++++++++++++++++++++++++ sys/cam/cam_xpt.c | 22 +++++++++++++++++++++- 3 files changed, 64 insertions(+), 1 deletion(-) diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile index 5ee6eedd89ee..23bb8495975b 100644 --- a/share/man/man4/Makefile +++ b/share/man/man4/Makefile @@ -1009,6 +1009,7 @@ _ccd.4= ccd.4 .if ${MK_CDDL} != "no" _dtrace_provs= dtrace_audit.4 \ dtrace_callout_execute.4 \ + dtrace_cam.4 \ dtrace_dtrace.4 \ dtrace_fbt.4 \ dtrace_io.4 \ diff --git a/share/man/man4/dtrace_cam.4 b/share/man/man4/dtrace_cam.4 new file mode 100644 index 000000000000..e5b7ae34c391 --- /dev/null +++ b/share/man/man4/dtrace_cam.4 @@ -0,0 +1,42 @@ +.\" Copyright (c) 2026 Netflix, Inc +.\" +.\" SPDX-License-Identifier: BSD-2-Clause +.\" +.Dd December 26, 2025 +.Dt DTRACE_CAM 4 +.Os +.Sh NAME +.Nm dtrace_cam +.Nd a DTrace provider for tracing events related to CAM +.Sh SYNOPSIS +.Fn cam::xpt:action "union ccb *ccn" +.Fn cam::xpt:done "union ccb *ccb" +.Fn cam::xpt:async-cb "void *cbarg" "uint32_t async_code" "struct cam_path *path" "void *async_Arg" +.Sh DESCRIPTION +The +.Nm cam +provider allows the tracing of CAM events. +The +.Fn cam::xpt_action +probe fires when a CAM Control Block (ccb) is submitted to a CAM SIM driver. +The +.Fn cam::xpt:done +probe fires when that request completes. +The +.Fn cam::xpt:async-cb +probe fires just before an async callback is called. +.Sh ARGUMENTS +.Sh FILES +.Sh EXAMPLES +.Sh SEE ALSO +.Xr dtrace 1 , +.Xr SDT 9 +.Sh HISTORY +The +.Nm cam +provider first appeared in +.Fx +15.1 and 16.0. +.Sh AUTHORS +This manual page was written by +.An Warner Losh Aq Mt imp@FreeBSD.org . diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c index ecf06045ed90..8b42fb2ca6c5 100644 --- a/sys/cam/cam_xpt.c +++ b/sys/cam/cam_xpt.c @@ -70,6 +70,12 @@ #include +/* SDT Probes */ +SDT_PROBE_DEFINE1(cam, , xpt, action, "union ccb *"); +SDT_PROBE_DEFINE1(cam, , xpt, done, "union ccb *"); +SDT_PROBE_DEFINE4(cam, , xpt, async__cb, "void *", "uint32_t", + "struct cam_path *", "void *"); + /* Wild guess based on not wanting to grow the stack too much */ #define XPT_PRINT_MAXLEN 512 #ifdef PRINTF_BUFR_SIZE @@ -2479,6 +2485,8 @@ xptsetasyncfunc(struct cam_ed *device, void *arg) device->target->target_id, device->lun_id); xpt_gdev_type(&cgd, &path); + CAM_PROBE4(xpt, async__cb, csa->callback_arg, + AC_FOUND_DEVICE, &path, &cgd); csa->callback(csa->callback_arg, AC_FOUND_DEVICE, &path, &cgd); @@ -2500,6 +2508,8 @@ xptsetasyncbusfunc(struct cam_eb *bus, void *arg) CAM_LUN_WILDCARD); xpt_path_lock(&path); xpt_path_inq(&cpi, &path); + CAM_PROBE4(xpt, async__cb, csa->callback_arg, + AC_PATH_REGISTERED, &path, &cpi); csa->callback(csa->callback_arg, AC_PATH_REGISTERED, &path, &cpi); @@ -2526,6 +2536,7 @@ xpt_action(union ccb *start_ccb) start_ccb->ccb_h.pinfo.priority != CAM_PRIORITY_NONE, ("%s: queued ccb and CAM_PRIORITY_NONE illegal.", __func__)); + CAM_PROBE1(xpt, action, start_ccb); start_ccb->ccb_h.status = CAM_REQ_INPROG; (*(start_ccb->ccb_h.path->bus->xport->ops->action))(start_ccb); } @@ -4260,6 +4271,8 @@ xpt_async_bcast(struct async_list *async_head, path->device->sim->mtx : NULL; if (mtx) mtx_lock(mtx); + CAM_PROBE4(xpt, async__cb, cur_entry->callback_arg, + async_code, path, async_arg); cur_entry->callback(cur_entry->callback_arg, async_code, path, async_arg); @@ -4499,8 +4512,10 @@ xpt_done(union ccb *done_ccb) done_ccb->ccb_h.func_code, xpt_action_name(done_ccb->ccb_h.func_code), done_ccb->ccb_h.status)); - if ((done_ccb->ccb_h.func_code & XPT_FC_QUEUED) == 0) + if ((done_ccb->ccb_h.func_code & XPT_FC_QUEUED) == 0) { + CAM_PROBE1(xpt, done, done_ccb); return; + } /* Store the time the ccb was in the sim */ done_ccb->ccb_h.qos.periph_data = cam_iosched_delta_t(done_ccb->ccb_h.qos.periph_data); @@ -5376,6 +5391,11 @@ xpt_done_process(struct ccb_hdr *ccb_h) } } + /* + * Call as late as possible. Do we want an early one too before the + * unfreeze / releases above? + */ + CAM_PROBE1(xpt, done, (union ccb *)ccb_h); /* container_of? */ /* Call the peripheral driver's callback */ ccb_h->pinfo.index = CAM_UNQUEUED_INDEX; (*ccb_h->cbfcnp)(ccb_h->path->periph, (union ccb *)ccb_h);