lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 27 Apr 2020 08:46:45 -0700
From:   Christoph Hellwig <hch@...radead.org>
To:     Baolin Wang <baolin.wang7@...il.com>
Cc:     axboe@...nel.dk, ulf.hansson@...aro.org, adrian.hunter@...el.com,
        arnd@...db.de, linus.walleij@...aro.org, paolo.valente@...aro.org,
        ming.lei@...hat.com, orsonzhai@...il.com, zhang.lyra@...il.com,
        linux-mmc@...r.kernel.org, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v2 1/7] block: Extand commit_rqs() to do batch
 processing

extand in the subject really shpuld be 'extend'

On Sun, Apr 26, 2020 at 05:38:54PM +0800, Baolin Wang wrote:
> From: Ming Lei <ming.lei@...hat.com>
> 
> Now some SD/MMC host controllers can support packed command or packed request,
> that means we can package several requests to host controller at one time
> to improve performence.
> 
> But the blk-mq always takes one request from the scheduler and dispatch it to
> the device, regardless of the driver or the scheduler, so there should only
> ever be one request in the local list in blk_mq_dispatch_rq_list(), that means
> the bd.last is always true and the driver can not use bd.last to decide if
> there are requests are pending now in hardware queue to help to package
> requests.
> 
> Thus this patch introduces a new 'BLK_MQ_F_FORCE_COMMIT_RQS' flag to call
> .commit_rqs() to do batch processing if necessary.
> 
> Signed-off-by: Ming Lei <ming.lei@...hat.com>
> Tested-by: Baolin Wang <baolin.wang7@...il.com>
> Signed-off-by: Baolin Wang <baolin.wang7@...il.com>
> ---
>  block/blk-mq-sched.c   | 29 ++++++++++++++++++++---------
>  block/blk-mq.c         | 15 ++++++++++-----
>  include/linux/blk-mq.h |  1 +
>  3 files changed, 31 insertions(+), 14 deletions(-)
> 
> diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c
> index 74cedea56034..3429a71a7364 100644
> --- a/block/blk-mq-sched.c
> +++ b/block/blk-mq-sched.c
> @@ -85,11 +85,12 @@ void blk_mq_sched_restart(struct blk_mq_hw_ctx *hctx)
>   * its queue by itself in its completion handler, so we don't need to
>   * restart queue if .get_budget() returns BLK_STS_NO_RESOURCE.
>   */
> -static void blk_mq_do_dispatch_sched(struct blk_mq_hw_ctx *hctx)
> +static bool blk_mq_do_dispatch_sched(struct blk_mq_hw_ctx *hctx)

This function already returns an int in the current for-5.8/block tree.

> +		if (!(hctx->flags & BLK_MQ_F_FORCE_COMMIT_RQS)) {
> +			if (list_empty(list)) {
> +				bd.last = true;
> +			} else {
> +				nxt = list_first_entry(list, struct request,
> +						       queuelist);
> +				bd.last = !blk_mq_get_driver_tag(nxt);
> +			}
> +		} else {
> +			bd.last = false;
>  		}

This seems a little odd in terms of code flow.  Why not:

		if (hctx->flags & BLK_MQ_F_FORCE_COMMIT_RQS) {
			bd.last = false;
		} else if (list_empty(list)) {
			bd.last = true;
		} else {
			nxt = list_first_entry(list, struct request, queuelist);
			bd.last = !blk_mq_get_driver_tag(nxt);
		}

> diff --git a/include/linux/blk-mq.h b/include/linux/blk-mq.h
> index f389d7c724bd..6a20f8e8eb85 100644
> --- a/include/linux/blk-mq.h
> +++ b/include/linux/blk-mq.h
> @@ -391,6 +391,7 @@ struct blk_mq_ops {
>  enum {
>  	BLK_MQ_F_SHOULD_MERGE	= 1 << 0,
>  	BLK_MQ_F_TAG_SHARED	= 1 << 1,
> +	BLK_MQ_F_FORCE_COMMIT_RQS = 1 << 3,

Maybe BLK_MQ_F_ALWAYS_COMMIT might be a better name?  Also this
flag (just like the existing ones..) could really use a comment
explaining it.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ