Re: [PATCH] PCI: Add pci shutdown ability

Alan Stern
2005-04-26T15:12:14Z

On Mon, 25 Apr 2005, Andrew Morton wrote:

> I have vague memories of this being discussed at some length last year.
> Nothing comprehensive came of it, except that perhaps the kdump code should
> spin with irqs off for a couple of seconds so the DMA and IRQs stop.

Like Pavel said, this won't work.

> (Ongoing DMA is not a problem actually, because the kdump kernel won't be
> using that memory anyway)

For PCI devices at least, DMA _can_ be disabled in a uniform way as
devices are discovered. Some platforms might not want to do this for fear
it would kill the initial console display.

IRQs _cannot_ be disabled in a uniform way. So they remain a problem.

> For kdump we really don't want to be doing fancy driver shutdown inside a
> crashed kernel. It would be better to just jump to the new kernel and
> to reset the hardware from there. DMA doesn't matter, and maybe IRQs can
> be handled with a sustained local_irq_disable() (hard).

But at some point you have to enable local IRQs, and then you're in
trouble if a device without a driver is generating requests. Unless the
new kernel can run with interrupts entirely disabled? Seems pretty
unlikely.

The real problem is that, in general, hardware _can't_ be reset properly
by a new kernel. There are things that can help, like the PCI USB quirks
code. That might be enough to handle the most pressing existing problems;
certainly it would avoid the USB issues we've seen. (But it needs to be
updated to avoid interfering with normal operations during
resume-from-disk.)

Alan Stern