From: Igor Mammedov <imammedo@redhat.com>
To: Dongli Zhang <dongli.zhang@oracle.com>
Cc: linux-acpi@vger.kernel.org, linux-pci@vger.kernel.org,
mst@redhat.com, rafael@kernel.org, lenb@kernel.org,
bhelgaas@google.com, mika.westerberg@linux.intel.com,
boris.ostrovsky@oracle.com, joe.jin@oracle.com,
stable@vger.kernel.org, Fiona Ebner <f.ebner@proxmox.com>,
Thomas Lamprecht <t.lamprecht@proxmox.com>,
linux-kernel@vger.kernel.org
Subject: Re: [RFC 2/2] PCI: acpiphp: slowdown hotplug if hotplugging multiple devices at a time
Date: Wed, 13 Dec 2023 11:05:56 +0100 [thread overview]
Message-ID: <20231213110556.5f1d83bf@imammedo.users.ipa.redhat.com> (raw)
In-Reply-To: <d93c4614-1bbc-3a30-305e-28ff75d7fde2@oracle.com>
On Wed, 13 Dec 2023 00:13:37 -0800
Dongli Zhang <dongli.zhang@oracle.com> wrote:
> Hi Igor,
>
>
> On 12/12/23 16:36, Igor Mammedov wrote:
> > previous commit ("PCI: acpiphp: enable slot only if it hasn't been enabled already"
> > introduced a workaround to avoid a race between SCSI_SCAN_ASYNC job and
> > bridge reconfiguration in case of single HBA hotplug.
> > However in virt environment it's possible to pause machine hotplug several
> > HBAs and let machine run. That can hit the same race when 2nd hotplugged
>
> Would you mind helping explain what does "pause machine hotplug several HBAs and
> let machine run" indicate?
qemu example would be:
{qemu) stop
(qemu) device_add device_add vhost-scsi-pci,wwpn=naa.5001405324af0985,id=vhost01,bus=bridge1,addr=8
(qemu) device_add vhost-scsi-pci,wwpn=naa.5001405324af0986,id=vhost02,bus=bridge1,addr=0
(qemu) cont
this way when machine continues to run acpiphp code will see 2 HBAs at once
and try to process one right after another. So [1/2] patch is not enough
to cover above case, and hence the same hack SHPC employs by adding delay.
However 2 separate hotplug events as in your reproducer should be covered
by the 1st patch.
> Thank you very much!
>
> Dongli Zhang
>
> > HBA will start re-configuring bridge.
> > Do the same thing as SHPC and throttle down hotplug of 2nd and up
> > devices within single hotplug event.
> >
> > Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> > ---
> > drivers/pci/hotplug/acpiphp_glue.c | 6 ++++++
> > 1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c
> > index 6b11609927d6..30bca2086b24 100644
> > --- a/drivers/pci/hotplug/acpiphp_glue.c
> > +++ b/drivers/pci/hotplug/acpiphp_glue.c
> > @@ -37,6 +37,7 @@
> > #include <linux/mutex.h>
> > #include <linux/slab.h>
> > #include <linux/acpi.h>
> > +#include <linux/delay.h>
> >
> > #include "../pci.h"
> > #include "acpiphp.h"
> > @@ -700,6 +701,7 @@ static void trim_stale_devices(struct pci_dev *dev)
> > static void acpiphp_check_bridge(struct acpiphp_bridge *bridge)
> > {
> > struct acpiphp_slot *slot;
> > + int nr_hp_slots = 0;
> >
> > /* Bail out if the bridge is going away. */
> > if (bridge->is_going_away)
> > @@ -723,6 +725,10 @@ static void acpiphp_check_bridge(struct acpiphp_bridge *bridge)
> >
> > /* configure all functions */
> > if (slot->flags != SLOT_ENABLED) {
> > + if (nr_hp_slots)
> > + msleep(1000);
> > +
> > + ++nr_hp_slots;
> > enable_slot(slot, true);
> > }
> > } else {
>
next prev parent reply other threads:[~2023-12-13 10:06 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 0:36 [RFC 0/2] PCI: acpiphp: workaround race between hotplug and SCSI_SCAN_ASYNC job Igor Mammedov
2023-12-13 0:36 ` [RFC 1/2] PCI: acpiphp: enable slot only if it hasn't been enabled already Igor Mammedov
2023-12-13 9:47 ` Fiona Ebner
2023-12-13 10:07 ` Igor Mammedov
2023-12-13 13:01 ` Rafael J. Wysocki
2023-12-13 16:06 ` Igor Mammedov
2023-12-13 0:36 ` [RFC 2/2] PCI: acpiphp: slowdown hotplug if hotplugging multiple devices at a time Igor Mammedov
2023-12-13 7:26 ` Greg KH
2023-12-13 8:13 ` Dongli Zhang
2023-12-13 10:05 ` Igor Mammedov [this message]
2023-12-13 17:25 ` Dongli Zhang
2023-12-13 9:47 ` Fiona Ebner
2023-12-13 13:07 ` Rafael J. Wysocki
2023-12-13 16:49 ` Igor Mammedov
2023-12-13 16:54 ` Michael S. Tsirkin
2023-12-13 17:09 ` Dongli Zhang
2024-01-03 9:54 ` Igor Mammedov
2024-01-03 16:19 ` Dongli Zhang
2023-12-13 18:50 ` Igor Mammedov
2023-12-13 8:12 ` [RFC 0/2] PCI: acpiphp: workaround race between hotplug and SCSI_SCAN_ASYNC job Dongli Zhang
2023-12-13 18:11 ` Bjorn Helgaas
2023-12-13 18:12 ` Rafael J. Wysocki
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=20231213110556.5f1d83bf@imammedo.users.ipa.redhat.com \
--to=imammedo@redhat.com \
--cc=bhelgaas@google.com \
--cc=boris.ostrovsky@oracle.com \
--cc=dongli.zhang@oracle.com \
--cc=f.ebner@proxmox.com \
--cc=joe.jin@oracle.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=mst@redhat.com \
--cc=rafael@kernel.org \
--cc=stable@vger.kernel.org \
--cc=t.lamprecht@proxmox.com \
/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