From: Jens Axboe <axboe@kernel.dk>
To: Bart Van Assche <bvanassche@acm.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ming Lei <ming.lei@redhat.com>, Omar Sandoval <osandov@fb.com>,
linux-kernel@vger.kernel.org, linux-block@vger.kernel.org,
Yang Yang <yang.yang@vivo.com>
Subject: Re: [PATCH v8] sbitmap: fix io hung due to race on sbitmap_word::cleared
Date: Fri, 19 Jul 2024 09:39:53 -0600 [thread overview]
Message-ID: <172140359332.12097.1558892281494577679.b4-ty@kernel.dk> (raw)
In-Reply-To: <20240716082644.659566-1-yang.yang@vivo.com>
On Tue, 16 Jul 2024 16:26:27 +0800, Yang Yang wrote:
> Configuration for sbq:
> depth=64, wake_batch=6, shift=6, map_nr=1
>
> 1. There are 64 requests in progress:
> map->word = 0xFFFFFFFFFFFFFFFF
> 2. After all the 64 requests complete, and no more requests come:
> map->word = 0xFFFFFFFFFFFFFFFF, map->cleared = 0xFFFFFFFFFFFFFFFF
> 3. Now two tasks try to allocate requests:
> T1: T2:
> __blk_mq_get_tag .
> __sbitmap_queue_get .
> sbitmap_get .
> sbitmap_find_bit .
> sbitmap_find_bit_in_word .
> __sbitmap_get_word -> nr=-1 __blk_mq_get_tag
> sbitmap_deferred_clear __sbitmap_queue_get
> /* map->cleared=0xFFFFFFFFFFFFFFFF */ sbitmap_find_bit
> if (!READ_ONCE(map->cleared)) sbitmap_find_bit_in_word
> return false; __sbitmap_get_word -> nr=-1
> mask = xchg(&map->cleared, 0) sbitmap_deferred_clear
> atomic_long_andnot() /* map->cleared=0 */
> if (!(map->cleared))
> return false;
> /*
> * map->cleared is cleared by T1
> * T2 fail to acquire the tag
> */
>
> [...]
Applied, thanks!
[1/1] sbitmap: fix io hung due to race on sbitmap_word::cleared
commit: 72d04bdcf3f7d7e07d82f9757946f68802a7270a
Best regards,
--
Jens Axboe
prev parent reply other threads:[~2024-07-19 15:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-16 8:26 [PATCH v8] sbitmap: fix io hung due to race on sbitmap_word::cleared Yang Yang
2024-07-16 21:01 ` Bart Van Assche
2024-07-19 15:39 ` Jens Axboe [this message]
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=172140359332.12097.1558892281494577679.b4-ty@kernel.dk \
--to=axboe@kernel.dk \
--cc=akpm@linux-foundation.org \
--cc=bvanassche@acm.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=osandov@fb.com \
--cc=yang.yang@vivo.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