[{"id":3675915,"web_url":"http://patchwork.ozlabs.org/comment/3675915/","msgid":"<CAPSO8Mx2pXp1UGvrsqTL86b=920os62MYSGn-ryv-YV4kRN4NA@mail.gmail.com>","list_archive_url":null,"date":"2026-04-10T14:33:47","subject":"Re: [PATCH v3] hw/nvme: add namespace hotplug support","submitter":{"id":93098,"url":"http://patchwork.ozlabs.org/api/people/93098/","name":"Matthieu Rolla","email":"matthieu@minio.io"},"content":"Hello @Stefan Hajnoczi <stefanha@redhat.com> ,\n\n\nThanks for the review! v3 sent.\n\n\nWording: Fixed in v3, no more \"physical PCIe slot\" claim. Now describes it\nas NVMe namespace-level hotplug.\n\n\nI/O drain: Moved nvme_ns_drain() to the start of the unplug handler so\nin-flight I/O completes before detach. Tested under warp load (16\nconcurrent 1MiB uploads via MinIO/DirectPV)  device_del returns in ~400ms\nwith clean removal, no use-after-free.\n\n\nSymmetry:  moved subsys->namespaces[nsid] = NULL into nvme_ns_unrealize()\nso the namespace lifecycle is complete (mirrors what nvme_ns_realize() sets\nup).\n\n\nI don't have a working Windows test setup, I'd really appreciate if you\ncould test it next week as you offered.\n\nThanks again for your time\n\nOn Fri, Apr 10, 2026 at 4:29 PM mr-083 <matthieu@minio.io> wrote:\n\n> Add hotplug support for nvme-ns devices on the NvmeBus. This enables\n> NVMe namespace-level hot-add and hot-remove via device_add and\n> device_del with proper Asynchronous Event Notification (AEN), so the\n> guest kernel can react to namespace topology changes.\n>\n> Mark nvme-ns devices as hotpluggable and register the NvmeBus as a\n> hotplug handler with proper plug and unplug callbacks:\n>\n> - plug: attach namespace to all started controllers and send an\n>   Asynchronous Event Notification (AEN) with NS_ATTR_CHANGED so\n>   the guest kernel rescans namespaces and adds the block device\n> - unplug: drain in-flight I/O, detach from all controllers, send\n>   AEN, then unrealize the device. The guest kernel rescans and\n>   removes the block device.\n>\n> The plug handler skips controllers that haven't started yet\n> (qs_created == false) to avoid interfering with boot-time namespace\n> attachment in nvme_start_ctrl().\n>\n> The unplug handler drains in-flight I/O via nvme_ns_drain() before\n> detaching the namespace from controllers, so pending requests can\n> complete normally without touching freed state.\n>\n> For symmetry with nvme_ns_realize() which sets subsys->namespaces[nsid],\n> nvme_ns_unrealize() now clears that slot too — making the namespace\n> lifecycle complete.\n>\n> Both the controller bus and subsystem bus are configured as hotplug\n> handlers via qbus_set_bus_hotplug_handler() since nvme-ns devices\n> may reparent to the subsystem bus during realize.\n>\n> Example hot-swap sequence using the NVMe subsystem model:\n>\n>   # Boot with: -device nvme-subsys,id=subsys0\n>   #            -device nvme,id=ctrl0,subsys=subsys0\n>   #            -device nvme-ns,id=ns0,drive=drv0,bus=ctrl0,nsid=1\n>\n>   device_del ns0             # guest receives AEN, removes /dev/nvme0n1\n>   drive_del drv0\n>   drive_add 0 file=disk.qcow2,format=qcow2,id=drv0,if=none\n>   device_add nvme-ns,id=ns0,drive=drv0,bus=ctrl0,nsid=1\n>                               # guest receives AEN, adds /dev/nvme0n1\n>\n> Tested with Linux 6.1 guest (NVMe driver processes AEN and rescans\n> namespace list automatically).\n>\n> Signed-off-by: Matthieu <matthieu@min.io>\n> ---\n>  hw/nvme/ctrl.c   | 88 ++++++++++++++++++++++++++++++++++++++++++++++++\n>  hw/nvme/ns.c     |  8 +++++\n>  hw/nvme/subsys.c |  2 ++\n>  3 files changed, 98 insertions(+)\n>\n> diff --git a/hw/nvme/ctrl.c b/hw/nvme/ctrl.c\n> index be6c7028cb..2024b0ff75 100644\n> --- a/hw/nvme/ctrl.c\n> +++ b/hw/nvme/ctrl.c\n> @@ -206,6 +206,7 @@\n>  #include \"system/hostmem.h\"\n>  #include \"hw/pci/msix.h\"\n>  #include \"hw/pci/pcie_sriov.h\"\n> +#include \"hw/core/qdev.h\"\n>  #include \"system/spdm-socket.h\"\n>  #include \"migration/vmstate.h\"\n>\n> @@ -9293,6 +9294,7 @@ static void nvme_realize(PCIDevice *pci_dev, Error\n> **errp)\n>      }\n>\n>      qbus_init(&n->bus, sizeof(NvmeBus), TYPE_NVME_BUS, dev, dev->id);\n> +    qbus_set_bus_hotplug_handler(BUS(&n->bus));\n>\n>      if (nvme_init_subsys(n, errp)) {\n>          return;\n> @@ -9553,10 +9555,96 @@ static const TypeInfo nvme_info = {\n>      },\n>  };\n>\n> +static void nvme_ns_hot_plug(HotplugHandler *hotplug_dev, DeviceState\n> *dev,\n> +                              Error **errp)\n> +{\n> +    NvmeNamespace *ns = NVME_NS(dev);\n> +    NvmeSubsystem *subsys = ns->subsys;\n> +    uint32_t nsid = ns->params.nsid;\n> +    int i;\n> +\n> +    /*\n> +     * Attach to all started controllers and notify via AEN.\n> +     * Skip controllers that haven't started yet (boot-time realize) —\n> +     * nvme_start_ctrl() will attach namespaces during controller init.\n> +     */\n> +    for (i = 0; i < NVME_MAX_CONTROLLERS; i++) {\n> +        NvmeCtrl *ctrl = nvme_subsys_ctrl(subsys, i);\n> +        if (!ctrl || !ctrl->qs_created) {\n> +            continue;\n> +        }\n> +\n> +        if (nvme_csi_supported(ctrl, ns->csi) && !ns->params.detached) {\n> +            nvme_attach_ns(ctrl, ns);\n> +            nvme_update_dsm_limits(ctrl, ns);\n> +\n> +            if (!test_and_set_bit(nsid, ctrl->changed_nsids)) {\n> +                nvme_enqueue_event(ctrl, NVME_AER_TYPE_NOTICE,\n> +                                   NVME_AER_INFO_NOTICE_NS_ATTR_CHANGED,\n> +                                   NVME_LOG_CHANGED_NSLIST);\n> +            }\n> +        }\n> +    }\n> +}\n> +\n> +static void nvme_ns_hot_unplug(HotplugHandler *hotplug_dev, DeviceState\n> *dev,\n> +                               Error **errp)\n> +{\n> +    NvmeNamespace *ns = NVME_NS(dev);\n> +    NvmeSubsystem *subsys = ns->subsys;\n> +    uint32_t nsid = ns->params.nsid;\n> +    int i;\n> +\n> +    /*\n> +     * Drain in-flight I/O before tearing down the namespace.\n> +     * This must happen while the namespace is still attached to the\n> +     * controllers so any pending requests can complete normally.\n> +     */\n> +    nvme_ns_drain(ns);\n> +\n> +    /*\n> +     * Detach from all controllers and notify the guest via AEN.\n> +     * The guest kernel will rescan namespaces and remove the block\n> device.\n> +     */\n> +    for (i = 0; i < NVME_MAX_CONTROLLERS; i++) {\n> +        NvmeCtrl *ctrl = nvme_subsys_ctrl(subsys, i);\n> +        if (!ctrl || !nvme_ns(ctrl, nsid)) {\n> +            continue;\n> +        }\n> +\n> +        nvme_detach_ns(ctrl, ns);\n> +        nvme_update_dsm_limits(ctrl, NULL);\n> +\n> +        if (!test_and_set_bit(nsid, ctrl->changed_nsids)) {\n> +            nvme_enqueue_event(ctrl, NVME_AER_TYPE_NOTICE,\n> +                               NVME_AER_INFO_NOTICE_NS_ATTR_CHANGED,\n> +                               NVME_LOG_CHANGED_NSLIST);\n> +        }\n> +    }\n> +\n> +    /*\n> +     * Unrealize: removes from subsystem (in nvme_ns_unrealize), flushes,\n> +     * cleans up structures, and removes from QOM.\n> +     */\n> +    qdev_unrealize(dev);\n> +}\n> +\n> +static void nvme_bus_class_init(ObjectClass *klass, const void *data)\n> +{\n> +    HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(klass);\n> +    hc->plug = nvme_ns_hot_plug;\n> +    hc->unplug = nvme_ns_hot_unplug;\n> +}\n> +\n>  static const TypeInfo nvme_bus_info = {\n>      .name = TYPE_NVME_BUS,\n>      .parent = TYPE_BUS,\n>      .instance_size = sizeof(NvmeBus),\n> +    .class_init = nvme_bus_class_init,\n> +    .interfaces = (const InterfaceInfo[]) {\n> +        { TYPE_HOTPLUG_HANDLER },\n> +        { }\n> +    },\n>  };\n>\n>  static void nvme_register_types(void)\n> diff --git a/hw/nvme/ns.c b/hw/nvme/ns.c\n> index b0106eaa5c..f4f755c6fc 100644\n> --- a/hw/nvme/ns.c\n> +++ b/hw/nvme/ns.c\n> @@ -719,10 +719,17 @@ void nvme_ns_cleanup(NvmeNamespace *ns)\n>  static void nvme_ns_unrealize(DeviceState *dev)\n>  {\n>      NvmeNamespace *ns = NVME_NS(dev);\n> +    NvmeSubsystem *subsys = ns->subsys;\n> +    uint32_t nsid = ns->params.nsid;\n>\n>      nvme_ns_drain(ns);\n>      nvme_ns_shutdown(ns);\n>      nvme_ns_cleanup(ns);\n> +\n> +    /* Symmetric with nvme_ns_realize() which sets\n> subsys->namespaces[nsid]. */\n> +    if (subsys && nsid && subsys->namespaces[nsid] == ns) {\n> +        subsys->namespaces[nsid] = NULL;\n> +    }\n>  }\n>\n>  void nvme_ns_atomic_configure_boundary(bool dn, uint16_t nabsn,\n> @@ -937,6 +944,7 @@ static void nvme_ns_class_init(ObjectClass *oc, const\n> void *data)\n>      dc->bus_type = TYPE_NVME_BUS;\n>      dc->realize = nvme_ns_realize;\n>      dc->unrealize = nvme_ns_unrealize;\n> +    dc->hotpluggable = true;\n>      device_class_set_props(dc, nvme_ns_props);\n>      dc->desc = \"Virtual NVMe namespace\";\n>  }\n> diff --git a/hw/nvme/subsys.c b/hw/nvme/subsys.c\n> index 777e1c620f..fa35055d3c 100644\n> --- a/hw/nvme/subsys.c\n> +++ b/hw/nvme/subsys.c\n> @@ -9,6 +9,7 @@\n>  #include \"qemu/osdep.h\"\n>  #include \"qemu/units.h\"\n>  #include \"qapi/error.h\"\n> +#include \"hw/core/qdev.h\"\n>\n>  #include \"nvme.h\"\n>\n> @@ -205,6 +206,7 @@ static void nvme_subsys_realize(DeviceState *dev,\n> Error **errp)\n>      NvmeSubsystem *subsys = NVME_SUBSYS(dev);\n>\n>      qbus_init(&subsys->bus, sizeof(NvmeBus), TYPE_NVME_BUS, dev, dev->id);\n> +    qbus_set_bus_hotplug_handler(BUS(&subsys->bus));\n>\n>      nvme_subsys_setup(subsys, errp);\n>  }\n> --\n> 2.53.0\n>\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=minio.io header.i=@minio.io header.a=rsa-sha256\n header.s=minio header.b=nZy/s4OV;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fsg5M14Vpz1yGb\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 11 Apr 2026 01:02:29 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wBDMs-00041I-0E; Fri, 10 Apr 2026 11:01:58 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <matthieu@minio.io>) id 1wBCvi-00046m-Cy\n for qemu-devel@nongnu.org; Fri, 10 Apr 2026 10:33:54 -0400","from mail-yw1-x112b.google.com ([2607:f8b0:4864:20::112b])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <matthieu@minio.io>) id 1wBCve-0000pS-59\n for qemu-devel@nongnu.org; Fri, 10 Apr 2026 10:33:54 -0400","by mail-yw1-x112b.google.com with SMTP id\n 00721157ae682-7a2b6adbfa6so22178417b3.0\n for <qemu-devel@nongnu.org>; Fri, 10 Apr 2026 07:33:49 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; t=1775831628; cv=none;\n d=google.com; s=arc-20240605;\n b=avSEpH3+zFldZyMSsK//pR6cwUiD1YcgvhmV71wgkJB5EsUaS9ZLmVc3Cx1rS7yZgS\n tDKwl+qUf0EuRo/gPPX7EqF9EfKDQir+JImmUYzMI70KqoTuxaFqqG7lGL+3IuOzxf66\n r0nQF5iPhxKmdV+EUAMICzUzCGORYdXQURuTbDGOSxzFhDawObwGgnx5imyK62odU/K9\n CyKuc1WsWugKCfx7vpUvtZIaeNte/k59geNg3XWetzRkO0XIgozlaAEuJ5wunrca4178\n g0rik7AoqflVh/k5tvTLfEMwrsQ47lYogRjZ1XGWyqLu9qFMI3ytdVrQg17f3gdSvF/p\n HZ6A==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:dkim-signature;\n bh=GZwI283SZQaa0dyiXo9BsmOvi6JFFeCreV3KCgBwUiI=;\n fh=9C8b47AA3jRU8pFAOLE7idlWOvz7eHtUQmw1RT/4b0k=;\n b=T+Td0VmTvSRgKsrtFtXq0d4xCvql206i7Uk2xiDW7PqZ43Tu9j0W3v+G2poQKOdOPV\n qf5ENVQFgO4ZGTeopc10rCvkutLhYLngnM5KVlUiSfnCSlEkeaNZBgjckfD4FxkdSWbK\n YfXLsm/eiaHkLn7j6MpT4MoLNjtc0IIg6DGhyCyfDUH58EDUNCY3ZfXyYakAveoQ67Gq\n HpnRTAAxC4KkrVdp9/gtRe3vHJBWp9NWQ4zRjFSyFENh/k9g2Fhxuld5G3ozNUwMTKgJ\n 5LDLrMtdq2j2KtwZCW0xKqi3n52fnMA0YeCvsdkcYvwc6FaD+7TSibnOg2Tgssl2m9mU\n fjlg==; darn=nongnu.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=minio.io; s=minio; t=1775831628; x=1776436428; darn=nongnu.org;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:from:to:cc:subject:date:message-id:reply-to;\n bh=GZwI283SZQaa0dyiXo9BsmOvi6JFFeCreV3KCgBwUiI=;\n b=nZy/s4OVu9wuixVyf7TpQa6XdcViV2kEstRisc3zsqo9Cn3i+hcTHFMrZ1L2bAWvHL\n BWn3NgSUFXIDRDNZ6ueGoHGZDZAptBNsO3vyw2xyomfzCzSYzK7J2SaUaZ6Ew0YXxtLR\n /NhOGqCq0idaNvYs8w2CmDq3GQ5cOsUYTO9wm9AwiGaf+1QIe4B+DpABrIaYF0GvAe5I\n GS/4VaN9px7+KJr0AXPn0LiuafJX/Adx5glvduTpF46s2gWHBDxoxD+qByWjnPDGAs0i\n vLyMdcGhgoK0kb/dnNSkA+obCDHQC2sUfsYj5xMZM82AaAQBHIcl4yn3aCtQ9QZ2Rk9/\n WojA==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775831628; x=1776436428;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=GZwI283SZQaa0dyiXo9BsmOvi6JFFeCreV3KCgBwUiI=;\n b=iR7Ei99/B3gZBvLW9hUnMnbULHp+XhnOjZaKXJBp9GfYFtH9ZbakHWlWqSd1EwJNr/\n c5KxgFYM8XzDk0usfUEuzAB/D6lcUvCC+fb739cJisou7O2xm8hejJ8UkMi4za1bj4OO\n Wz6rUiuuCj+w6fAD+BoULeJ1SEoiPOeF3FnRGhDkL0Scn4Qe9ieTJm9EYs0Y5UEyLG9t\n V36vMVR1gNa0nnSOYmbQnqiB/+CvA6hm84xP8806eUrrRh4M4iKeWoPTR/CHqXVFNJT1\n IJWcV9LgbFiFsUabmiIPlMZq7HW9XkX44XxkLVlCSX3w1rXFmX8SncazruG4JDc0eZIx\n S5Bw==","X-Gm-Message-State":"AOJu0YxrFX7IOS6qkQ+AMvdUGB01I1bLkRd/sGZloqeLpb+Egj1laAVI\n O4ZT+qzlQNpmwyDvUrnkhO8XrbSvZ6J+fuCw3fgoJrgrfcm9UWiR0VO8EJGcKc/z/icnDKLljIG\n bHnN0g3A3d51AcLr5zRtLGhfzkFs+FuTS+RTA3EIbk4IzzsqnhcpKVgWfNA==","X-Gm-Gg":"AeBDievpR0tw3LvjdRmivYx9JLCBkcOeYIi6FbRiQxq325/pkRPzce43M85jKrJUlt/\n /H6ZHQbpeS9frq4AVCs0WREmqnbjxCSDlZXK/xBAY5v4G1xX8c7pmJSaJgY27L6J9i+Um4KbOct\n sNXTtKsm6Sdw9rJVH+DptkyAjt2yDw+b+bFfgS0eNJA+rkfiUyArVwJz+L34dJTDnQ3lG33cjFO\n ZRWC5evbTg1sr4llxwFIo74aXFJtYRyYXuT70Z8NA2Hq1xaGSxP8BdcqwLbHe8nWkQluug4lzYv\n 1VlAu1GunQfLfHYZeaSed6lLbOml1+0h0ZeUtrecyXAO7sccPwSLgKQn6VizSP8yIsAzR0UEcg=\n =","X-Received":"by 2002:a05:690c:d96:b0:79a:5466:bb93 with SMTP id\n 00721157ae682-7af71d44373mr38595047b3.41.1775831627848; Fri, 10 Apr 2026\n 07:33:47 -0700 (PDT)","MIME-Version":"1.0","References":"<20260409060155.94704-1-matthieu@min.io>\n <20260410143000.86708-1-matthieu@min.io>","In-Reply-To":"<20260410143000.86708-1-matthieu@min.io>","From":"Matthieu Rolla <matthieu@minio.io>","Date":"Fri, 10 Apr 2026 16:33:47 +0200","X-Gm-Features":"AQROBzD5tfel07yPxYlZGc1I9WZodwvef4eLayGZrCCXxn1IoG1_g1I1h9wOHes","Message-ID":"\n <CAPSO8Mx2pXp1UGvrsqTL86b=920os62MYSGn-ryv-YV4kRN4NA@mail.gmail.com>","Subject":"Re: [PATCH v3] hw/nvme: add namespace hotplug support","To":"qemu-devel@nongnu.org, qemu-block@nongnu.org","Cc":"its@irrelevant.dk, kbusch@kernel.org, stefanha@redhat.com,\n mr-083 <matthieu@min.io>","Content-Type":"multipart/alternative; boundary=\"0000000000005bef3a064f1c05c2\"","Received-SPF":"pass client-ip=2607:f8b0:4864:20::112b;\n envelope-from=matthieu@minio.io; helo=mail-yw1-x112b.google.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no","X-Spam_action":"no action","X-Mailman-Approved-At":"Fri, 10 Apr 2026 11:01:56 -0400","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"}},{"id":3676038,"web_url":"http://patchwork.ozlabs.org/comment/3676038/","msgid":"<20260410201401.GA501153@fedora>","list_archive_url":null,"date":"2026-04-10T20:14:01","subject":"Re: [PATCH v3] hw/nvme: add namespace hotplug support","submitter":{"id":17227,"url":"http://patchwork.ozlabs.org/api/people/17227/","name":"Stefan Hajnoczi","email":"stefanha@redhat.com"},"content":"On Fri, Apr 10, 2026 at 04:33:47PM +0200, Matthieu Rolla wrote:\n> Hello @Stefan Hajnoczi <stefanha@redhat.com> ,\n> \n> \n> Thanks for the review! v3 sent.\n> \n> \n> Wording: Fixed in v3, no more \"physical PCIe slot\" claim. Now describes it\n> as NVMe namespace-level hotplug.\n> \n> \n> I/O drain: Moved nvme_ns_drain() to the start of the unplug handler so\n> in-flight I/O completes before detach. Tested under warp load (16\n> concurrent 1MiB uploads via MinIO/DirectPV)  device_del returns in ~400ms\n> with clean removal, no use-after-free.\n> \n> \n> Symmetry:  moved subsys->namespaces[nsid] = NULL into nvme_ns_unrealize()\n> so the namespace lifecycle is complete (mirrors what nvme_ns_realize() sets\n> up).\n> \n> \n> I don't have a working Windows test setup, I'd really appreciate if you\n> could test it next week as you offered.\n> \n> Thanks again for your time\n\nAwesome, thanks!\n\nI will give Windows Server a spin next week. I'm not an expert in\nhw/nvme/ but the patch looks good to me:\n\nReviewed-by: Stefan Hajnoczi <stefanha@redhat.com>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=JD70p87f;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fsp1Q47qvz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 11 Apr 2026 06:14:34 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wBIF4-0008L8-Q4; Fri, 10 Apr 2026 16:14:14 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <stefanha@redhat.com>)\n id 1wBIF3-0008KF-Co\n for qemu-devel@nongnu.org; Fri, 10 Apr 2026 16:14:13 -0400","from us-smtp-delivery-124.mimecast.com ([170.10.129.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <stefanha@redhat.com>)\n id 1wBIF1-0002bZ-7p\n for qemu-devel@nongnu.org; Fri, 10 Apr 2026 16:14:13 -0400","from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-653-pwc8rsMFOpyQFvzlxnITJA-1; Fri,\n 10 Apr 2026 16:14:07 -0400","from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 21127195606C; Fri, 10 Apr 2026 20:14:05 +0000 (UTC)","from localhost (unknown [10.44.48.68])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id C773919560AB; Fri, 10 Apr 2026 20:14:03 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1775852048;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n in-reply-to:in-reply-to:references:references;\n bh=Bv1kZQYoNQMOACvLFLwx7bKNC/uh0+2uZldXHUG+19U=;\n b=JD70p87fK9WHUcktjyxnYEZf8yZvREKtPVXrZ/mu9u+oordY/pJ5GxkFBXKteqGQhhBMXk\n 9eVxeVNl/bU9SKnzsDhAYrTCUe4TkyX5FQd9wRHw+zbyJQ8maX6Zl3OlsWBkE7qG9YZaXx\n rv5c/8XnizZUA+TgDhnFQgaDc8QAtaY=","X-MC-Unique":"pwc8rsMFOpyQFvzlxnITJA-1","X-Mimecast-MFC-AGG-ID":"pwc8rsMFOpyQFvzlxnITJA_1775852045","Date":"Fri, 10 Apr 2026 16:14:01 -0400","From":"Stefan Hajnoczi <stefanha@redhat.com>","To":"Matthieu Rolla <matthieu@minio.io>","Cc":"qemu-devel@nongnu.org, qemu-block@nongnu.org, its@irrelevant.dk,\n kbusch@kernel.org, mr-083 <matthieu@min.io>","Subject":"Re: [PATCH v3] hw/nvme: add namespace hotplug support","Message-ID":"<20260410201401.GA501153@fedora>","References":"<20260409060155.94704-1-matthieu@min.io>\n <20260410143000.86708-1-matthieu@min.io>\n <CAPSO8Mx2pXp1UGvrsqTL86b=920os62MYSGn-ryv-YV4kRN4NA@mail.gmail.com>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha512;\n protocol=\"application/pgp-signature\"; boundary=\"JRps01L0QAbPgrLX\"","Content-Disposition":"inline","In-Reply-To":"\n <CAPSO8Mx2pXp1UGvrsqTL86b=920os62MYSGn-ryv-YV4kRN4NA@mail.gmail.com>","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.17","Received-SPF":"pass client-ip=170.10.129.124;\n envelope-from=stefanha@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com","X-Spam_score_int":"7","X-Spam_score":"0.7","X-Spam_bar":"/","X-Spam_report":"(0.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n RCVD_IN_SBL_CSS=3.335, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001,\n SPF_PASS=-0.001 autolearn=no autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"}},{"id":3676820,"web_url":"http://patchwork.ozlabs.org/comment/3676820/","msgid":"<CAPSO8MwiXZJ0z7N-uS5Vm3znRXUddWqNCe98Fg--4AumpLCDXA@mail.gmail.com>","list_archive_url":null,"date":"2026-04-13T15:24:34","subject":"Re: [PATCH v3] hw/nvme: add namespace hotplug support","submitter":{"id":93098,"url":"http://patchwork.ozlabs.org/api/people/93098/","name":"Matthieu Rolla","email":"matthieu@minio.io"},"content":"Hello,\n\nI tested further more the device_del + device_add and the AEN works\ncorrectly, causing the guest to rescan namespaces.\n\nHowever, when XFS filesystems are mounted on the namespace (via\nDirectPV/CSI in our case), the kernel doesn't reuse the block device number\nafter re-add.\n\nFor example, nvme2n1 becomes nvme2n2 because the stale XFS mount holds a\nreference to the old nvme_ns_head, preventing ida_free() in\nnvme_free_ns_head() from releasing the instance number before the new\nnamespace is allocated.\n\nThis causes XFS \"duplicate UUID\" errors since the same filesystem appears\nunder a different device name while the old stale mount still exists.\n\nThis is a Linux kernel behavior (ida_alloc in nvme_alloc_ns_head), not a\nQEMU issue. The namespace hotplug patch itself is correct. But for\npractical use with mounted filesystems, I found that the drive_del +\ndrive_insert approach (keeping the namespace device alive) avoids the\nrename entirely since no ida allocation/free cycle occurs.\n\nWould it make sense to include drive_insert as a companion patch, or is\nthat better handled separately ?\n\nThanks\n\nOn Fri, Apr 10, 2026 at 10:14 PM Stefan Hajnoczi <stefanha@redhat.com>\nwrote:\n\n> On Fri, Apr 10, 2026 at 04:33:47PM +0200, Matthieu Rolla wrote:\n> > Hello @Stefan Hajnoczi <stefanha@redhat.com> ,\n> >\n> >\n> > Thanks for the review! v3 sent.\n> >\n> >\n> > Wording: Fixed in v3, no more \"physical PCIe slot\" claim. Now describes\n> it\n> > as NVMe namespace-level hotplug.\n> >\n> >\n> > I/O drain: Moved nvme_ns_drain() to the start of the unplug handler so\n> > in-flight I/O completes before detach. Tested under warp load (16\n> > concurrent 1MiB uploads via MinIO/DirectPV)  device_del returns in ~400ms\n> > with clean removal, no use-after-free.\n> >\n> >\n> > Symmetry:  moved subsys->namespaces[nsid] = NULL into nvme_ns_unrealize()\n> > so the namespace lifecycle is complete (mirrors what nvme_ns_realize()\n> sets\n> > up).\n> >\n> >\n> > I don't have a working Windows test setup, I'd really appreciate if you\n> > could test it next week as you offered.\n> >\n> > Thanks again for your time\n>\n> Awesome, thanks!\n>\n> I will give Windows Server a spin next week. I'm not an expert in\n> hw/nvme/ but the patch looks good to me:\n>\n> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>\n>","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n secure) header.d=minio.io header.i=@minio.io header.a=rsa-sha256\n header.s=minio header.b=NcWFV2aS;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fvWSY08kwz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 01:25:33 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wCJ9X-0006pN-I3; Mon, 13 Apr 2026 11:24:43 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <matthieu@minio.io>) id 1wCJ9S-0006k6-9x\n for qemu-devel@nongnu.org; Mon, 13 Apr 2026 11:24:38 -0400","from mail-yw1-x112b.google.com ([2607:f8b0:4864:20::112b])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)\n (Exim 4.90_1) (envelope-from <matthieu@minio.io>) id 1wCJ9Q-0000aG-0F\n for qemu-devel@nongnu.org; Mon, 13 Apr 2026 11:24:37 -0400","by mail-yw1-x112b.google.com with SMTP id\n 00721157ae682-793fdbb8d3aso49554517b3.3\n for <qemu-devel@nongnu.org>; Mon, 13 Apr 2026 08:24:35 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; t=1776093874; cv=none;\n d=google.com; s=arc-20240605;\n b=PLBfL8LhtvLCp8zoSbA/xJNx5Z0xvp9J2QI/LnjOqIUYwcx/H+SCxsjHdESa7h1UAD\n tnNytArtZALp13Oj5FQTDEXMgKy1Th/ZfdXce5tfJO5YD/LsMpzxD21PaXjVy8esAyaR\n bPjzkw4YBVRNugak/j0Qn0cHXE/8jrl/BKGsILQp84VO8u2alGkYHtkfrleaTJhDygUk\n hwwjP6Q16G0Q8YqFparf583XDRQ6BOUZ6paYKq+/ImXLaDPhSlq1KFwrTgKA0/v16Xy0\n ZsMOB5AgsKcgbxOBBpjmtzcLHWaSCDVT/sjBsC9f5DwwinheoQu+T6RZFJJqtCjS1Ys4\n Sbrw==","ARC-Message-Signature":"i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;\n s=arc-20240605;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:dkim-signature;\n bh=leKoe1zxD0sTN0Fe2mL7153kT+YlstzCjcsiyCaDX84=;\n fh=9APC4TOqqeyK4f+hBMC/WhXBwI4zhfL25tS7yb/7n7s=;\n b=anQovTOwTue94nVockLrTKXf1Xb9l5Zx85bwYksvmZPx2waQWPLzEz88uwCjwhDthM\n WMLThdeRWu7tfUgkISM2qcp1or78LWK3N1kFk8OkGoOCbeiYMSbQt67hu8NbvyIcA8tQ\n RUPS/9brvlQLmQXXHN6s2adVuzGKiJrJAgWDwULtYe9V+0R2blubXTm297Oae2iM/5tR\n cV4Sq8x8xVUZ2nj/n/lXWuUgur+Nez2ZgSJrMoYND7N+948a1auKSHthE/OYBS0LHDej\n 7RdquEQzOms4HgVPLOP8DC7qq76IIzB3LbSjx6Ke8r4lz4la10AJO4/DuaCSXPnX3asX\n +J1g==; darn=nongnu.org","ARC-Authentication-Results":"i=1; mx.google.com; arc=none","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=minio.io; s=minio; t=1776093874; x=1776698674; darn=nongnu.org;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:from:to:cc:subject:date:message-id:reply-to;\n bh=leKoe1zxD0sTN0Fe2mL7153kT+YlstzCjcsiyCaDX84=;\n b=NcWFV2aSz6aBbi4xEqbwqmMqynYYWTE5F5VJcAB1Pl5Q9jS01l7/+taTCI10plIz5F\n lt/3NDODYVnXEMxB0tTiDW4CglXDrXxnL9dNSeKPn++BjB4/n32CRV/nqwVvF4UDWjsb\n 7fOuzN4Rqz3DugBAIos49xq4xrbJtN1tn2QMvxc3ye1ThOHdUatpMviWf8h7ZcV5rtol\n E2BeDBtjd884qQWeqKyotfEvi58XgZThmDT3OWEeLdHDII9E3mT3QMBckGfnCpGHD9mx\n bsujQSp5hlpwKV/hRgMazN9rorJz9bSLcIer3EhV/6ihdNcdHzCz4pHFMidr3E30R7Po\n TSJw==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776093874; x=1776698674;\n h=cc:to:subject:message-id:date:from:in-reply-to:references\n :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=leKoe1zxD0sTN0Fe2mL7153kT+YlstzCjcsiyCaDX84=;\n b=BHroH4NrSvPea5+kXhHygn9WSOUc/DdDYS2l5+JHFITSLDRrTEOBiSb1j0I+iUhtGb\n Ao9YKLi5Rzf2OVY/BCCI1ai+kQn6DccVK46Khir/DWGuXzVwXDiafooJUnuNvWsbclml\n IWG/hkxljzWjdmiD6tKTYSTGL8YAgDJQKcFjKbuXSyhHlZaLdHm07n3vE2w1dmOETBre\n OJ/avs/aYanKmiZ+9OYSAo0VhJMJmz4Fc7oRqePNKgTRh1KTTbWRvqjX4b5oz5AJdBnY\n 193fqzWGw8/3z0VYz6yec7RiC4yR6XX79u4K4wIyUOXyEx1Gh09llOeWz33mJ472fgwn\n PchA==","X-Gm-Message-State":"AOJu0YzLdY6gZWsHEG2iRCNNXiPms+FWkEYL1qP9L1l91n7FB71frDfL\n zvpObAfn49tovngcsrMUhGCkNGG4ELekaE3TmDkcECvm+HTnrur0s7DLLQe3eBFjAFpQYz8znyx\n +NLTvPnWbKONVqCtJ7oidVY3lcIMShL3EBwJ3R/WIYg==","X-Gm-Gg":"AeBDiesNpNZ7boH7T1duFcyvnY08BXnAA7IsNgI4DGniM5waOgeiA4Y/8W+n6Wl2eXC\n 63FbGEv+gViAZ9zcN29HQVtniD/iC3HN89GKYlnltRT5OY65mA+KAMetlatPCotGX9UIuG7zgjK\n 0jrDCvGGkhTqXWEAZc48kDkvAGBn0/fs33uEr4Xm6/nf2oWlWWo3H8HQ1EDXWHlD0UyaPFRMzhD\n wpPM+e0z+pY5k6/u6XG16TRZ4kJfOvIxVknosZ+iJzr4kcEPHpbUIpONMWKOXSM/Ku/05k2/4YL\n Jp25D/7sXJHsDMAGEzpaS9qoiszHuEvw73TefVOBcLVdPOa5rPvw9BWTrFxkpo/TKHXU6eueBQ=\n =","X-Received":"by 2002:a05:690c:6b01:b0:7b2:1bf1:7ff2 with SMTP id\n 00721157ae682-7b21bf18391mr62871777b3.7.1776093874192; Mon, 13 Apr 2026\n 08:24:34 -0700 (PDT)","MIME-Version":"1.0","References":"<20260409060155.94704-1-matthieu@min.io>\n <20260410143000.86708-1-matthieu@min.io>\n <CAPSO8Mx2pXp1UGvrsqTL86b=920os62MYSGn-ryv-YV4kRN4NA@mail.gmail.com>\n <20260410201401.GA501153@fedora>","In-Reply-To":"<20260410201401.GA501153@fedora>","From":"Matthieu Rolla <matthieu@minio.io>","Date":"Mon, 13 Apr 2026 17:24:34 +0200","X-Gm-Features":"AQROBzDd0FdWvsP_NpSC7SZQS7XNeh_o5B4KnBJarZdCuvymbhybyDKS5Y8xKKE","Message-ID":"\n <CAPSO8MwiXZJ0z7N-uS5Vm3znRXUddWqNCe98Fg--4AumpLCDXA@mail.gmail.com>","Subject":"Re: [PATCH v3] hw/nvme: add namespace hotplug support","To":"Stefan Hajnoczi <stefanha@redhat.com>","Cc":"qemu-devel@nongnu.org, qemu-block@nongnu.org, its@irrelevant.dk,\n kbusch@kernel.org, mr-083 <matthieu@min.io>","Content-Type":"multipart/alternative; boundary=\"0000000000007592f3064f5914ae\"","Received-SPF":"pass client-ip=2607:f8b0:4864:20::112b;\n envelope-from=matthieu@minio.io; helo=mail-yw1-x112b.google.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, HTML_MESSAGE=0.001,\n RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,\n SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"}},{"id":3676858,"web_url":"http://patchwork.ozlabs.org/comment/3676858/","msgid":"<ad0lMYOrRa-K1Ach@AALNPWKJENSEN.aal.scsc.local>","list_archive_url":null,"date":"2026-04-13T17:17:37","subject":"Re: [PATCH 0/2] NVMe namespace hotplug and drive reconnection support","submitter":{"id":77636,"url":"http://patchwork.ozlabs.org/api/people/77636/","name":"Klaus Jensen","email":"its@irrelevant.dk"},"content":"On Apr  9 08:01, mr-083 wrote:\n> This series adds two features that together enable transparent NVMe disk\n> hot-swap simulation in QEMU, matching the behavior of physical NVMe\n> drives being pulled and reinserted in the same PCIe slot.\n> \n\nI don't understand this. From an NVMe perspective you can't hotplug a\nnamespace. You can hotplug a PCIe-based NVM Subsystem.","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=irrelevant.dk header.i=@irrelevant.dk\n header.a=rsa-sha256 header.s=fm1 header.b=epugcTyj;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=messagingengine.com header.i=@messagingengine.com\n header.a=rsa-sha256 header.s=fm2 header.b=pkWHKU0P;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fvYyx4tKDz1yDG\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 03:18:32 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wCKv1-00011h-8C; Mon, 13 Apr 2026 13:17:52 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <its@irrelevant.dk>)\n id 1wCKuw-00010R-Ow; Mon, 13 Apr 2026 13:17:46 -0400","from fout-a1-smtp.messagingengine.com ([103.168.172.144])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <its@irrelevant.dk>)\n id 1wCKuu-0004na-Hq; Mon, 13 Apr 2026 13:17:46 -0400","from phl-compute-03.internal (phl-compute-03.internal [10.202.2.43])\n by mailfout.phl.internal (Postfix) with ESMTP id BFA56EC046A;\n Mon, 13 Apr 2026 13:17:40 -0400 (EDT)","from phl-frontend-04 ([10.202.2.163])\n by phl-compute-03.internal (MEProxy); Mon, 13 Apr 2026 13:17:40 -0400","by mail.messagingengine.com (Postfix) with ESMTPA; Mon,\n 13 Apr 2026 13:17:39 -0400 (EDT)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/relaxed; d=irrelevant.dk;\n h=cc:cc:content-type:content-type:date:date:from:from\n :in-reply-to:in-reply-to:message-id:mime-version:references\n :reply-to:subject:subject:to:to; s=fm1; t=1776100660; x=\n 1776187060; bh=+v6r/Y+AI78jDBnyf+yWhBKEBztHpvqNMpgMzFSCets=; b=e\n pugcTyjWNqhRV9ZiN5XkfeAt/Bl46Cc+KgPh0m3IBVhKZFHlZ+28avhKqw2j8uat\n ZoKbUly7U8tIUQhL4r2jqlLMYbHbZgf+eEskKPi9nIINxlAzfkwpBqFSOahWlF04\n e2H4dD7cvu1mw+ndX1/YGZ904tlwMp9m8iH8mkFRrbcu6zYLU+tSBxVD7ClubhXS\n MRH1ghb+g3vWE6b+EosQDVraye7tADDhiYoFnHj0MQa/+lULDfWxFt8TeFdND5qG\n +zzJRj2JbWSlsm8IGbFxoXf3ARaq5M7aLr5WwDXtWC1VjWJbFBBVZZlmHp51rUeD\n DB2QN1KhS40u1dJGOicqA==","v=1; a=rsa-sha256; c=relaxed/relaxed; d=\n messagingengine.com; h=cc:cc:content-type:content-type:date:date\n :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to\n :message-id:mime-version:references:reply-to:subject:subject:to\n :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=\n 1776100660; x=1776187060; bh=+v6r/Y+AI78jDBnyf+yWhBKEBztHpvqNMpg\n MzFSCets=; b=pkWHKU0P/q6rPGaamP8jglvZwQ9bTZHeWR0Gx/HQ2OmxeZyC+Wo\n 8ZfKjNHQE2Zj0GlE1/2k7p+T5HYb5RLZaa1hqltp4dH79I4gLpYuTcnyH7Qcnc3f\n 89W2eT/zWWTbmvjRWV1uczmdxUORH4gTvvMnmYyVLMN5LlepakHibm/gUMmc5+Yx\n zYznealq+9txvHfc0+91LNx+h5/XDChIboGEiqnotMbWNDugglmJhugH8nGng2An\n mybtMMVNPQo/7Eqi5F/HU3Edo1PirV4EImEs9PTNfK9EWnHcW2+z4u66yELcrLiF\n jBpbe8heh9gnFuGsk18g2HM5XAsdRZnT5GA=="],"X-ME-Sender":"<xms:MyXdaZySJSzWj-m6uWWmTvtw0QiUhwj0UTQ9wCE86e_fbHLJG4rMXw>\n <xme:MyXdaUOzt4xORLtTaV9V5r-tcXPRGSHgsfFDgabtgkp8PdE5r0hfebyZK75Dbrrgs\n Re6P3U9erCyljbyNQOJ0hgeQWpTHdpoh1dk1jwI65GvRZQvpqrvzvY>","X-ME-Received":"\n <xmr:MyXdaSX8EV8uqBW2Z-_fctMyNSWH6w78KMKLdIj2DD8aAFWqVBgnRWqghBncbAi36stTbaUNvH45Fv1zHAkCEBIUoLEmxdU>","X-ME-Proxy-Cause":"\n gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdefkeekudcutefuodetggdotefrod\n ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpuffrtefokffrpgfnqfghnecuuegr\n ihhlohhuthemuceftddtnecunecujfgurhepfffhvfevuffkfhggtggujgesghdtreertd\n dtjeenucfhrhhomhepmfhlrghushculfgvnhhsvghnuceoihhtshesihhrrhgvlhgvvhgr\n nhhtrdgukheqnecuggftrfgrthhtvghrnhepjefgjeefffdvuefhieefhffggfeuleehud\n ekveejvedtuddugeeigeetffffjeevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghr\n rghmpehmrghilhhfrhhomhepihhtshesihhrrhgvlhgvvhgrnhhtrdgukhdpnhgspghrtg\n hpthhtohepjedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepmhgrthhthhhivghu\n sehmihhnihhordhiohdprhgtphhtthhopehqvghmuhdquggvvhgvlhesnhhonhhgnhhurd\n horhhgpdhrtghpthhtohepqhgvmhhuqdgslhhotghksehnohhnghhnuhdrohhrghdprhgt\n phhtthhopehksghushgthheskhgvrhhnvghlrdhorhhgpdhrtghpthhtohepshhtvghfrg\n hnhhgrsehrvgguhhgrthdrtghomhdprhgtphhtthhopehmrghtthhhihgvuhesmhhinhdr\n ihhopdhrtghpthhtohepihhtshesihhrrhgvlhgvvhgrnhhtrdgukh","X-ME-Proxy":"<xmx:MyXdaQ2eGyqbDExjunOd2IZjws7esSCL_ZAPe8VWYnzyVkWzCTHeJg>\n <xmx:MyXdaYrVAaOsv8XpqC15mcDvOAF6-18ej-EaISO3zaWBhyF2v6Yzig>\n <xmx:MyXdafVViSOcqWQ1s_kthZnZXXKmL3mzN-5Rvux6ai4XtbANIss-pQ>\n <xmx:MyXdabaLRIDApzjLu_h4BCzroWuo-XLC0MPDVgLz7GO9rxjLC6isMg>\n <xmx:NCXdaW8JyoMBy8OzNh6-XN6gMrniTAJjZoe-QWEFyA-fxY9GVh_fj6y8>","Feedback-ID":"idc91472f:Fastmail","Date":"Mon, 13 Apr 2026 19:17:37 +0200","From":"Klaus Jensen <its@irrelevant.dk>","To":"mr-083 <matthieu@minio.io>","Cc":"qemu-devel@nongnu.org, qemu-block@nongnu.org, kbusch@kernel.org,\n stefanha@redhat.com, mr-083 <matthieu@min.io>","Subject":"Re: [PATCH 0/2] NVMe namespace hotplug and drive reconnection support","Message-ID":"<ad0lMYOrRa-K1Ach@AALNPWKJENSEN.aal.scsc.local>","References":"<20260409060155.94704-1-matthieu@min.io>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha512;\n protocol=\"application/pgp-signature\"; boundary=\"d+LtPI+/KR3dtQlq\"","Content-Disposition":"inline","In-Reply-To":"<20260409060155.94704-1-matthieu@min.io>","Received-SPF":"pass client-ip=103.168.172.144; envelope-from=its@irrelevant.dk;\n helo=fout-a1-smtp.messagingengine.com","X-Spam_score_int":"-27","X-Spam_score":"-2.8","X-Spam_bar":"--","X-Spam_report":"(-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,\n DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"}},{"id":3677169,"web_url":"http://patchwork.ozlabs.org/comment/3677169/","msgid":"<20260414124221.GB111076@fedora>","list_archive_url":null,"date":"2026-04-14T12:42:21","subject":"Re: [PATCH 0/2] NVMe namespace hotplug and drive reconnection support","submitter":{"id":17227,"url":"http://patchwork.ozlabs.org/api/people/17227/","name":"Stefan Hajnoczi","email":"stefanha@redhat.com"},"content":"On Mon, Apr 13, 2026 at 07:17:37PM +0200, Klaus Jensen wrote:\n> On Apr  9 08:01, mr-083 wrote:\n> > This series adds two features that together enable transparent NVMe disk\n> > hot-swap simulation in QEMU, matching the behavior of physical NVMe\n> > drives being pulled and reinserted in the same PCIe slot.\n> > \n> \n> I don't understand this. From an NVMe perspective you can't hotplug a\n> namespace. You can hotplug a PCIe-based NVM Subsystem.\n\nHi Klaus,\nIt would be great if someone with more NVMe experience than myself can\nfind a definite answer, but I think the Namespace List can change\nasynchronously even on a NVMe PCIe controller as long as it supports\nNamespace Management commands.\n\nThere are instances in the NVMe Express Base Specification 2.0b like:\n- 8.3.1 Capacity Management Overview\n  \"a Namespace Attribute Changed event is generated for hosts other than\n  the host which issued the Capacity Management command\"\n- 8.11 Namespace Management\n  \"If Namespace Attribute Notices are enabled, any controller(s) not\n  processing the Namespace Management command that was attached to the\n  namespace reports a Namespace Attribute Changed asynchronous event to\n  the host.\"\n\nI imagine this functionality would be useful in storage offload cards\n(IPUs/DPUs) that present as NVMe PCIe controllers instead of as\nNVMe-over-Fabrics. This makes sense when the host is not supposed to\nmanage the storage itself. When the card's control plane configures a\nnew volume, the NVMe Namespace List changes and the host is notified.\n\nLinux and Windows NVMe PCI drivers support this according to the testing\nthat Matthieu and I have done.\n\nThanks,\nStefan","headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=XPJIT1NP;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists1p.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists1p.gnu.org (lists1p.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fw3py2NgSz1xtJ\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 22:43:20 +1000 (AEST)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists1p.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1wCd6A-0008Am-Ef; Tue, 14 Apr 2026 08:42:34 -0400","from eggs.gnu.org ([2001:470:142:3::10])\n by lists1p.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <stefanha@redhat.com>)\n id 1wCd69-0008AW-Nd\n for qemu-devel@nongnu.org; Tue, 14 Apr 2026 08:42:33 -0400","from us-smtp-delivery-124.mimecast.com ([170.10.133.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <stefanha@redhat.com>)\n id 1wCd68-00030e-Bg\n for qemu-devel@nongnu.org; Tue, 14 Apr 2026 08:42:33 -0400","from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-18-KqmYqaqZPyS1xAMPi1Rt1A-1; Tue,\n 14 Apr 2026 08:42:26 -0400","from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id CFD1519560B8; Tue, 14 Apr 2026 12:42:24 +0000 (UTC)","from localhost (unknown [10.44.50.237])\n by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id C0C4B3000C1F; Tue, 14 Apr 2026 12:42:23 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776170551;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n in-reply-to:in-reply-to:references:references;\n bh=64C2YsslG2c/XZX4KWE47mEgBaDHV+zeHySbSFO5g8c=;\n b=XPJIT1NPcCXTnEcWWEO1gWvvJilcoKrhcpd9dWQi9LYXjNLU6PzkXFdv+a1rLUik/rInkW\n 0r/KLDN0r0+AAo8Dait11ikEDdFSftR5QiTQ7FLOkEvKkuKNDAdRKKca2Ir04gRWcapFD+\n HUzdOUqeLxDVOqfImN4sL9Hex8BI6q0=","X-MC-Unique":"KqmYqaqZPyS1xAMPi1Rt1A-1","X-Mimecast-MFC-AGG-ID":"KqmYqaqZPyS1xAMPi1Rt1A_1776170545","Date":"Tue, 14 Apr 2026 08:42:21 -0400","From":"Stefan Hajnoczi <stefanha@redhat.com>","To":"Klaus Jensen <its@irrelevant.dk>","Cc":"mr-083 <matthieu@minio.io>, qemu-devel@nongnu.org,\n qemu-block@nongnu.org, kbusch@kernel.org, mr-083 <matthieu@min.io>,\n John Meneghini <jmeneghi@redhat.com>","Subject":"Re: [PATCH 0/2] NVMe namespace hotplug and drive reconnection support","Message-ID":"<20260414124221.GB111076@fedora>","References":"<20260409060155.94704-1-matthieu@min.io>\n <ad0lMYOrRa-K1Ach@AALNPWKJENSEN.aal.scsc.local>","MIME-Version":"1.0","Content-Type":"multipart/signed; micalg=pgp-sha512;\n protocol=\"application/pgp-signature\"; boundary=\"xAu5N7wFZwOlRHtN\"","Content-Disposition":"inline","In-Reply-To":"<ad0lMYOrRa-K1Ach@AALNPWKJENSEN.aal.scsc.local>","X-Scanned-By":"MIMEDefang 3.4.1 on 10.30.177.4","Received-SPF":"pass client-ip=170.10.133.124;\n envelope-from=stefanha@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com","X-Spam_score_int":"7","X-Spam_score":"0.7","X-Spam_bar":"/","X-Spam_report":"(0.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.54,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=0.001, RCVD_IN_SBL_CSS=3.335,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001,\n SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"}}]