From owner-svn-src-head@freebsd.org Fri Feb 17 04:34:19 2017 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BFEFCDF065; Fri, 17 Feb 2017 04:34:19 +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 mx1.freebsd.org (Postfix) with ESMTPS id E25F9105A; Fri, 17 Feb 2017 04:34:18 +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 v1H4YHbk007430; Fri, 17 Feb 2017 04:34:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v1H4YHoF007429; Fri, 17 Feb 2017 04:34:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201702170434.v1H4YHoF007429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 17 Feb 2017 04:34:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r313852 - head/sys/dev/iscsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Feb 2017 04:34:19 -0000 Author: mav Date: Fri Feb 17 04:34:17 2017 New Revision: 313852 URL: https://svnweb.freebsd.org/changeset/base/313852 Log: Freeze CAM SIM when request is postponed due to MaxCmdSN. This allows to avoid resource allocation (especially offload) for requests that can not be executed at this time any way. MFC after: 2 weeks Modified: head/sys/dev/iscsi/iscsi.c Modified: head/sys/dev/iscsi/iscsi.c ============================================================================== --- head/sys/dev/iscsi/iscsi.c Fri Feb 17 04:29:23 2017 (r313851) +++ head/sys/dev/iscsi/iscsi.c Fri Feb 17 04:34:17 2017 (r313852) @@ -231,14 +231,16 @@ iscsi_session_send_postponed(struct iscs ISCSI_SESSION_LOCK_ASSERT(is); - while (!STAILQ_EMPTY(&is->is_postponed)) { - request = STAILQ_FIRST(&is->is_postponed); + if (STAILQ_EMPTY(&is->is_postponed)) + return; + while ((request = STAILQ_FIRST(&is->is_postponed)) != NULL) { postpone = iscsi_pdu_prepare(request); if (postpone) - break; + return; STAILQ_REMOVE_HEAD(&is->is_postponed, ip_next); icl_pdu_queue(request); } + xpt_release_simq(is->is_sim, 1); } static void @@ -252,6 +254,8 @@ iscsi_pdu_queue_locked(struct icl_pdu *r iscsi_session_send_postponed(is); postpone = iscsi_pdu_prepare(request); if (postpone) { + if (STAILQ_EMPTY(&is->is_postponed)) + xpt_freeze_simq(is->is_sim, 1); STAILQ_INSERT_TAIL(&is->is_postponed, request, ip_next); return; } @@ -339,8 +343,9 @@ iscsi_session_cleanup(struct iscsi_sessi /* * Remove postponed PDUs. */ - while (!STAILQ_EMPTY(&is->is_postponed)) { - pdu = STAILQ_FIRST(&is->is_postponed); + if (!STAILQ_EMPTY(&is->is_postponed)) + xpt_release_simq(is->is_sim, 1); + while ((pdu = STAILQ_FIRST(&is->is_postponed)) != NULL) { STAILQ_REMOVE_HEAD(&is->is_postponed, ip_next); icl_pdu_free(pdu); }