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]
Message-ID: <1e3643aa-6ce6-ddc0-721d-3c80e228a182@oracle.com>
Date:   Wed, 20 Mar 2019 16:15:30 +0800
From:   "jianchao.wang" <jianchao.w.wang@...cle.com>
To:     zhengbin <zhengbin13@...wei.com>, axboe@...nel.dk,
        ming.lei@...hat.com, hch@....de, linux-block@...r.kernel.org,
        linux-kernel@...r.kernel.org
Cc:     houtao1@...wei.com, yanaijie@...wei.com, yuyufen@...wei.com
Subject: Re: [PATCH] blk-mq: fix a hung issue when set device state to blocked
 and restore running

Hi Bin

On 3/20/19 4:02 PM, zhengbin wrote:
> When I use dd test a SCSI device which use blk-mq in the following steps:
> 1.echo "blocked" >/sys/block/sda/device/state
> 2.dd if=/dev/sda of=/mnt/t.log bs=1M count=10
> 3.echo "running" >/sys/block/sda/device/state
> dd should finish this work after step 3, unfortunately, still hung.

If this test case really matters for you, we should try to run the hw queues after set state
to 'running'.

Thanks
Jianchao
> 
> After step2, the key code process is like this:
> blk_mq_dispatch_rq_list-->scsi_queue_rq-->prep_to_mq
>                        -->if ret is BLK_STS_RESOURCE, delay run hw queue
> 
> prep_to_mq will return BLK_STS_RESOURCE, and scsi_queue_rq will transter
> it to BLK_STS_DEV_RESOURCE. In this situtation, we should delay run hw
> queue. This patch fixes that.
> 
> Fixes: 86ff7c2a80cd ("blk-mq: introduce BLK_STS_DEV_RESOURCE")
> Signed-off-by: zhengbin <zhengbin13@...wei.com>
> ---
>  block/blk-mq.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/block/blk-mq.c b/block/blk-mq.c
> index a9c1816..556d606 100644
> --- a/block/blk-mq.c
> +++ b/block/blk-mq.c
> @@ -1309,15 +1309,17 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, struct list_head *list,
>  		 *   returning BLK_STS_RESOURCE. Two exceptions are scsi-mq
>  		 *   and dm-rq.
>  		 *
> -		 * If driver returns BLK_STS_RESOURCE and SCHED_RESTART
> -		 * bit is set, run queue after a delay to avoid IO stalls
> -		 * that could otherwise occur if the queue is idle.
> +		 * If driver returns BLK_STS_RESOURCE or BLK_STS_DEV_RESOURCE
> +		 * and SCHED_RESTART bit is set, run queue after a delay to
> +		 * avoid IO stalls that could otherwise occur if the queue
> +		 * is idle.
>  		 */
>  		needs_restart = blk_mq_sched_needs_restart(hctx);
>  		if (!needs_restart ||
>  		    (no_tag && list_empty_careful(&hctx->dispatch_wait.entry)))
>  			blk_mq_run_hw_queue(hctx, true);
> -		else if (needs_restart && (ret == BLK_STS_RESOURCE))
> +		else if (needs_restart && ((ret == BLK_STS_RESOURCE) ||
> +					   (ret == BLK_STS_DEV_RESOURCE)))
>  			blk_mq_delay_run_hw_queue(hctx, BLK_MQ_RESOURCE_DELAY);
> 
>  		blk_mq_update_dispatch_busy(hctx, true);
> --
> 2.7.4
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ