linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: QiuLaibin <qiulaibin@huawei.com>
To: "Alex Xu (Hello71)" <alex_y_xu@yahoo.ca>, <axboe@kernel.dk>,
	"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	<linux-block@vger.kernel.org>
Cc: <john.garry@huawei.com>, <ming.lei@redhat.com>,
	<martin.petersen@oracle.com>, <hare@suse.de>,
	<akpm@linux-foundation.org>, <bvanassche@acm.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: "blk-mq: fix tag_get wait task can't be awakened" causes hangs
Date: Tue, 25 Jan 2022 12:08:51 +0800	[thread overview]
Message-ID: <78cafe94-a787-e006-8851-69906f0c2128@huawei.com> (raw)
In-Reply-To: <1643040870.3bwvk3sis4.none@localhost>

[-- Attachment #1: Type: text/plain, Size: 2010 bytes --]

Hi Alex

1、Please help to import this structure:

blk_mq_tags <= request_queue->blk_mq_hw_ctx->blk_mq_tags

If there is no kernel dump, help to see the value of

cat /sys/block/sda/mq/0/nr_tags
                __ <= Change it to the problem device

And how many block devices in total by lsblk.

2、Please describe in detail how to reproduce the issue,

And what type of USB device?

3、Please help to try the attachment patch and see if it can be reproduced.

Thanks.

On 2022/1/25 0:24, Alex Xu (Hello71) wrote:
> Hi,
> 
> Recently on torvalds master, I/O on USB flash drives started hanging
> here:
> 
> task:systemd-udevd   state:D stack:    0 pid:  374 ppid:   347 flags:0x00004000
> Call Trace:
>   <TASK>
>   ? __schedule+0x319/0x4a0
>   ? schedule+0x77/0xa0
>   ? io_schedule+0x43/0x60
>   ? blk_mq_get_tag+0x175/0x2b0
>   ? mempool_alloc+0x33/0x170
>   ? init_wait_entry+0x30/0x30
>   ? __blk_mq_alloc_requests+0x1b4/0x220
>   ? blk_mq_submit_bio+0x213/0x490
>   ? submit_bio_noacct+0x22c/0x270
>   ? xa_load+0x48/0x80
>   ? mpage_readahead+0x114/0x130
>   ? blkdev_fallocate+0x170/0x170
>   ? read_pages+0x48/0x1d0
>   ? page_cache_ra_unbounded+0xee/0x1f0
>   ? force_page_cache_ra+0x68/0xc0
>   ? filemap_read+0x18c/0x9a0
>   ? blkdev_read_iter+0x4e/0x120
>   ? vfs_read+0x265/0x2d0
>   ? ksys_read+0x50/0xa0
>   ? do_syscall_64+0x62/0x90
>   ? do_user_addr_fault+0x271/0x3c0
>   ? asm_exc_page_fault+0x8/0x30
>   ? exc_page_fault+0x58/0x80
>   ? entry_SYSCALL_64_after_hwframe+0x44/0xae
>   </TASK>
> 
> mount(8) hangs with a similar backtrace, making the device effectively
> unusable. It does not seem to affect NVMe or SATA attached drives. The
> affected drive does not support UAS. I don't currently have UAS drives
> to test with. The default I/O scheduler is set to noop.
> 
> I found that reverting 180dccb0dba4 ("blk-mq: fix tag_get wait
> task can't be awakened") appears to resolve the issue.
> 
> Let me know what other information is needed.
> 
> Cheers,
> Alex.
> .
> 

BR
Laibin

[-- Attachment #2: fix_hang.patch --]
[-- Type: text/plain, Size: 708 bytes --]

diff --git a/lib/sbitmap.c b/lib/sbitmap.c
index 6220fa67fb7e..09d293c30fd2 100644
--- a/lib/sbitmap.c
+++ b/lib/sbitmap.c
@@ -488,9 +488,13 @@ void sbitmap_queue_recalculate_wake_batch(struct sbitmap_queue *sbq,
 					    unsigned int users)
 {
 	unsigned int wake_batch;
+	unsigned int min_batch;
+	unsigned int depth = (sbq->sb.depth + users - 1) / users;
 
-	wake_batch = clamp_val((sbq->sb.depth + users - 1) /
-			users, 4, SBQ_WAKE_BATCH);
+	min_batch = sbq->sb.depth >= (4 * SBQ_WAIT_QUEUES) ? 4 : 1;
+
+	wake_batch = clamp_val(depth / SBQ_WAIT_QUEUES,
+			min_batch, SBQ_WAKE_BATCH);
 	__sbitmap_queue_update_wake_batch(sbq, wake_batch);
 }
 EXPORT_SYMBOL_GPL(sbitmap_queue_recalculate_wake_batch);

  reply	other threads:[~2022-01-25  4:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1643040870.3bwvk3sis4.none.ref@localhost>
2022-01-24 16:24 ` "blk-mq: fix tag_get wait task can't be awakened" causes hangs Alex Xu (Hello71)
2022-01-25  4:08   ` QiuLaibin [this message]
2022-01-25 15:15     ` Alex Xu (Hello71)
2022-01-26 13:38     ` Jens Axboe
2022-01-27  1:24       ` QiuLaibin
2022-01-25 11:38   ` Daniel Palmer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=78cafe94-a787-e006-8851-69906f0c2128@huawei.com \
    --to=qiulaibin@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex_y_xu@yahoo.ca \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=hare@suse.de \
    --cc=john.garry@huawei.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=ming.lei@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).