Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp3547081pxj; Mon, 24 May 2021 09:06:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcrOqCusCQKo09Prf8P/qCHtEdY5SRAL9Cc2qhmhxs2RGLH23IwspX1krLFsabh2mifj2y X-Received: by 2002:a05:6602:5cd:: with SMTP id w13mr11461986iox.185.1621872394171; Mon, 24 May 2021 09:06:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621872394; cv=none; d=google.com; s=arc-20160816; b=mwAvWlt4GgGI4HXQHCPwDTfan8uViy4jlHBTEWR9Y8jEhuXrPNc2sGva33lmA35+qo gRB5cQ8guuI7wjkQYVSXfNXmwMQfXKemWJNBYABvp+HtgNZGSko0kCXUAvLsyU+wstPv Q4wFaO7zFiMZxoOuCO4Xulhcks4H8NqDPP/o1gDKQaKOT5h2inBy+LVcXsy7ebsTbiFa u5KEhs2Tbn4F3LyRXe0zrA8pLQM3jwJ0Z0vv5SAgoOUG8KK9MWiIS8fKulgSwMFuP7fn 4qSkHBEHldBdVzyQDdaMKr4i0EgvFknHGedhTQdZC0z0plgJJnpQCQK8ov+PM6tAko3A YVeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Xeh07+BjT2ig3SmDL2szdOPmZffQfL49H1CxAt6nLbE=; b=WBhS8SzV2sTyBiMnfvsmcFz3nOA0PZQ1YZ0anwGaenMq0wA7C6b21WJwsRaqBMkeTw 0mouhyLyq+O74X23Dzul6RYVnAfbyC1svmOcMHPK+s32DG5n8MhcQKCbiocaVRhnprrD 8f1lfGThKKHwUvyD2N1WZH5CrZH+nB9qhCrFzbIBLVVMTO8PoU/duvEXykuKHw+ztiE4 DXEYN8tMNKarktuOtZjtiJioOAGKJIwUqcyFbF1QSsBhq+pPfPqYLKyyNWvX/O3GfneD Ov+qkh+RNx8xiieqm0zFhZHagdPZugqekCs21J/MsvGDdOvz4Tq4Cx6Lu6kUBrCCsBW+ xfzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MxoEVidp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id f10si16537583ilu.68.2021.05.24.09.06.14; Mon, 24 May 2021 09:06:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=MxoEVidp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236780AbhEXQEh (ORCPT + 99 others); Mon, 24 May 2021 12:04:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:41102 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234242AbhEXP6C (ORCPT ); Mon, 24 May 2021 11:58:02 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 49366613CB; Mon, 24 May 2021 15:43:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621871037; bh=3l6pymyl+oPTyVTGM7doMqP4IkPWHoeq1NoWfbaslgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MxoEVidpVD8f/WqaYPf/K097P/PnLXoXrBHesBlLCHRTvMdB2/aqQqSVcbkZG7/7P UAYLPFEaV3CY3cKnSzMwnXR435KRFXHwXSoBLrwhpJe15/vSbhbOc9UVaGUDj2Row+ NGDkFOu79gsmNy//nca7lUzMcVlMV6pB/4WQg4CQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Can Guo , Alim Akhtar , Avri Altman , Stanley Chu , Bean Huo , Adrian Hunter , Bart Van Assche , "Martin K. Petersen" , Sasha Levin Subject: [PATCH 5.12 010/127] scsi: ufs: core: Increase the usable queue depth Date: Mon, 24 May 2021 17:25:27 +0200 Message-Id: <20210524152335.205174543@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210524152334.857620285@linuxfoundation.org> References: <20210524152334.857620285@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bart Van Assche [ Upstream commit d0b2b70eb12e9ffaf95e11b16b230a4e015a536c ] With the current implementation of the UFS driver active_queues is 1 instead of 0 if all UFS request queues are idle. That causes hctx_may_queue() to divide the queue depth by 2 when queueing a request and hence reduces the usable queue depth. The shared tag set code in the block layer keeps track of the number of active request queues. blk_mq_tag_busy() is called before a request is queued onto a hwq and blk_mq_tag_idle() is called some time after the hwq became idle. blk_mq_tag_idle() is called from inside blk_mq_timeout_work(). Hence, blk_mq_tag_idle() is only called if a timer is associated with each request that is submitted to a request queue that shares a tag set with another request queue. Adds a blk_mq_start_request() call in ufshcd_exec_dev_cmd(). This doubles the queue depth on my test setup from 16 to 32. In addition to increasing the usable queue depth, also fix the documentation of the 'timeout' parameter in the header above ufshcd_exec_dev_cmd(). Link: https://lore.kernel.org/r/20210513164912.5683-1-bvanassche@acm.org Fixes: 7252a3603015 ("scsi: ufs: Avoid busy-waiting by eliminating tag conflicts") Cc: Can Guo Cc: Alim Akhtar Cc: Avri Altman Cc: Stanley Chu Cc: Bean Huo Cc: Adrian Hunter Reviewed-by: Can Guo Signed-off-by: Bart Van Assche Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/ufs/ufshcd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c index 0c71a159d08f..e1e510882ff4 100644 --- a/drivers/scsi/ufs/ufshcd.c +++ b/drivers/scsi/ufs/ufshcd.c @@ -2849,7 +2849,7 @@ static int ufshcd_wait_for_dev_cmd(struct ufs_hba *hba, * ufshcd_exec_dev_cmd - API for sending device management requests * @hba: UFS hba * @cmd_type: specifies the type (NOP, Query...) - * @timeout: time in seconds + * @timeout: timeout in milliseconds * * NOTE: Since there is only one available tag for device management commands, * it is expected you hold the hba->dev_cmd.lock mutex. @@ -2879,6 +2879,9 @@ static int ufshcd_exec_dev_cmd(struct ufs_hba *hba, } tag = req->tag; WARN_ON_ONCE(!ufshcd_valid_tag(hba, tag)); + /* Set the timeout such that the SCSI error handler is not activated. */ + req->timeout = msecs_to_jiffies(2 * timeout); + blk_mq_start_request(req); init_completion(&wait); lrbp = &hba->lrb[tag]; -- 2.30.2