]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
nvme-rdma: fix queue mapping when queue count is limited
authorSagi Grimberg <sagi@grimberg.me>
Wed, 29 May 2019 05:49:04 +0000 (22:49 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jun 2019 10:19:18 +0000 (12:19 +0200)
commitd8a303bd8452396a928f5ca2c7957167b2d185f0
tree91737379de60f7c0cd6b439ebce0a15b29dfb27d
parentaffc4c420a2911a1c632df8a0286938b654bade4
nvme-rdma: fix queue mapping when queue count is limited

commit 5651cd3c43368873d0787b52acb2e0e08f3c5da4 upstream.

When the controller supports less queues than requested, we
should make sure that queue mapping does the right thing and
not assume that all queues are available. This fixes a crash
when the controller supports less queues than requested.

The rules are:
1. if no write/poll queues are requested, we assign the available queues
   to the default queue map. The default and read queue maps share the
   existing queues.
2. if write queues are requested:
  - first make sure that read queue map gets the requested
    nr_io_queues count
  - then grant the default queue map the minimum between the requested
    nr_write_queues and the remaining queues. If there are no available
    queues to dedicate to the default queue map, fallback to (1) and
    share all the queues in the existing queue map.
3. if poll queues are requested:
  - map the remaining queues to the poll queue map.

Also, provide a log indication on how we constructed the different
queue maps.

Reported-by: Harris, James R <james.r.harris@intel.com>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Tested-by: Jim Harris <james.r.harris@intel.com>
Cc: <stable@vger.kernel.org> # v5.0+
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/nvme/host/rdma.c