All of lore.kernel.org
 help / color / mirror / Atom feed
From: Weiping Zhang <zwp10758@gmail.com>
To: Jens Axboe <axboe@kernel.dk>,
	Bart Van Assche <bvanassche@acm.org>,
	linux-block@vger.kernel.org
Subject: Re: [PATCH v3 0/7] Fix potential kernel panic when increase hardware queue
Date: Wed, 8 Apr 2020 20:25:31 +0800	[thread overview]
Message-ID: <CAA70yB7mNEt+H5xd+hpeRDLXDi+V+Qmuvuy27wJ63dtmcKDpzQ@mail.gmail.com> (raw)
In-Reply-To: <cover.1586199103.git.zhangweiping@didiglobal.com>

Weiping Zhang <zhangweiping@didiglobal.com> 于2020年4月7日周二 上午3:36写道:
>
> Hi,
>
> This series do some improvement base on V2, and also fix two memleaks.
> And V2 import a regression for blktest/block/test/029, this test case
> will increase and decrease hardware queue count quickly.
>
>
> Memleak 1:
>
> __blk_mq_alloc_rq_maps
>         __blk_mq_alloc_rq_map
>
> if fail
>         blk_mq_free_rq_map
>
> Actually, __blk_mq_alloc_rq_map alloc both map and request, here
> also need free request.
>
> Memleak 2:
> When driver decrease hardware queue, set->nr_hw_queues will be changed
> firstly in blk_mq_realloc_tag_set_tags or __blk_mq_update_nr_hw_queues,
> then blk_mq_realloc_hw_ctxs and blk_mq_map_swqueue, even
> blk_mq_free_tag_set have no chance to free these hardware queue resource,
> because they iterate hardware queue by
> for (i = 0; i < set->nr_hw_queues; i++).
>
> Patch1~3: rename some function name, no function change.
> Patch4: fix first memleak.
> Patch5: fix prev_nr_hw_queues issue, need be saved before change.
> Patch6: alloc map and request to fix potential kernel panic.
>
Update patch description:
Patch1~3: rename some function name, no function change.
Patch4: fix first memleak.
Patch5: fix prev_nr_hw_queues issue, need be saved before change.
Patch6: add nr_allocated_map_rqs to struct blk_mq_tag_set to record how
may rq and maps were allocated for this tag set, and also fix memleak2.

Patch7: fix kernel panic when update hardware queue count > cpu count,
when use multiple maps. Patch7's commit message has more detail information
about this issue.

>
> Changes since V2:
>  * rename some functions name and fix memleak when free map and requests
>  * Not free new allocated map and request, they will be relased when tagset gone
>
> Changes since V1:
>  * Add fix for potential kernel panic when increase hardware queue
>
> Weiping Zhang (7):
>   block: rename __blk_mq_alloc_rq_map
>   block: rename __blk_mq_alloc_rq_maps
>   block: rename blk_mq_alloc_rq_maps
>   block: free both map and request
>   block: save previous hardware queue count before udpate
>   block: refactor __blk_mq_alloc_rq_map_and_requests
>   block: alloc map and request for new hardware queue
>
>  block/blk-mq.c         | 49 ++++++++++++++++++++++++++++++------------
>  include/linux/blk-mq.h |  1 +
>  2 files changed, 36 insertions(+), 14 deletions(-)
>
> --
> 2.18.1
>

  parent reply	other threads:[~2020-04-08 12:25 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-06 19:35 [PATCH v3 0/7] Fix potential kernel panic when increase hardware queue Weiping Zhang
2020-04-06 19:36 ` [PATCH v3 1/7] block: rename __blk_mq_alloc_rq_map Weiping Zhang
2020-04-20 20:41   ` Bart Van Assche
2020-04-21  1:25     ` Ming Lei
2020-04-21 13:17       ` weiping zhang
2020-04-06 19:36 ` [PATCH v3 2/7] block: rename __blk_mq_alloc_rq_maps Weiping Zhang
2020-04-20 20:46   ` Bart Van Assche
2020-04-06 19:36 ` [PATCH v3 3/7] block: rename blk_mq_alloc_rq_maps Weiping Zhang
2020-04-20 20:47   ` Bart Van Assche
2020-04-06 19:36 ` [PATCH v3 4/7] block: free both map and request Weiping Zhang
2020-04-20 20:58   ` Bart Van Assche
2020-04-21 13:15     ` weiping zhang
2020-04-06 19:37 ` [PATCH v3 5/7] block: save previous hardware queue count before udpate Weiping Zhang
2020-04-20 21:00   ` Bart Van Assche
2020-04-06 19:37 ` [PATCH v3 6/7] block: refactor __blk_mq_alloc_rq_map_and_requests Weiping Zhang
2020-04-20 21:07   ` Bart Van Assche
2020-04-21 13:24     ` weiping zhang
2020-04-06 19:37 ` [PATCH v3 7/7] block: alloc map and request for new hardware queue Weiping Zhang
2020-04-08 12:25 ` Weiping Zhang [this message]
2020-04-20 11:15   ` [PATCH v3 0/7] Fix potential kernel panic when increase " Weiping Zhang
2020-04-20 19:30     ` Jens Axboe

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=CAA70yB7mNEt+H5xd+hpeRDLXDi+V+Qmuvuy27wJ63dtmcKDpzQ@mail.gmail.com \
    --to=zwp10758@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=bvanassche@acm.org \
    --cc=linux-block@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.