Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp79766imu; Thu, 6 Dec 2018 19:44:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/XPwX4lBR2owhN6jg8jvzAr7MJ1/8FQY51NYwHAE1t+2M3VbRV5seoLn2t0u6zKz4UHuxLt X-Received: by 2002:a17:902:3383:: with SMTP id b3mr646393plc.170.1544154289014; Thu, 06 Dec 2018 19:44:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544154288; cv=none; d=google.com; s=arc-20160816; b=HY7RvvDA+kdFraXjKXoWgyFuzqNPodQVBgkTyndhLlOSkPmT098LGgAcABOFdWD01L ZH4a9p1uFgez/Gfwr68/ok5ZyNiaFByVooYN4EImpZ7h5sKwoFX7rXbw27SXtJSlr1Lw pgiVjIokbp0wf/YWavnCNjkOceCpCMnHVu9Prhq22maOLLVEci7ZOETfWjSHUbVxMd1L oWkhp8/phYoIXUxXLzYN7slJ4a7gn6bdc/J4sn2rv6QNS4CGYXBR34V9I7ZIZH+khCtJ pwaUdm8sovIgh0ZhLL60kfCnEBq2EnX9zKhdU2cdaTUGCV49uEkfKh8GJulsOHwETWlj BBTA== 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=PRLk5oWb9dP5b3xlPgZxdfJer+uCyI27EzVWMWm0yEg=; b=j3xQqGphrIHvcJOnY4ILo/sD8FYXvkqc67j0xmQhft9IV8DocXlQyVDrYDdZpDsT1g DoUnxOc6XndIn4ZxZzygA0OIkfIKoSNovwXE7iGdCkYJeyGoFlBGh5QFe8LJQ9Yjos8t pAeF1Oz+U5SiUwDc6Vf8ip23QRJOibyaCxWnmQwhaWXHAJ/Mxc7pCmlVl0LSCUsfUcTg czNHDpjm/DfSE1tCPKf5a+RddCjpbZTLKvCoStiJ7hr93UtYRIMwMrJ+3wJGQf9jCRuw Xfi246v6oXB5kaYQnAcPu3yHfx5CM9+dPcPiEZcjhMxqCaRusie0vHhUwx1bIoZ8/K1j fK1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=l5syHDpL; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l10si1972836pls.162.2018.12.06.19.44.33; Thu, 06 Dec 2018 19:44:48 -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=@kernel-dk.20150623.gappssmtp.com header.s=20150623 header.b=l5syHDpL; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726059AbeLGDmd (ORCPT + 99 others); Thu, 6 Dec 2018 22:42:33 -0500 Received: from mail-pg1-f194.google.com ([209.85.215.194]:39158 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725985AbeLGDmd (ORCPT ); Thu, 6 Dec 2018 22:42:33 -0500 Received: by mail-pg1-f194.google.com with SMTP id w6so1086986pgl.6 for ; Thu, 06 Dec 2018 19:42:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=PRLk5oWb9dP5b3xlPgZxdfJer+uCyI27EzVWMWm0yEg=; b=l5syHDpL0OdtpD6FkdOud2/+Z9SGeU/GlvBxKZ+0eBrtKmOHeXlmV9RwdsKxD9rhuG wkBIV6I96aoBY/q/Wx7GeUOjdqRIsjwwgD/bxrXeEY+tFrsUHviKOzW3aBtiINQBtG1O Yb1TZ0rLiJ8RwV6ad6FJ1repZENCqeNoQXGfuUIjPeTmlpUKgD8X8sYD+ByHjs0r3F5g u3O47VtX8L78lY7aNBbAWHwpmHxwrbsJjl0LJm16J6PdyzmKP3sw/9Lw7Qc/lVC+asqH xnA8DfIhtneBBsxVz3HggYXZXPXpSbwWyeIrDraF2JYI7Xb/8P+llPqzAhGtA5W2QqLi +VbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=PRLk5oWb9dP5b3xlPgZxdfJer+uCyI27EzVWMWm0yEg=; b=KWrGX6NdCfdFfOZ2d860djZVs31RHfQfkuJqv+0RyA7bAStCFembGAOQ5dAUPQ6+2t DXIlY8jwcwLhEeUHJsari9gGXR/gyxY2MdrWuZ1vE5TkaKSDE2IhDFq+v/Ym5kfrIn/d ywqXvdtTduLCkMSJwyi/mk/WKjyzfn8+Z4Uan+U2Sh7OYN2L9bt3LPmRMo98KBhYkWb+ 1jJwiEnuB5jzkn6Y9KMYl4TTBRy6/G/dhajnOTcoZXMmztw3Hjzibd1jR8ma0N5OhUwh CZ5+Li8JurM37Hzx/88VIHAEmo2RnpXJj655BcEB3Np31sgMiIp2LfZNsQdJbYo95mcj FBmw== X-Gm-Message-State: AA+aEWazYnHrCdy0X/KgAiA0de+12K6DNceFaiSNt1yrGUevtSZ8A21O mX9braN/zmlcXSJm7ET7m8VK3kspQEg= X-Received: by 2002:a62:f5da:: with SMTP id b87mr646168pfm.253.1544154151772; Thu, 06 Dec 2018 19:42:31 -0800 (PST) Received: from [192.168.1.121] (66.29.188.166.static.utbb.net. [66.29.188.166]) by smtp.gmail.com with ESMTPSA id l22sm3125490pfj.179.2018.12.06.19.42.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 19:42:30 -0800 (PST) Subject: Re: [PATCH V11 0/4] blk-mq: refactor code of issue directly To: "jianchao.wang" 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> From: Jens Axboe Message-ID: <1e183b77-2c4d-71ff-b019-2b1070d2ed6b@kernel.dk> Date: Thu, 6 Dec 2018 20:42:28 -0700 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Jens Axboe