linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bvanassche@acm.org>
To: Weiping Zhang <zwp10758@gmail.com>
Cc: Jens Axboe <axboe@kernel.dk>,
	tom.leiming@gmail.com, Christoph Hellwig <hch@infradead.org>,
	linux-block@vger.kernel.org,
	Weiping Zhang <zhangweiping@didiglobal.com>
Subject: Re: [PATCH v6 0/5] Fix potential kernel panic when increase hardware queue
Date: Tue, 12 May 2020 16:08:57 -0700	[thread overview]
Message-ID: <beb354c0-d2db-ccfb-476c-03f03594c78e@acm.org> (raw)
In-Reply-To: <CAA70yB42BDtpgkpM1UL_CkBjNAFAWOaWuoga+1eDPd=LoHWnbg@mail.gmail.com>

On 2020-05-12 05:20, Weiping Zhang wrote:
> On Tue, May 12, 2020 at 8:09 PM Weiping Zhang <zwp10758@gmail.com> wrote:
>> I don't test block/030, since I don't pull blktest very often.

That's unfortunate ...

>> It's a different problem,
>> because the mapping cann't be reset when do fallback, so the
>> cpu[>=1] will point to a hctx(!=0).
>>
>>  it should be fixed by:
>>
>> diff --git a/block/blk-mq.c b/block/blk-mq.c
>> index bc34d6b572b6..d82cefb0474f 100644
>> --- a/block/blk-mq.c
>> +++ b/block/blk-mq.c
>> @@ -3365,8 +3365,8 @@ static void __blk_mq_update_nr_hw_queues(struct
>> blk_mq_tag_set *set,
>>                 goto reregister;
>>
>>         set->nr_hw_queues = nr_hw_queues;
>> -       blk_mq_update_queue_map(set);
>>  fallback:
>> +       blk_mq_update_queue_map(set);
>>         list_for_each_entry(q, &set->tag_list, tag_set_list) {
>>                 blk_mq_realloc_hw_ctxs(set, q);
>>                 if (q->nr_hw_queues != set->nr_hw_queues) {

If this is posted as a patch, feel free to add:

Tested-by: Bart van Assche <bvanassche@acm.org>

> And block/030 should also be improved ?
> 
>  35         # Since older null_blk versions do not allow "submit_queues" to be
>  36         # modified, check first whether that configs attribute is writeable.
>  37         # Each iteration of the loop below triggers $(nproc) + 1
>  38         # null_init_hctx() calls. Since <interval>=$(nproc), all possible
>  39         # blk_mq_realloc_hw_ctxs() error paths will be triggered. Whether or
>  40         # not this test succeeds depends on whether or not _check_dmesg()
>  41         # detects a kernel warning.
>  42         if { echo "$(<"$sq")" >$sq; } 2>/dev/null; then
>  43                 for ((i = 0; i < 100; i++)); do
>  44                         echo 1 > $sq
>  45                         nproc > $sq  # this line output lots
> "nproc: write error: Cannot allocate memory"
>  46                 done
>  47         else
>  48                 SKIP_REASON="Skipping test because $sq cannot be modified"
>  49         fi
> 
> 
> The test result show this test case [failed], actually it [pass],
> there is no warning detect
> in kernel log, if apply above patch.
> 
> block/030 (trigger the blk_mq_realloc_hw_ctxs() error path)  [failed]
>     runtime  1.999s  ...  2.115s
>     --- tests/block/030.out 2020-05-12 10:42:26.345782849 +0800
>     +++ /data1/zwp/src/blktests/results/nodev/block/030.out.bad
> 2020-05-12 20:14:59.878915218 +0800
>     @@ -1 +1,51 @@
>     +nproc: write error: Cannot allocate memory
>     +nproc: write error: Cannot allocate memory
>     +nproc: write error: Cannot allocate memory
>     +nproc: write error: Cannot allocate memory
>     +nproc: write error: Cannot allocate memory
>     +nproc: write error: Cannot allocate memory
>     +nproc: write error: Cannot allocate memory
>     ...
>     (Run 'diff -u tests/block/030.out
> /data1/zwp/src/blktests/results/nodev/block/030.out.bad' to see the
> entire diff)

That's weird. I have not yet encountered this. Test block/030 passes on
my setup.

Thanks,

Bart.

  reply	other threads:[~2020-05-12 23:09 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07 13:03 [PATCH v6 0/5] Fix potential kernel panic when increase hardware queue Weiping Zhang
2020-05-07 13:03 ` [PATCH v6 1/5] block: free both rq_map and request Weiping Zhang
2020-05-07 15:09   ` Hannes Reinecke
2020-05-07 13:03 ` [PATCH v6 2/5] block: save previous hardware queue count before udpate Weiping Zhang
2020-05-07 15:09   ` Hannes Reinecke
2020-05-07 13:04 ` [PATCH v6 3/5] block: alloc map and request for new hardware queue Weiping Zhang
2020-05-07 15:11   ` Hannes Reinecke
2020-05-07 13:04 ` [PATCH v6 4/5] block: rename __blk_mq_alloc_rq_map Weiping Zhang
2020-05-07 15:12   ` Hannes Reinecke
2020-05-07 13:04 ` [PATCH v6 5/5] block: rename blk_mq_alloc_rq_maps Weiping Zhang
2020-05-07 15:12   ` Hannes Reinecke
2020-05-07 13:43 ` [PATCH v6 0/5] Fix potential kernel panic when increase hardware queue Christoph Hellwig
2020-05-07 18:31 ` Jens Axboe
2020-05-12  1:30 ` Bart Van Assche
2020-05-12 12:09   ` Weiping Zhang
2020-05-12 12:20     ` Weiping Zhang
2020-05-12 23:08       ` Bart Van Assche [this message]
2020-05-13  0:43         ` Weiping Zhang

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=beb354c0-d2db-ccfb-476c-03f03594c78e@acm.org \
    --to=bvanassche@acm.org \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=linux-block@vger.kernel.org \
    --cc=tom.leiming@gmail.com \
    --cc=zhangweiping@didiglobal.com \
    --cc=zwp10758@gmail.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).