From owner-svn-src-all@freebsd.org Tue Mar 26 15:47:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3BFC61556A67; Tue, 26 Mar 2019 15:47:14 +0000 (UTC) (envelope-from trasz@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 CB3E571365; Tue, 26 Mar 2019 15:47:13 +0000 (UTC) (envelope-from trasz@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 AA0C821CDF; Tue, 26 Mar 2019 15:47:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x2QFlDTC099863; Tue, 26 Mar 2019 15:47:13 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x2QFlDWC099862; Tue, 26 Mar 2019 15:47:13 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201903261547.x2QFlDWC099862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 26 Mar 2019 15:47:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r345549 - head/sys/dev/smartpqi X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sys/dev/smartpqi X-SVN-Commit-Revision: 345549 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: CB3E571365 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.95 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.95)[-0.954,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Mar 2019 15:47:14 -0000 Author: trasz Date: Tue Mar 26 15:47:13 2019 New Revision: 345549 URL: https://svnweb.freebsd.org/changeset/base/345549 Log: Make smartpqi(4) behave better when running out of memory, by returning CAM_RESRC_UNAVAIL instead of CAM_REQUEUE_REQ. This makes CAM delay a bit before retrying, so that the retries actually get a chance to succeed. Reviewed by: sbruno MFC after: 2 weeks Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D19696 Modified: head/sys/dev/smartpqi/smartpqi_cam.c Modified: head/sys/dev/smartpqi/smartpqi_cam.c ============================================================================== --- head/sys/dev/smartpqi/smartpqi_cam.c Tue Mar 26 15:44:06 2019 (r345548) +++ head/sys/dev/smartpqi/smartpqi_cam.c Tue Mar 26 15:47:13 2019 (r345549) @@ -458,6 +458,15 @@ void os_aio_response_error(rcb_t *rcb, aio_path_error_ DBG_IO("OUT\n"); } +static void +pqi_freeze_ccb(union ccb *ccb) +{ + if ((ccb->ccb_h.status & CAM_DEV_QFRZN) == 0) { + ccb->ccb_h.status |= CAM_DEV_QFRZN; + xpt_freeze_devq(ccb->ccb_h.path, 1); + } +} + /* * Command-mapping helper function - populate this command's s/g table. */ @@ -472,9 +481,8 @@ pqi_request_map_helper(void *arg, bus_dma_segment_t *s if( error || nseg > softs->pqi_cap.max_sg_elem ) { - xpt_freeze_simq(softs->os_specific.sim, 1); - rcb->cm_ccb->ccb_h.status |= (CAM_REQUEUE_REQ| - CAM_RELEASE_SIMQ); + rcb->cm_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + pqi_freeze_ccb(rcb->cm_ccb); DBG_ERR_BTL(rcb->dvp, "map failed err = %d or nseg(%d) > sgelem(%d)\n", error, nseg, softs->pqi_cap.max_sg_elem); pqi_unmap_request(rcb); @@ -484,9 +492,8 @@ pqi_request_map_helper(void *arg, bus_dma_segment_t *s rcb->sgt = os_mem_alloc(softs, nseg * sizeof(rcb_t)); if (rcb->sgt == NULL) { - xpt_freeze_simq(softs->os_specific.sim, 1); - rcb->cm_ccb->ccb_h.status |= (CAM_REQUEUE_REQ| - CAM_RELEASE_SIMQ); + rcb->cm_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + pqi_freeze_ccb(rcb->cm_ccb); DBG_ERR_BTL(rcb->dvp, "os_mem_alloc() failed; nseg = %d\n", nseg); pqi_unmap_request(rcb); xpt_done((union ccb *)rcb->cm_ccb); @@ -514,9 +521,8 @@ pqi_request_map_helper(void *arg, bus_dma_segment_t *s if (error) { rcb->req_pending = false; - xpt_freeze_simq(softs->os_specific.sim, 1); - rcb->cm_ccb->ccb_h.status |= (CAM_REQUEUE_REQ - |CAM_RELEASE_SIMQ); + rcb->cm_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; + pqi_freeze_ccb(rcb->cm_ccb); DBG_ERR_BTL(rcb->dvp, "Build IO failed, error = %d\n", error); pqi_unmap_request(rcb); xpt_done((union ccb *)rcb->cm_ccb);