From patchwork Tue Jul 2 08:39:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?54mb5b+X5Zu9IChaaGlndW8gTml1KQ==?= X-Patchwork-Id: 13719106 Received: from SHSQR01.spreadtrum.com (unknown [222.66.158.135]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 135ED14B97A for ; Tue, 2 Jul 2024 08:40:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=222.66.158.135 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719909645; cv=none; b=TCgCQzkELnN+R9VFLhnoMK97XD/L4+38tDqf5NoyLRdbgKFOOmog2AkmobEYl81FAq3NWdAPzqHSM3tt6ddInW8I541fDo/hC0QaTznwg8GOLh1G0mkJCwhO7YV2/tpo42hHAHRKtsCFmV46f/l/gJmAL0486/7NyNgQPebmMB8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719909645; c=relaxed/simple; bh=fwscrn97KsOnVFjvOnNiiMQZDpm03hQFPACXlM2a6QA=; h=From:To:CC:Subject:Date:Message-ID:References:In-Reply-To: Content-Type:MIME-Version; b=RMNmP73gYgTN2hDVjdfNyrD42JqbczJ5sXNkn5y3GALT/qyV2CfH/8tUEBnlv4SEQVKPiSXrcIxC9+94b3yjDFKxFOcBIob69VyioUCzLQhXLuZzc6PCgfCYiRlN7XFoBrQ9t/9TcDVNs2/iYbKxKMHPMAKEzjlArFNKDgdhcYE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com; spf=pass smtp.mailfrom=unisoc.com; arc=none smtp.client-ip=222.66.158.135 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=unisoc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=unisoc.com Received: from dlp.unisoc.com ([10.29.3.86]) by SHSQR01.spreadtrum.com with ESMTP id 4628dbxS010337; Tue, 2 Jul 2024 16:39:37 +0800 (+08) (envelope-from Zhiguo.Niu@unisoc.com) Received: from SHDLP.spreadtrum.com (bjmbx01.spreadtrum.com [10.0.64.7]) by dlp.unisoc.com (SkyGuard) with ESMTPS id 4WCx6W55Mjz2K4lJ5; Tue, 2 Jul 2024 16:34:43 +0800 (CST) Received: from BJMBX02.spreadtrum.com (10.0.64.8) by BJMBX01.spreadtrum.com (10.0.64.7) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 2 Jul 2024 16:39:36 +0800 Received: from BJMBX02.spreadtrum.com ([fe80::c8c3:f3a0:9c9f:b0fb]) by BJMBX02.spreadtrum.com ([fe80::c8c3:f3a0:9c9f:b0fb%19]) with mapi id 15.00.1497.023; Tue, 2 Jul 2024 16:39:36 +0800 From: =?utf-8?b?54mb5b+X5Zu9IChaaGlndW8gTml1KQ==?= To: Bart Van Assche , Jens Axboe CC: "linux-block@vger.kernel.org" , "Christoph Hellwig" , Damien Le Moal , =?utf-8?b?546L55qTIChIYW9faGFvIFdhbmcp?= Subject: =?utf-8?b?562U5aSNOiBbUEFUQ0ggdjIgMS8yXSBibG9jazogQ2FsbCAubGltaXRf?= =?utf-8?b?ZGVwdGgoKSBhZnRlciAuaGN0eCBoYXMgYmVlbiBzZXQ=?= Thread-Topic: [PATCH v2 1/2] block: Call .limit_depth() after .hctx has been set Thread-Index: AQHaojKspCB5D8X03k6mmXGW9i179LHjchNw Date: Tue, 2 Jul 2024 08:39:35 +0000 Message-ID: <57b38aac30d94bb1a167904db292d1fc@BJMBX02.spreadtrum.com> References: <20240509170149.7639-1-bvanassche@acm.org> <20240509170149.7639-2-bvanassche@acm.org> In-Reply-To: <20240509170149.7639-2-bvanassche@acm.org> Accept-Language: zh-CN, en-US Content-Language: zh-CN X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MAIL: SHSQR01.spreadtrum.com 4628dbxS010337 -----邮件原件----- 发件人: Bart Van Assche 发送时间: 2024年5月10日 1:02 收件人: Jens Axboe 抄送: linux-block@vger.kernel.org; Christoph Hellwig ; Bart Van Assche ; Damien Le Moal ; 牛志国 (Zhiguo Niu) 主题: [PATCH v2 1/2] block: Call .limit_depth() after .hctx has been set 注意: 这封邮件来自于外部。除非你确定邮件内容安全,否则不要点击任何链接和附件。 CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe. Call .limit_depth() after data->hctx has been set such that data->hctx can be used in .limit_depth() implementations. Cc: Christoph Hellwig Cc: Damien Le Moal Cc: Zhiguo Niu Fixes: 07757588e507 ("block/mq-deadline: Reserve 25% of scheduler tags for synchronous requests") Signed-off-by: Bart Van Assche --- block/blk-mq.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) Tested-by: Zhiguo Niu Thanks! if (q->elevator) { /* * All requests use scheduler tags when an I/O scheduler is @@ -469,13 +473,9 @@ static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data) if (ops->limit_depth) ops->limit_depth(data->cmd_flags, data); } - } - -retry: - data->ctx = blk_mq_get_ctx(q); - data->hctx = blk_mq_map_queue(q, data->cmd_flags, data->ctx); - if (!(data->rq_flags & RQF_SCHED_TAGS)) + } else { blk_mq_tag_busy(data->hctx); + } if (data->flags & BLK_MQ_REQ_RESERVED) data->rq_flags |= RQF_RESV; diff --git a/block/blk-mq.c b/block/blk-mq.c index 9f677ea85a52..a6310a550b78 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -448,6 +448,10 @@ static struct request *__blk_mq_alloc_requests(struct blk_mq_alloc_data *data) if (data->cmd_flags & REQ_NOWAIT) data->flags |= BLK_MQ_REQ_NOWAIT; +retry: + data->ctx = blk_mq_get_ctx(q); + data->hctx = blk_mq_map_queue(q, data->cmd_flags, data->ctx); + Hi Bart, I tested basic function about these serial patches and results is pass, and no warning report after setting async_depth value by sysfs, But there is a little question here, if do "retry", the following if case will be re-run also, so Is there something wrong with this or can it be improved? Otherwise