Re: [RFC PATCH] PCI, kdump: Clear bus master bit upon shutdown in kdump kernel

From: Jerry Hoemann
Date: Fri Jan 10 2020 - 18:37:20 EST


On Fri, Jan 10, 2020 at 03:42:17PM -0600, Bjorn Helgaas wrote:
> [+cc Deepa (also working in this area)]
>
> On Thu, Dec 26, 2019 at 03:21:18AM +0800, Kairui Song wrote:
> > There are reports about kdump hang upon reboot on some HPE machines,
> > kernel hanged when trying to shutdown a PCIe port, an uncorrectable
> > error occurred and crashed the system.
>
> Details? Do you have URLs for bug reports, dmesg logs, etc?

Hi, Bjorn,

Not sure if you have access to Red Hat Bugzilla, but I filed:

https://bugzilla.redhat.com/show_bug.cgi?id=1774802

When I hit this issue.



>
> > On the machine I can reproduce this issue, part of the topology
> > looks like this:
> >
> > [0000:00]-+-00.0 Intel Corporation Xeon E7 v3/Xeon E5 v3/Core i7 DMI2
> > +-01.0-[02]--
> > +-01.1-[05]--
> > +-02.0-[06]--+-00.0 Emulex Corporation OneConnect NIC (Skyhawk)
> > | +-00.1 Emulex Corporation OneConnect NIC (Skyhawk)
> > | +-00.2 Emulex Corporation OneConnect NIC (Skyhawk)
> > | +-00.3 Emulex Corporation OneConnect NIC (Skyhawk)
> > | +-00.4 Emulex Corporation OneConnect NIC (Skyhawk)
> > | +-00.5 Emulex Corporation OneConnect NIC (Skyhawk)
> > | +-00.6 Emulex Corporation OneConnect NIC (Skyhawk)
> > | \-00.7 Emulex Corporation OneConnect NIC (Skyhawk)
> > +-02.1-[0f]--
> > +-02.2-[07]----00.0 Hewlett-Packard Company Smart Array Gen9 Controllers
> >
> > When shutting down PCIe port 0000:00:02.2 or 0000:00:02.0, the machine
> > will hang, depend on which device is reinitialized in kdump kernel.
> >
> > If force remove unused device then trigger kdump, the problem will never
> > happen:
> >
> > echo 1 > /sys/bus/pci/devices/0000\:00\:02.2/0000\:07\:00.0/remove
> > echo c > /proc/sysrq-trigger
> >
> > ... Kdump save vmcore through network, the NIC get reinitialized and
> > hpsa is untouched. Then reboot with no problem. (If hpsa is used
> > instead, shutdown the NIC in first kernel will help)
> >
> > The cause is that some devices are enabled by the first kernel, but it
> > don't have the chance to shutdown the device, and kdump kernel is not
> > aware of it, unless it reinitialize the device.
> >
> > Upon reboot, kdump kernel will skip downstream device shutdown and
> > clears its bridge's master bit directly. The downstream device could
> > error out as it can still send requests but upstream refuses it.
>
> Can you help me understand the sequence of events? If I understand
> correctly, the desired sequence is:
>
> - user kernel boots
> - user kernel panics and kexecs to kdump kernel
> - kdump kernel writes vmcore to network or disk

Some context:

The problem for me hits itermittently during shutdown of the kdump kernel.
During this time, the SUT sometimes gets a PCI error that raises an NMI.

The reaction to the NMI that the kdump kernel takes is problematic.
Sometimes the system prints the tombstones and resets through firmware
without problems. Other times it takes a second NMI and hangs.

I'll note that the kdump initrd doesn't contain the NIC drivers. When
these are added, we don't see the issue.


Jerry

--

-----------------------------------------------------------------------------
Jerry Hoemann Software Engineer Hewlett Packard Enterprise
-----------------------------------------------------------------------------