From nobody Thu Dec 11 19:08:05 2025 X-Original-To: dev-commits-src-main@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 4dS2D56z4Nz6KCjP for ; Thu, 11 Dec 2025 19:08:05 +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 "R12" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dS2D54pB6z3JGw for ; Thu, 11 Dec 2025 19:08:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765480085; 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=LkSzb6X/wEX8/J61tslF3dCT8Xocuc1o9i5gmw0Cd7g=; b=OgoXM9/26Rmi5PU8DpQ3jRWFY0uTiuBX39qWxMJBbRsxwDjclyF6qjT6ze2OZO1Zs20REV 2uk6LT5fd5oLbDgsQyY2qTt1Sw3UB66mN/6Z2ux/uMFc0eixCYhQFpHq9mn1ocFjY/tzap zWK0kh/vF5DPmgT131Fb8g9wuoitzhd9hEWCQ4q56ux5yj+4iV7dQORN3biQa9jTampvRs D8wOJIz8wISX/9BPHZC1xqz6tOCVlEVHqECaupB/WslObrJEN0pDKvr+9uSMAj/YUr4IdZ lW1jDx3KmKdW+TaFqmrGXCZJb2VKAXywJ5GalvkIsSMm50HlfFvSnlLWa2qcTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1765480085; 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=LkSzb6X/wEX8/J61tslF3dCT8Xocuc1o9i5gmw0Cd7g=; b=q3yZ3sfa04yQoX6pl3Tj8IfrA9fcl5O1VteTyy5yJtIPv62d8N2CgaE38CUOBfJm8dZ9JN Fbm8lSjIn/D4L74yiFocqSxoJuPTDcRfknvzAYEtfk0SGcO7AdkwcVEysR1e8OC38bwFYT dCZiASsNrVrJFEas3SLH2LiwuMhi5QqzoPT0Mcr4fsvsIQSwSLuzFjlzqri0NU8X+UmPYV /JRFNMJ3wS1DusQSpO47lrkbVyUpiWbwPZmdDGrh2bfkLUXpWWA9NzKFfktbw5LCOej/mn aiI4WGcO6FbOWy7rjVppFhiOrHQszv9bg2u06Engx5Yupze6IYhjs3KffJkFMQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1765480085; a=rsa-sha256; cv=none; b=FRF6kjW6hO2pv2MGBfzfRD3hBennpGnaWVAKoIg39V2quIRV3qIy8Hvz8eO9Tmrwtg6vG4 0frglSgBtzIOPhkyDqq+ja4uK5eYGW8zG2Ro0RcPADsjeBE/wgWlSe31ohwq4p9fcTz7SZ fuCSxWKQM0dpj7+0qhh56JqUNE1U6w4TluwL3yiHPI7BNQBbHnrofnWoRXf9uHJ6NS9qBT N6/zdrnItCDgN7CzgXErM3fsTkaGZbOF8bEgB8ULPm0diBlot0kUJsNa3w88JLpTpOSApg nr9QtRALbfM8Cp6BeVzCd5YxrtehsFKiks7JqpKfSsc0DadGke/noh18Lz4pmw== 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 4dS2D53bHfzkdB for ; Thu, 11 Dec 2025 19:08:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 268a9 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 11 Dec 2025 19:08:05 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 8ac7a3801c6a - main - cam: Reduce overly long timeout values for initial device probing List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@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: 8ac7a3801c6a780edf6166c14915d7ac6e36e816 Auto-Submitted: auto-generated Date: Thu, 11 Dec 2025 19:08:05 +0000 Message-Id: <693b1695.268a9.145b4f4f@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=8ac7a3801c6a780edf6166c14915d7ac6e36e816 commit 8ac7a3801c6a780edf6166c14915d7ac6e36e816 Author: Warner Losh AuthorDate: 2025-12-11 19:05:32 +0000 Commit: Warner Losh CommitDate: 2025-12-11 19:07:17 +0000 cam: Reduce overly long timeout values for initial device probing Currently, we have very long timeouts for the initial probing commands. However, these are not appropriate for modern (post 2010) SCSI disks. Sandards since SPC3 state that these commands should not wait for media access. Since we retry them several times during the initial bus scan, these delays can delay the boot by minutes (5 minutes per errant disk in our expereince). These delays don't help and only hurt, so reduce the TESTUNITREADY, INQUIRY and MODESENSE commands (during the initial probe). Provide sysctl/tuneables to change the time for these and also the REPORTLUNS commands for people that might need to adjust them for devices that violate this belief but none-the-less work with longer timeouts. kern.cam.tur_timeout (default was 60s, now 1s) kern.cam.inquiry_timeout (default was 60s, now 1s) kern.cam.reportluns_timeout (default is 60s) kern.cam.modesense_timeout (default was 60s, now 1s) This can be partially merged: the sysctls can, but the new defaults likely shouldn't. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D52427 --- UPDATING | 11 +++++++++++ share/man/man4/scsi.4 | 34 +++++++++++++++++++++++++++++++++- sys/cam/scsi/scsi_xpt.c | 28 ++++++++++++++++++++++------ 3 files changed, 66 insertions(+), 7 deletions(-) diff --git a/UPDATING b/UPDATING index aaef0e5b4cd3..f6cf0109f894 100644 --- a/UPDATING +++ b/UPDATING @@ -27,6 +27,17 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 16.x IS SLOW: world, or to merely disable the most expensive debugging functionality at runtime, run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20251212: + Timeouts for SCSI bus probing have been drastically reduced. They are + now tuneables that can be set in the boot loader should you have a + device that requires a longer-than-standards imply timeout but + none-the-less works. + + kern.cam.tur_timeout (default was 60s, now 1s) + kern.cam.inquiry_timeout (default was 60s, now 1s) + kern.cam.reportluns_timeout (default is 60s) + kern.cam.modesense_timeout (default was 60s, now 1s) + 20251115: The FreeBSD-base repository is now defined in /etc/pkg/FreeBSD.conf, disabled by default. In -CURRENT and -STABLE this points at nightly diff --git a/share/man/man4/scsi.4 b/share/man/man4/scsi.4 index 380768c2d7c1..c922f3f56d15 100644 --- a/share/man/man4/scsi.4 +++ b/share/man/man4/scsi.4 @@ -22,7 +22,7 @@ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. -.Dd December 11, 2023 +.Dd December 11, 2025 .Dt CAM 4 .Os .Sh NAME @@ -69,6 +69,38 @@ appropriate drivers. The .Xr pass 4 driver, if it is configured in the kernel, will attach to all devices. +.Sh SYSCTL VARIABLES +The following variables are available as both +.Xr sysctl 8 +variables and +.Xr loader 8 +tunables: +.Bl -tag -width 12 +.It Va kern.cam.cam_srch_hi +Search above LUN 7 for SCSI3 and greater devices. +.It Va kern.cam.tur_timeout +Timeout, in ms, for the initial TESTUNITREADY command we send to the devices +during their initial probing. +Defaults to 1s. +.Fx 15 +and earlier set this to 60s. +.It Va kern.cam.inquiry_timeout +Timeout, in ms, for the initial INQUIRY command we send to the devices +during their initial probing. +Defaults to 1s. +.Fx 15 +and earlier set this to 60s. +.It Va kern.cam.reportluns_timeout +Timeout, in ms, for the initial REPORTLUNS command we send to the devices +during their initial probing. +Defaults to 50s. +.It Va kern.cam.modesense_timeout +Timeout, in ms, for the initial MODESENSE command we send to the devices +during their initial probing. +Defaults to 1s. +.Fx 15 +and earlier set this to 60s. +.El .Sh KERNEL CONFIGURATION There are a number of generic kernel configuration options for the .Nm diff --git a/sys/cam/scsi/scsi_xpt.c b/sys/cam/scsi/scsi_xpt.c index d0c170867b97..835c7c8ad825 100644 --- a/sys/cam/scsi/scsi_xpt.c +++ b/sys/cam/scsi/scsi_xpt.c @@ -78,6 +78,22 @@ static int cam_srch_hi = 0; SYSCTL_INT(_kern_cam, OID_AUTO, cam_srch_hi, CTLFLAG_RWTUN, &cam_srch_hi, 0, "Search above LUN 7 for SCSI3 and greater devices"); +static int tur_timeout = 1000; /* 1s now, 60s before */ +SYSCTL_INT(_kern_cam, OID_AUTO, tur_timeout, CTLFLAG_RWTUN, + &tur_timeout, 0, "TESTUNITREADY timeout on probing"); + +static int inquiry_timeout = 1000; /* 1s now, 60s before */ +SYSCTL_INT(_kern_cam, OID_AUTO, inquiry_timeout, CTLFLAG_RWTUN, + &inquiry_timeout, 0, "INQUIRY timeout on probing"); + +static int reportluns_timeout = 60000; /* 60s */ +SYSCTL_INT(_kern_cam, OID_AUTO, reportluns_timeout, CTLFLAG_RWTUN, + &reportluns_timeout, 0, "REPORTLUNS timeout on probing"); + +static int modesense_timeout = 1000; /* 1s now, 60s */ +SYSCTL_INT(_kern_cam, OID_AUTO, modesense_timeout, CTLFLAG_RWTUN, + &modesense_timeout, 0, "MODESENSE timeout on probing"); + #define CAM_SCSI2_MAXLUN 8 #define CAM_CAN_GET_SIMPLE_LUN(x, i) \ ((((x)->luns[i].lundata[0] & RPL_LUNDATA_ATYP_MASK) == \ @@ -760,7 +776,7 @@ again: probedone, MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, - /*timeout*/60000); + /*timeout*/tur_timeout); break; } case PROBE_INQUIRY: @@ -816,7 +832,7 @@ again: /*evpd*/FALSE, /*page_code*/0, SSD_MIN_SIZE, - /*timeout*/60 * 1000); + /*timeout*/inquiry_timeout); break; } case PROBE_REPORT_WLUNS: @@ -856,7 +872,7 @@ again: } scsi_report_luns(csio, 5, probedone, MSG_SIMPLE_Q_TAG, RPL_REPORT_DEFAULT, rp, periph->path->target->rpl_size, - SSD_FULL_SIZE, 60000); + SSD_FULL_SIZE, reportluns_timeout); break; } case PROBE_MODE_SENSE: @@ -879,7 +895,7 @@ again: mode_buf, mode_buf_len, SSD_FULL_SIZE, - /*timeout*/60000); + /*timeout*/modesense_timeout); break; } xpt_print(periph->path, @@ -1026,7 +1042,7 @@ done: probedone, MSG_SIMPLE_Q_TAG, SSD_FULL_SIZE, - /*timeout*/60000); + /*timeout*/tur_timeout); break; } @@ -1039,7 +1055,7 @@ done: /*evpd*/FALSE, /*page_code*/0, SSD_MIN_SIZE, - /*timeout*/60 * 1000); + /*timeout*/inquiry_timeout); break; } default: