[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 07/18] nvme: add max_ioqpairs device parameter
From: |
Klaus Jensen |
Subject: |
Re: [PATCH v5 07/18] nvme: add max_ioqpairs device parameter |
Date: |
Tue, 5 May 2020 22:52:50 +0200 |
On May 5 07:48, Klaus Jensen wrote:
> From: Klaus Jensen <address@hidden>
>
> The num_queues device paramater has a slightly confusing meaning because
> it accounts for the admin queue pair which is not really optional.
> Secondly, it is really a maximum value of queues allowed.
>
> Add a new max_ioqpairs parameter that only accounts for I/O queue pairs,
> but keep num_queues for compatibility.
>
> Signed-off-by: Klaus Jensen <address@hidden>
> Reviewed-by: Maxim Levitsky <address@hidden>
> Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
> Reviewed-by: Keith Busch <address@hidden>
> ---
> hw/block/nvme.c | 51 ++++++++++++++++++++++++++++++-------------------
> hw/block/nvme.h | 3 ++-
> 2 files changed, 33 insertions(+), 21 deletions(-)
>
> diff --git a/hw/block/nvme.c b/hw/block/nvme.c
> index 623a88be93dc..3875a5f3dcbf 100644
> --- a/hw/block/nvme.c
> +++ b/hw/block/nvme.c
> @@ -1571,7 +1581,8 @@ static Property nvme_props[] = {
> HostMemoryBackend *),
> DEFINE_PROP_STRING("serial", NvmeCtrl, params.serial),
> DEFINE_PROP_UINT32("cmb_size_mb", NvmeCtrl, params.cmb_size_mb, 0),
> - DEFINE_PROP_UINT32("num_queues", NvmeCtrl, params.num_queues, 64),
> + DEFINE_PROP_UINT32("num_queues", NvmeCtrl, params.num_queues, 0),
> + DEFINE_PROP_UINT32("max_ioqpairs", NvmeCtrl, params.max_ioqpairs, 64),
> DEFINE_PROP_END_OF_LIST(),
> };
>
I noticed that this default of 64 makes the default configuration
unsafe by allowing the cq->cqid < 64 assert in nvme_irq_{,de}assert() to
trigger if the pin-based interrupt logic is used (under SPDK for
instance). The assert protects against undefined behavior caused by
shifting by more than 63 into the 64 bit irq_status variable.
As far as I can tell, the assert, the shift and the size of the
irq_status variable is bogus, so I posted a patch for this in
"hw/block/nvme: fixes for interrupt behavior". Preferably that should go
in before this series.
- [PATCH v5 03/18] nvme: remove superfluous breaks, (continued)
- [PATCH v5 03/18] nvme: remove superfluous breaks, Klaus Jensen, 2020/05/05
- [PATCH v5 06/18] nvme: refactor nvme_addr_read, Klaus Jensen, 2020/05/05
- [PATCH v5 04/18] nvme: move device parameters to separate struct, Klaus Jensen, 2020/05/05
- [PATCH v5 05/18] nvme: use constants in identify, Klaus Jensen, 2020/05/05
- [PATCH v5 08/18] nvme: remove redundant cmbloc/cmbsz members, Klaus Jensen, 2020/05/05
- [PATCH v5 02/18] nvme: rename trace events to pci_nvme, Klaus Jensen, 2020/05/05
- [PATCH v5 10/18] nvme: factor out device state setup, Klaus Jensen, 2020/05/05
- [PATCH v5 07/18] nvme: add max_ioqpairs device parameter, Klaus Jensen, 2020/05/05
- Re: [PATCH v5 07/18] nvme: add max_ioqpairs device parameter,
Klaus Jensen <=
- [PATCH v5 15/18] nvme: factor out cmb setup, Klaus Jensen, 2020/05/05
- [PATCH v5 14/18] nvme: factor out pci setup, Klaus Jensen, 2020/05/05
- [PATCH v5 09/18] nvme: factor out property/constraint checks, Klaus Jensen, 2020/05/05
- [PATCH v5 11/18] nvme: factor out block backend setup, Klaus Jensen, 2020/05/05
- [PATCH v5 12/18] nvme: add namespace helpers, Klaus Jensen, 2020/05/05
- [PATCH v5 17/18] nvme: do cmb/pmr init as part of pci init, Klaus Jensen, 2020/05/05
- [PATCH v5 13/18] nvme: factor out namespace setup, Klaus Jensen, 2020/05/05
- [PATCH v5 16/18] nvme: factor out pmr setup, Klaus Jensen, 2020/05/05
- [PATCH v5 18/18] nvme: factor out controller identify setup, Klaus Jensen, 2020/05/05
- Re: [PATCH v5 00/18] nvme: refactoring and cleanups, Philippe Mathieu-Daudé, 2020/05/05