Message ID | 20230105184355.9829-1-a.antonovitch@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | PCI/hotplug: Replaced down_write_nested with hotplug_slot_rwsem if ctrl->depth > 0 when taking the ctrl->reset_lock. | expand |
On Thu, Jan 05, 2023 at 01:43:55PM -0500, Anatoli Antonovitch wrote: > From: Anatoli Antonovitch <anatoli.antonovitch@amd.com> > > It is to avoid any potential issues when S3 resume but at the same time we want to hot-unplug. > Need to do some more testing to see if it is still necessary. I'm not sure how to interpret this. I guess I'll wait for you to do the testing and repost this if it does turn out to be necessary? I don't want to merge a patch with a commit log that says "need to do more testing." Bjorn
On Mon, Jan 16, 2023 at 9:24 AM Anatoli Antonovitch <anatoli.antonovitch@amd.com> wrote: > > Thanks Bjorn, > > The extensive testing has been done for hot-plug, hot-unplug the device and ACPI S3 suspend/resume cycles on system with AER enabled. > > The patch has bee resent. Thanks. Just FYI, the mailing lists generally reject HTML email, so your response doesn't appear in the archives: https://lore.kernel.org/linux-pci/20230105184355.9829-1-a.antonovitch@gmail.com/ See http://vger.kernel.org/majordomo-info.html, https://en.wikipedia.org/wiki/Posting_style#Interleaved_style, https://people.kernel.org/tglx/notes-about-netiquette . Not a big deal for this response, but it is important for more substantive conversations. > On 2023-01-05 14:18, Bjorn Helgaas wrote: > > On Thu, Jan 05, 2023 at 01:43:55PM -0500, Anatoli Antonovitch wrote: > > From: Anatoli Antonovitch <anatoli.antonovitch@amd.com> > > It is to avoid any potential issues when S3 resume but at the same time we want to hot-unplug. > Need to do some more testing to see if it is still necessary. > > I'm not sure how to interpret this. > > I guess I'll wait for you to do the testing and repost this if it does > turn out to be necessary? > > I don't want to merge a patch with a commit log that says "need to do > more testing." > > Bjorn
diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c index 10e9670eea0b..b1084e67f798 100644 --- a/drivers/pci/hotplug/pciehp_hpc.c +++ b/drivers/pci/hotplug/pciehp_hpc.c @@ -27,6 +27,8 @@ #include "../pci.h" #include "pciehp.h" +static DECLARE_RWSEM(hotplug_slot_rwsem); + static const struct dmi_system_id inband_presence_disabled_dmi_table[] = { /* * Match all Dell systems, as some Dell systems have inband @@ -911,7 +913,10 @@ int pciehp_reset_slot(struct hotplug_slot *hotplug_slot, bool probe) if (probe) return 0; - down_write_nested(&ctrl->reset_lock, ctrl->depth); + if (ctrl->depth > 0) + down_write_nested(&ctrl->reset_lock, ctrl->depth); + else + down_write(&hotplug_slot_rwsem); if (!ATTN_BUTTN(ctrl)) { ctrl_mask |= PCI_EXP_SLTCTL_PDCE; @@ -931,7 +936,11 @@ int pciehp_reset_slot(struct hotplug_slot *hotplug_slot, bool probe) ctrl_dbg(ctrl, "%s: SLOTCTRL %x write cmd %x\n", __func__, pci_pcie_cap(ctrl->pcie->port) + PCI_EXP_SLTCTL, ctrl_mask); - up_write(&ctrl->reset_lock); + if (ctrl->depth > 0) + up_write(&ctrl->reset_lock); + else + up_write(&hotplug_slot_rwsem); + return rc; }