Skip to content

hw/nvme: fix controller hotplugging

Klaus Jensen qemu-devel 2 versions – Applied

Status from this message: Applied patches 1 through 3 to nvme-next.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 9 repliesApplied
  2. v14 patches 11 repliesSuperseded

Changes in v2 from the cover letter

- added R-b's by Hannes for patches 1 through 3
- simplified "hw/nvme: fix controller hot unplugging"

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/4hw/nvme: remove NvmeCtrl parameter from ns setup/check functionshw/nvme/ctrl.c hw/nvme/ns.c hw/nvme/nvme.h+20 -210 replies
2/4hw/nvme: mark nvme-subsys non-hotpluggablehw/nvme/subsys.c+1 -00 replies
3/4hw/nvme: unregister controller with subsystem at exithw/nvme/ctrl.c hw/nvme/nvme.h hw/nvme/subsys.c+10 -00 replies
4/4hw/nvme: fix controller hot unplugginghw/nvme/ctrl.c hw/nvme/ns.c hw/nvme/nvme.h +1 more+35 -153 replies

Reviews trailers per patch

3 of 4 patches have a Reviewed-by or Acked-by.

PatchHannes Reinecke
1/4R-b
2/4R-b
3/4R-b
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/4] hw/nvme: fix controller hotplugging

From: Klaus Jensen <[email protected]>

Back in May, Hannes posted a fix[1] to re-enable NVMe PCI hotplug. We discussed a bit back and fourth and I mentioned that the core issue was an artifact of the parent/child relationship stemming from the qdev setup we have with namespaces attaching to controller through a qdev bus.

The gist of this series is the fourth patch "hw/nvme: fix controller hot unplugging" which basically causes namespaces to be reassigned to a bus owned by the subsystem if the parent controller is linked to one. This fixes device_del/add nvme in such settings.

Note, that in the case that there is no subsystem involved, nvme devices can be removed from the system with device_del, but this *will* cause the namespaces to be removed as well since there is no place (i.e. no subsystem) for them to "linger". And since this series does not add support for hotplugging nvme-ns devices, while an nvme device can be readded, no namespaces can. Support for hotplugging nvme-ns devices is present in [1], but I'd rather not add that since I think '-device nvme-ns' is already a bad design choice.

Now, I do realize that it is not "pretty" to explicitly change the parent bus, so I do have a an RFC patch in queue that replaces the subsystem and namespace devices with objects, but keeps -device shims available for backwards compatibility. This approach will solve the problems properly and should be a better model. However, I don't believe it will make it for 6.1 and I'd really like to at least fix the unplugging for 6.1 and this gets the job done.

[1]: [email protected]

v2:
- added R-b's by Hannes for patches 1 through 3
- simplified "hw/nvme: fix controller hot unplugging"

Klaus Jensen (4):
hw/nvme: remove NvmeCtrl parameter from ns setup/check functions hw/nvme: mark nvme-subsys non-hotpluggable
hw/nvme: unregister controller with subsystem at exit hw/nvme: fix controller hot unplugging

 hw/nvme/nvme.h   | 18 +++++++++-------
 hw/nvme/ctrl.c   | 14 ++++++------
 hw/nvme/ns.c     | 55 +++++++++++++++++++++++++++++++-----------------
 hw/nvme/subsys.c |  9 ++++++++
 4 files changed, 63 insertions(+), 33 deletions(-)
Signature · 1 line
2.32.0