Re: [WARNING: A/V UNSCANNABLE][Merge tag 'media/v4.11-1' of git] ff58d005cd: BUG: unable to handle kernel NULL pointer dereference at 0000039c
From: Thomas Gleixner
Date: Mon Feb 27 2017 - 12:06:03 EST
On Mon, 27 Feb 2017, Ingo Molnar wrote:
> * Thomas Gleixner <tglx@xxxxxxxxxxxxx> wrote:
>
> > The pending interrupt issue happens, at least on my test boxen, mostly on
> > the 'legacy' interrupts (0 - 15). But even the IOAPIC interrupts >=16
> > happen occasionally.
> >
> >
> > - Spurious interrupts on IRQ7, which are triggered by IRQ 0 (PIT/HPET). On
> > one of the affected machines this stops when the interrupt system is
> > switched to interrupt remapping !?!?!?
> >
> > - Spurious interrupts on various interrupt lines, which are triggered by
> > IOAPIC interrupts >= IRQ16. That's a known issue on quite some chipsets
> > that the legacy PCI interrupt (which is used when IOAPIC is disabled) is
> > triggered when the IOAPIC >=16 interrupt fires.
> >
> > - Spurious interrupt caused by driver probing itself. I.e. the driver
> > probing code causes an interrupt issued from the device
> > inadvertently. That happens even on IRQ >= 16.
> >
> > This problem might be handled by the device driver code itself, but
> > that's going to be ugly. See below.
>
> That's pretty colorful behavior...
>
> > We can try to sample more data from the machines of affected users, but I doubt
> > that it will give us more information than confirming that we really have to
> > deal with all that hardware wreckage out there in some way or the other.
>
> BTW., instead of trying to avoid the scenario, wow about moving in the other
> direction: making CONFIG_DEBUG_SHIRQ=y unconditional property in the IRQ core code
> starting from v4.12 or so, i.e. requiring device driver IRQ handlers to handle the
> invocation of IRQ handlers at pretty much any moment. (We could also extend it a
> bit, such as invoking IRQ handlers early after suspend/resume wakeup.)
>
> Because it's not the requirement that hurts primarily, but the resulting
> non-determinism and the sporadic crashes. Which can be solved by making the race
> deterministic via the debug facility.
>
> If the IRQ handler crashed the moment it was first written by the driver author
> we'd never see these problems.
Yes, I'd love to do that. That's just a nightmare as well.
See commit 6d83f94db95cf, which added the _FIXME suffix to that code.
So recently I tried to invoke the primary handler, which causes another
issue:
Some of the low level code (e.g. IOAPIC interrupt migration, but also
some PPC irq chip machinery) depends on being called in hard interrupt
context. They invoke get_irq_regs(), which obviously does not work from
thread context.
So I removed that one from -next as well and postponed it another time. And
I should have known before I tried it that it does not work. Simply because
of that stuff x86 cannot use the software based resend mechanism.
Still trying to wrap my head around a proper solution for the problem. On
x86 we might just check whether we are really in hard irq context and
otherwise skip the part which depends on get_irq_regs(). That would be a
sane thing to do. Have not yet looked at the PPC side of affairs, whether
that's easy to solve as well. But even if it is, then there might be still
other magic code in some irq chip drivers which relies on things which are
only available/correct when actually invoked by a hardware interrupt.
Not only the hardware has colorful behaviour ....
Thanks,
tglx