Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3100448imu; Sun, 9 Dec 2018 17:20:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/UipBiskm5dpysvWI33NMwlAK2uNmMY+yst+97CWmtWiriBzkbsIAj+QpKwj8FkUH/rAITq X-Received: by 2002:a17:902:bd0a:: with SMTP id p10mr9975540pls.322.1544404837484; Sun, 09 Dec 2018 17:20:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544404837; cv=none; d=google.com; s=arc-20160816; b=cMzcNEy7fyssNXbPFWq2/LSP86kgsm9cvtPHML+ifARPlmMz7WZa6IV/0XZolhpkMG XQCCJod0XMXYv3Fr01QuVYtQ+raIOWyBO0ZaRJ8HRG5y9gR6WBXxom8VEs7sQ+vkIRVT KAbAxIhKbQHUynDXAi8olA5t46x84FeZK5nNH4FsdqYlea/s2I9z1ZRmYnGLvzTB2q8f uK+EYXQ4QniuZEPfut02grKZkxSZ/gPFHrd2YqZbRXRtKJi8q3Ynj54Hxa75AIiaYJOr t28ttUBiaGMRJv+Ue7YQ2h3AZnG9cEvjgBpqjtfWJxEms6jSHeP1AYkd9cjfZ96Y1tkz FSdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=5Fa5LPxtSCfzdRQpfLnZTIFxQ10Gdf6J2bD4mu4OoqU=; b=cr688ZQC0rguJCu6kN3HENwUMnSbW1UF/tbIZF7qQHTMRPLFOMS96Q8Q+dJ1GOk+lv +j9mNjYyb3oDXqSKTF6xmtKVgu9L/USOuI2oXW2MkkbUXZDhXeDF/Fyq0KPHFLsxtBMk cHdNRDVm4g07RJRhGApkJ/Ysj2b3F4wYsoTNV12G95X8A9Y3Tm+kLCD+Z8Y/Fh+HNkKH 2DIhPmNBieFJQ4C4UYMz7/IVTy5E++vqdd91Ps3CpWPT12vEd1XHc+pVK3e4Cg6wy1BZ hPshv/gY2M+wA5D7rBZWIUBDPOMMninGHfIhk8Io7JW+7KzpAJwfKq0aW2de7/eAihRJ jtWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=JJiydG5l; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t4si7661852pga.83.2018.12.09.17.20.21; Sun, 09 Dec 2018 17:20:37 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=JJiydG5l; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726397AbeLJBSL (ORCPT + 99 others); Sun, 9 Dec 2018 20:18:11 -0500 Received: from userp2120.oracle.com ([156.151.31.85]:45328 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726291AbeLJBSL (ORCPT ); Sun, 9 Dec 2018 20:18:11 -0500 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wBA190u8065597; Mon, 10 Dec 2018 01:18:07 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2018-07-02; bh=5Fa5LPxtSCfzdRQpfLnZTIFxQ10Gdf6J2bD4mu4OoqU=; b=JJiydG5lxBpoEVsiWDMZHoshavIJRHCQk+3oOyu2Ge6/8+v85QW+uDPGIM0iacBuNm+D Uexw9056/Hyy7JguhOSgCBWpwzWv4fGZQdGvQarDsUS/E7YZor2hUFOhwz+NTG8MQ87R 0/8IzLUVkeSQoinTH4OJPvcctsR5jKJhogEJyCl4rKuQpzDmgEDghZYp54pEqhfpD0PY 7TO2IBQoWfhV7omd+S3Jv9xVcaijNKYKyW9iooo6S2igw8vSlJm2/NfQCudVZ5mBX1MZ 1N3TW3wQZUSh4i3V1vXgwNkHhS1p5QFWz9jGVIymhN9QLYjrcWJNA7TXhoGjfpTaVh5q uw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2120.oracle.com with ESMTP id 2p86kqk8g3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 Dec 2018 01:18:07 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wBA1I6WM009040 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 10 Dec 2018 01:18:06 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wBA1I58F022244; Mon, 10 Dec 2018 01:18:05 GMT Received: from [10.182.69.118] (/10.182.69.118) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 09 Dec 2018 17:18:04 -0800 Subject: Re: [PATCH V11 0/4] blk-mq: refactor code of issue directly To: Jens Axboe Cc: ming.lei@redhat.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org References: <1544152185-32667-1-git-send-email-jianchao.w.wang@oracle.com> <0adf3419-bcce-93d8-51fb-aee7cbb5ae17@oracle.com> <16205e68-aa5e-c59d-364e-4164a0e51dc7@kernel.dk> <1e183b77-2c4d-71ff-b019-2b1070d2ed6b@kernel.dk> <38eb7c50-dfad-d9cb-f8ab-a8f5250b0ed7@oracle.com> From: "jianchao.wang" Message-ID: <6432264f-57e9-d405-079e-21c0aa17b08e@oracle.com> Date: Mon, 10 Dec 2018 09:18:54 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9102 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812100009 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/7/18 11:47 AM, Jens Axboe wrote: > On 12/6/18 8:46 PM, jianchao.wang wrote: >> >> >> On 12/7/18 11:42 AM, Jens Axboe wrote: >>> On 12/6/18 8:41 PM, jianchao.wang wrote: >>>> >>>> >>>> On 12/7/18 11:34 AM, Jens Axboe wrote: >>>>> On 12/6/18 8:32 PM, Jens Axboe wrote: >>>>>> On 12/6/18 8:26 PM, jianchao.wang wrote: >>>>>>> >>>>>>> >>>>>>> On 12/7/18 11:16 AM, Jens Axboe wrote: >>>>>>>> On 12/6/18 8:09 PM, Jianchao Wang wrote: >>>>>>>>> Hi Jens >>>>>>>>> >>>>>>>>> Please consider this patchset for 4.21. >>>>>>>>> >>>>>>>>> It refactors the code of issue request directly to unify the interface >>>>>>>>> and make the code clearer and more readable. >>>>>>>>> >>>>>>>>> This patch set is rebased on the recent for-4.21/block and add the 1st >>>>>>>>> patch which inserts the non-read-write request to hctx dispatch >>>>>>>>> list to avoid to involve merge and io scheduler when bypass_insert >>>>>>>>> is true, otherwise, inserting is ignored, BLK_STS_RESOURCE is returned >>>>>>>>> and the caller will fail forever. >>>>>>>>> >>>>>>>>> The 2nd patch refactors the code of issue request directly to unify the >>>>>>>>> helper interface which could handle all the cases. >>>>>>>>> >>>>>>>>> The 3rd patch make blk_mq_sched_insert_requests issue requests directly >>>>>>>>> with 'bypass' false, then it needn't to handle the non-issued requests >>>>>>>>> any more. >>>>>>>>> >>>>>>>>> The 4th patch replace and kill the blk_mq_request_issue_directly. >>>>>>>> >>>>>>>> Sorry to keep iterating on this, but let's default to inserting to >>>>>>>> the dispatch list if we ever see busy from a direct dispatch. I'm fine >>>>>>>> with doing that for 4.21, as suggested by Ming, I just didn't want to >>>>>>>> fiddle with it for 4.20. This will prevent any merging on the request >>>>>>>> going forward, which I think is a much safer default. >>>>>>>> >>>>>>>> You do this already for some cases. Let's do it unconditionally for >>>>>>>> a request that was ever subjected to ->queue_rq() and we didn't either >>>>>>>> error or finish after the fact. >>>>>>>> >>>>>>> I have done it in this version if I get your point correctly. >>>>>>> Please refer to the following fragment in the 2nd patch. >>>>>>> >>>>>>> + /* >>>>>>> + * If the request is issued unsuccessfully with >>>>>>> + * BLK_STS_DEV_RESOURCE or BLK_STS_RESOURCE, insert >>>>>>> + * the request to hctx dispatch list due to attached >>>>>>> + * lldd resource. >>>>>>> + */ >>>>>>> + force = true; >>>>>>> + ret = __blk_mq_issue_directly(hctx, rq, cookie, last); >>>>>>> +out_unlock: >>>>>>> + hctx_unlock(hctx, srcu_idx); >>>>>>> +out: >>>>>>> + switch (ret) { >>>>>>> + case BLK_STS_OK: >>>>>>> + break; >>>>>>> + case BLK_STS_DEV_RESOURCE: >>>>>>> + case BLK_STS_RESOURCE: >>>>>>> + if (force) { >>>>>>> + blk_mq_request_bypass_insert(rq, run_queue); >>>>>>> + ret = bypass ? BLK_STS_OK : ret; >>>>>>> + } else if (!bypass) { >>>>>>> + blk_mq_sched_insert_request(rq, false, >>>>>>> + run_queue, false); >>>>>>> + } >>>>>>> + break; >>>>>>> + default: >>>>>> >>>>>> You are right, I missed that you set force = true before doing the >>>>>> issue. So this looks good to me! >>>>> >>>>> I applied your series. With this, we should be good to remove the >>>>> REQ_NOMERGE logic that was added for the corruption case, and the >>>>> blk_rq_can_direct_dispatch() as well? >>>>> >>>> >>>> Yes, it should be that. >>>> Every thing rejected by .queue_rq is ended or inserted into hctx dispatch >>>> list. And also direct-issue path is unified with normal path. >>> >>> Why are we doing that return value dance, depending on whether this >>> is a bypass insert or not? That seems confusing. >>> >> >> For the 'bypass == false' case, it need to know whether the request is issued >> successfully. This is for the 3rd patch. >> I used to use the returned cookie to identify the result, but you don't like it. >> So I have to use this return value. > > Makes sense, but could probably do with a comment. I'm going to let the > series float for a day or two to ensure others get a chance to review it, > then we can move forward. > Do I need a respin about the comment ? Thanks Jianchao