All of lore.kernel.org
 help / color / mirror / Atom feed
From: weiping zhang <zhangweiping@didichuxing.com>
To: Keith Busch <kbusch@kernel.org>
Cc: hch@infradead.org, axboe@kernel.dk,
	linux-nvme@lists.infradead.org, sagi@grimberg.me,
	Weiping Zhang <zhangweiping@didiglobal.com>
Subject: Re: [PATCH 1/2] nvme: make sure write/poll_queues less or equal then cpu count
Date: Fri, 10 Apr 2020 17:56:31 +0800	[thread overview]
Message-ID: <20200410095619.GA4128@192.168.3.9> (raw)
In-Reply-To: <20200409172250.GA1889561@dhcp-10-100-145-180.wdl.wdc.com>

On Thu, Apr 09, 2020 at 10:22:50AM -0700, Keith Busch wrote:
> On Thu, Apr 09, 2020 at 11:57:35PM +0800, Weiping Zhang wrote:
> > Check module parameter write/poll_queues before use, if user
> > change them to larger than system cpu count, it will trigger a
> > warning.
> > 
> > Reproduce:
> > 
> > echo $((`nproc`+1)) > /sys/module/nvme/parameters/write_queues
> > echo 1 > /sys/block/nvme0n1/device/reset_controller
> 
> I don't think it is safe to allow these parameters to be runtime writeable
> with the current code: the driver allocates space for queues during probe,
> so you may end up with out of bounds access if you increase the number
> of queues the driver creates after that.

Yes, if user change these parameter larger than the number allocated in
nvme_probe, then nvme_create_io_queues->nvme_alloc_queue will touch the
memory out of boundary.

I think we allow user change it dynamically, just make sure the total
io queue count will not larger than allocated.

If user really want to adjust io queue when use multiple tagset map,
they need set enough queue when load nvme moduler. Then they can
tune the queue count for each tag map.

I send a seperate patch to fix this.

Thanks

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2020-04-10  9:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 15:57 [PATCH 0/2] verify module parameter write_queues and poll_queues Weiping Zhang
2020-04-09 15:57 ` [PATCH 1/2] nvme: make sure write/poll_queues less or equal then cpu count Weiping Zhang
2020-04-09 17:22   ` Keith Busch
2020-04-10  9:56     ` weiping zhang [this message]
2020-04-09 15:57 ` [PATCH 2/2] nvme: no need check write/poll_queues in nvme_init 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=20200410095619.GA4128@192.168.3.9 \
    --to=zhangweiping@didichuxing.com \
    --cc=axboe@kernel.dk \
    --cc=hch@infradead.org \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=zhangweiping@didiglobal.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 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.