From owner-svn-src-stable-11@freebsd.org Tue Dec 3 16:52:40 2019 Return-Path: Delivered-To: svn-src-stable-11@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 224321B572B; Tue, 3 Dec 2019 16:52:40 +0000 (UTC) (envelope-from mav@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47S7MD0499z4cqF; Tue, 3 Dec 2019 16:52:40 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9FD51ABBA; Tue, 3 Dec 2019 16:52:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id xB3GqdF4096220; Tue, 3 Dec 2019 16:52:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id xB3Gqd5d096219; Tue, 3 Dec 2019 16:52:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201912031652.xB3Gqd5d096219@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Tue, 3 Dec 2019 16:52:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r355341 - stable/11/sys/cam X-SVN-Group: stable-11 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/11/sys/cam X-SVN-Commit-Revision: 355341 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Dec 2019 16:52:40 -0000 Author: mav Date: Tue Dec 3 16:52:39 2019 New Revision: 355341 URL: https://svnweb.freebsd.org/changeset/base/355341 Log: MFC r355023: Do not retry long ready waits if previous gave nothing. I have some disks reporting "Logical unit is in process of becoming ready" for about half an hour before finally reporting failure. During that time CAM waits for the readiness during ~2 minutes for each request, that makes system boot take very long time. This change reduces wait times for the following requests to ~1 second if previously long wait for that device has timed out. Modified: stable/11/sys/cam/cam_periph.c stable/11/sys/cam/cam_periph.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/cam_periph.c ============================================================================== --- stable/11/sys/cam/cam_periph.c Tue Dec 3 16:52:03 2019 (r355340) +++ stable/11/sys/cam/cam_periph.c Tue Dec 3 16:52:39 2019 (r355341) @@ -1345,6 +1345,14 @@ camperiphdone(struct cam_periph *periph, union ccb *do xpt_async(AC_INQ_CHANGED, done_ccb->ccb_h.path, NULL); } + /* If we tried long wait and still failed, remember that. */ + if ((periph->flags & CAM_PERIPH_RECOVERY_WAIT) && + (done_ccb->csio.cdb_io.cdb_bytes[0] == TEST_UNIT_READY)) { + periph->flags &= ~CAM_PERIPH_RECOVERY_WAIT; + if (error != 0 && done_ccb->ccb_h.retry_count == 0) + periph->flags |= CAM_PERIPH_RECOVERY_WAIT_FAILED; + } + /* * After recovery action(s) completed, return to the original CCB. * If the recovery CCB has failed, considering its own possible @@ -1695,7 +1703,9 @@ camperiphscsisenseerror(union ccb *ccb, union ccb **or */ int retries; - if ((err_action & SSQ_MANY) != 0) { + if ((err_action & SSQ_MANY) != 0 && (periph->flags & + CAM_PERIPH_RECOVERY_WAIT_FAILED) == 0) { + periph->flags |= CAM_PERIPH_RECOVERY_WAIT; *action_string = "Polling device for readiness"; retries = 120; } else { Modified: stable/11/sys/cam/cam_periph.h ============================================================================== --- stable/11/sys/cam/cam_periph.h Tue Dec 3 16:52:03 2019 (r355340) +++ stable/11/sys/cam/cam_periph.h Tue Dec 3 16:52:39 2019 (r355341) @@ -129,6 +129,8 @@ struct cam_periph { #define CAM_PERIPH_RUN_TASK 0x40 #define CAM_PERIPH_FREE 0x80 #define CAM_PERIPH_ANNOUNCED 0x100 +#define CAM_PERIPH_RECOVERY_WAIT 0x200 +#define CAM_PERIPH_RECOVERY_WAIT_FAILED 0x400 uint32_t scheduled_priority; uint32_t immediate_priority; int periph_allocating;