From: Keith Busch <keith.busch@intel.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Derrick, Jonathan" <jonathan.derrick@intel.com>,
Dongdong Liu <liudongdong3@huawei.com>,
Sinan Kaya <okaya@kernel.org>,
Oza Pawandeep <poza@codeaurora.org>,
Matthew Wilcox <willy@infradead.org>,
Lukas Wunner <lukas@wunner.de>, Christoph Hellwig <hch@lst.de>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] PCI/AER: Enable reporting for ports enumerated after AER driver registration
Date: Thu, 11 Oct 2018 09:57:16 -0600 [thread overview]
Message-ID: <20181011155715.GD11034@localhost.localdomain> (raw)
In-Reply-To: <153927157816.40414.5263399018962087014.stgit@bhelgaas-glaptop.roam.corp.google.com>
On Thu, Oct 11, 2018 at 08:26:18AM -0700, Bjorn Helgaas wrote:
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> Previously we enabled AER error reporting only for Switch Ports that were
> enumerated prior to registering the AER service driver. Switch Ports
> enumerated after AER driver registration were left with error reporting
> disabled.
>
> A common order, which works correctly, is that we enumerate devices before
> registering portdrv and the AER driver:
>
> - Enumerate all the devices at boot-time
>
> - Register portdrv and bind it to all Root Ports and Switch Ports, which
> disables error reporting for these Ports
>
> - Register AER service driver and bind it to all Root Ports, which
> enables error reporting for the Root Ports and any Switch Ports below
> them
>
> But if we enumerate devices *after* registering portdrv and the AER driver,
> e.g., if a host bridge driver is loaded as a module, error reporting is not
> enabled correctly:
>
> - Register portdrv and AER driver (this happens at boot-time)
>
> - Enumerate a Root Port
>
> - Bind portdrv to Root Port, disabling its error reporting
>
> - Bind AER service driver to Root Port, enabling error reporting for it
> and its children (there are no children, since we haven't enumerated
> them yet)
>
> - Enumerate Switch Port below the Root Port
>
> - Bind portdrv to Switch Port, disabling its error reporting
>
> - AER service driver doesn't bind to Switch Ports, so error reporting
> remains disabled
>
> Hot-adding a Switch fails similarly: error reporting is enabled correctly
> for the Root Port, but when the Switch is enumerated, the AER service
> driver doesn't claim it, so there's nothing to enable error reporting for
> the Switch Ports.
>
> Change the AER service driver so it binds to *all* PCIe Ports, including
> Switch Upstream and Downstream Ports. Enable AER error reporting for all
> these Ports, but not for any children.
>
> Link: https://lore.kernel.org/linux-pci/1536085989-2956-1-git-send-email-jonathan.derrick@intel.com
> Based-on-patch-by: Jon Derrick <jonathan.derrick@intel.com>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
> ---
> drivers/pci/pcie/aer.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 90b53abf621d..c40c6607849b 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -1316,12 +1316,6 @@ static void aer_enable_rootport(struct aer_rpc *rpc)
> pci_read_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, ®32);
> pci_write_config_dword(pdev, aer_pos + PCI_ERR_UNCOR_STATUS, reg32);
>
> - /*
> - * Enable error reporting for the root port device and downstream port
> - * devices.
> - */
> - set_downstream_devices_error_reporting(pdev, true);
> -
> /* Enable Root Port's interrupt in response to error messages */
> pci_read_config_dword(pdev, aer_pos + PCI_ERR_ROOT_COMMAND, ®32);
> reg32 |= ROOT_PORT_INTR_ON_MESG_MASK;
> @@ -1378,10 +1372,17 @@ static void aer_remove(struct pcie_device *dev)
> */
> static int aer_probe(struct pcie_device *dev)
> {
> + struct pci_dev *pdev = dev->port;
> + int type = pci_pcie_type(pdev);
> int status;
> struct aer_rpc *rpc;
> struct device *device = &dev->device;
>
> + if (type == PCI_EXP_TYPE_UPSTREAM || type == PCI_EXP_TYPE_DOWNSTREAM) {
> + pci_enable_pcie_error_reporting(pdev);
> + return 0;
> + }
I think we need to either return an error in this case so that the
pcie_device won't be eligable for the .remove() callback, or add a
similiar type check in aer_remove().
next prev parent reply other threads:[~2018-10-11 16:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-11 15:26 [PATCH v3] PCI/AER: Enable reporting for all ports Bjorn Helgaas
2018-10-11 15:26 ` [PATCH v3] PCI/AER: Enable reporting for ports enumerated after AER driver registration Bjorn Helgaas
2018-10-11 15:57 ` Keith Busch [this message]
2018-10-12 8:16 ` Dongdong Liu
2018-10-18 20:52 ` Bjorn Helgaas
2018-10-18 20:49 ` Bjorn Helgaas
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=20181011155715.GD11034@localhost.localdomain \
--to=keith.busch@intel.com \
--cc=hch@lst.de \
--cc=helgaas@kernel.org \
--cc=jonathan.derrick@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=liudongdong3@huawei.com \
--cc=lukas@wunner.de \
--cc=mika.westerberg@linux.intel.com \
--cc=okaya@kernel.org \
--cc=poza@codeaurora.org \
--cc=willy@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.