qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Igor Mammedov <imammedo@redhat.com>
To: Lukasz Maniak <lukasz.maniak@linux.intel.com>
Cc: fam@euphon.net, kwolf@redhat.com, stefanha@redhat.com,
	qemu-block@nongnu.org, mst@redhat.com, armbru@redhat.com,
	lukasz.gieryk@linux.intel.com, f4bug@amsat.org,
	qemu-devel@nongnu.org, kbusch@kernel.org, its@irrelevant.dk,
	hreitz@redhat.com, xypron.glpk@gmx.de, k.jensen@samsung.com,
	ani@anisinha.ca
Subject: Re: [PATCH v7 12/12] hw/acpi: Make the PCI hot-plug aware of SR-IOV
Date: Thu, 31 Mar 2022 14:38:41 +0200	[thread overview]
Message-ID: <20220331143841.55ae9372@redhat.com> (raw)
In-Reply-To: <20220318191819.1711831-13-lukasz.maniak@linux.intel.com>

On Fri, 18 Mar 2022 20:18:19 +0100
Lukasz Maniak <lukasz.maniak@linux.intel.com> wrote:

> From: Łukasz Gieryk <lukasz.gieryk@linux.intel.com>
> 
> PCI device capable of SR-IOV support is a new, still-experimental
> feature with only a single working example of the Nvme device.
> 
> This patch in an attempt to fix a double-free problem when a
> SR-IOV-capable Nvme device is hot-unplugged. The problem and the
> reproduction steps can be found in this thread:
> 
> https://patchew.org/QEMU/20220217174504.1051716-1-lukasz.maniak@linux.intel.com/20220217174504.1051716-14-lukasz.maniak@linux.intel.com/

pls include that in patch description.

> Details of the proposed solution are, for convenience, included below.
> 
> 1) The current SR-IOV implementation assumes it’s the PhysicalFunction
>    that creates and deletes VirtualFunctions.
> 2) It’s a design decision (the Nvme device at least) for the VFs to be
>    of the same class as PF. Effectively, they share the dc->hotpluggable
>    value.
> 3) When a VF is created, it’s added as a child node to PF’s PCI bus
>    slot.
> 4) Monitor/device_del triggers the ACPI mechanism. The implementation is
>    not aware of SR/IOV and ejects PF’s PCI slot, directly unrealizing all
>    hot-pluggable (!acpi_pcihp_pc_no_hotplug) children nodes.
> 5) VFs are unrealized directly, and it doesn’t work well with (1).
>    SR/IOV structures are not updated, so when it’s PF’s turn to be
>    unrealized, it works on stale pointers to already-deleted VFs.
it's unclear what's bing hotpluged and unplugged, it would be better if
you included QEMU CLI and relevan qmp/monito commands to reproduce it.

> 
> Signed-off-by: Łukasz Gieryk <lukasz.gieryk@linux.intel.com>
> ---
>  hw/acpi/pcihp.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
> index 6351bd3424d..248839e1110 100644
> --- a/hw/acpi/pcihp.c
> +++ b/hw/acpi/pcihp.c
> @@ -192,8 +192,12 @@ static bool acpi_pcihp_pc_no_hotplug(AcpiPciHpState *s, PCIDevice *dev)
>       * ACPI doesn't allow hotplug of bridge devices.  Don't allow
>       * hot-unplug of bridge devices unless they were added by hotplug
>       * (and so, not described by acpi).
> +     *
> +     * Don't allow hot-unplug of SR-IOV Virtual Functions, as they
> +     * will be removed implicitly, when Physical Function is unplugged.
>       */
> -    return (pc->is_bridge && !dev->qdev.hotplugged) || !dc->hotpluggable;
> +    return (pc->is_bridge && !dev->qdev.hotplugged) || !dc->hotpluggable ||
> +           pci_is_vf(dev);
>  }
>  
>  static void acpi_pcihp_eject_slot(AcpiPciHpState *s, unsigned bsel, unsigned slots)



  reply	other threads:[~2022-03-31 12:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 19:18 [PATCH v7 00/12] hw/nvme: SR-IOV with Virtualization Enhancements Lukasz Maniak
2022-03-18 19:18 ` [PATCH v7 01/12] hw/nvme: Add support for SR-IOV Lukasz Maniak
2022-03-18 19:18 ` [PATCH v7 02/12] hw/nvme: Add support for Primary Controller Capabilities Lukasz Maniak
2022-03-18 19:18 ` [PATCH v7 03/12] hw/nvme: Add support for Secondary Controller List Lukasz Maniak
2022-03-18 19:18 ` [PATCH v7 04/12] hw/nvme: Implement the Function Level Reset Lukasz Maniak
2022-03-18 19:18 ` [PATCH v7 05/12] hw/nvme: Make max_ioqpairs and msix_qsize configurable in runtime Lukasz Maniak
2022-03-18 19:18 ` [PATCH v7 06/12] hw/nvme: Remove reg_size variable and update BAR0 size calculation Lukasz Maniak
2022-03-18 19:18 ` [PATCH v7 07/12] hw/nvme: Calculate BAR attributes in a function Lukasz Maniak
2022-03-18 19:18 ` [PATCH v7 08/12] hw/nvme: Initialize capability structures for primary/secondary controllers Lukasz Maniak
2022-03-18 19:18 ` [PATCH v7 09/12] hw/nvme: Add support for the Virtualization Management command Lukasz Maniak
2022-03-18 19:18 ` [PATCH v7 10/12] docs: Add documentation for SR-IOV and Virtualization Enhancements Lukasz Maniak
2022-03-18 19:18 ` [PATCH v7 11/12] hw/nvme: Update the initalization place for the AER queue Lukasz Maniak
2022-03-18 19:18 ` [PATCH v7 12/12] hw/acpi: Make the PCI hot-plug aware of SR-IOV Lukasz Maniak
2022-03-31 12:38   ` Igor Mammedov [this message]
2022-04-04  9:41     ` Łukasz Gieryk
2022-04-20 10:59       ` Lukasz Maniak
2022-04-20 11:59   ` Michael S. Tsirkin
2022-04-20 12:02 ` [PATCH v7 00/12] hw/nvme: SR-IOV with Virtualization Enhancements Michael S. Tsirkin
2022-04-20 12:12   ` Klaus Jensen
2022-04-20 14:50     ` Lukasz Maniak
2022-04-28 19:56 ` Klaus Jensen

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=20220331143841.55ae9372@redhat.com \
    --to=imammedo@redhat.com \
    --cc=ani@anisinha.ca \
    --cc=armbru@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=fam@euphon.net \
    --cc=hreitz@redhat.com \
    --cc=its@irrelevant.dk \
    --cc=k.jensen@samsung.com \
    --cc=kbusch@kernel.org \
    --cc=kwolf@redhat.com \
    --cc=lukasz.gieryk@linux.intel.com \
    --cc=lukasz.maniak@linux.intel.com \
    --cc=mst@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=xypron.glpk@gmx.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).