netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] net/e1000e: Avoid kernel crash during shutdown
@ 2013-08-13  6:27 Li Zhang
  2013-08-13 10:29 ` Jeff Kirsher
  0 siblings, 1 reply; 2+ messages in thread
From: Li Zhang @ 2013-08-13  6:27 UTC (permalink / raw)
  To: jeffrey.t.kirsher, jesse.brandeburg, davem, netdev; +Cc: shangw

While doing shutdown on the PCI device, the corresponding callback
function e1000e_shutdown() is trying to clear those correctable
errors on the upstream P2P bridge. Unfortunately, we don't have
the upstream P2P bridge under some cases (e.g. PCI-passthrou for
KVM on Power). That leads to kernel crash eventually.

The patch adds one more check on that to avoid kernel crash.

Signed-off-by: Li Zhang <zhlcindy@gmail.com>
---
 drivers/net/ethernet/intel/e1000e/netdev.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 77f81cb..232b2e8 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -5999,11 +5999,18 @@ static int __e1000_shutdown(struct pci_dev *pdev, bool runtime)
 	 * correctable error when the MAC transitions from D0 to D3.  To
 	 * prevent this we need to mask off the correctable errors on the
 	 * downstream port of the pci-e switch.
+	 *
+	 * We don't have the associated upstream bridge while assigning
+	 * the PCI device into guest. For example, the KVM on power is
+	 * one of the cases.
 	 */
 	if (adapter->flags & FLAG_IS_QUAD_PORT) {
 		struct pci_dev *us_dev = pdev->bus->self;
 		u16 devctl;
 
+		if (!us_dev)
+			return 0;
+
 		pcie_capability_read_word(us_dev, PCI_EXP_DEVCTL, &devctl);
 		pcie_capability_write_word(us_dev, PCI_EXP_DEVCTL,
 					   (devctl & ~PCI_EXP_DEVCTL_CERE));
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] net/e1000e: Avoid kernel crash during shutdown
  2013-08-13  6:27 [PATCH 1/1] net/e1000e: Avoid kernel crash during shutdown Li Zhang
@ 2013-08-13 10:29 ` Jeff Kirsher
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Kirsher @ 2013-08-13 10:29 UTC (permalink / raw)
  To: Li Zhang; +Cc: jesse.brandeburg, davem, netdev, shangw

[-- Attachment #1: Type: text/plain, Size: 659 bytes --]

On Tue, 2013-08-13 at 14:27 +0800, Li Zhang wrote:
> While doing shutdown on the PCI device, the corresponding callback
> function e1000e_shutdown() is trying to clear those correctable
> errors on the upstream P2P bridge. Unfortunately, we don't have
> the upstream P2P bridge under some cases (e.g. PCI-passthrou for
> KVM on Power). That leads to kernel crash eventually.
> 
> The patch adds one more check on that to avoid kernel crash.
> 
> Signed-off-by: Li Zhang <zhlcindy@gmail.com>
> ---
>  drivers/net/ethernet/intel/e1000e/netdev.c | 7 +++++++
>  1 file changed, 7 insertions(+)

Thanks Li, I will add this to my queue of patches.


[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-13 10:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-13  6:27 [PATCH 1/1] net/e1000e: Avoid kernel crash during shutdown Li Zhang
2013-08-13 10:29 ` Jeff Kirsher

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).