All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Nix <nix@esperi.org.uk>
Cc: Andres Salomon <dilinger@queued.net>,
	arnd@arndb.de, linux-kernel@vger.kernel.org
Subject: Re: 4.4.1 regression from 4.1.x: Soekris net5501 crash in IRQ after mfgpt timer initialization
Date: Tue, 2 Feb 2016 15:40:08 +0100 (CET)	[thread overview]
Message-ID: <alpine.DEB.2.11.1602021531400.25254@nanos> (raw)
In-Reply-To: <87a8njchvj.fsf@esperi.org.uk>

On Tue, 2 Feb 2016, Nix wrote:

> [Cc:ed Thomas on the vague hope that maybe this is osmething to do with
>  the IRQ subsystem in general, though I doubt it, since only the one
>  machine is crashing for me: it's probably the CS5531's interactions
>  with said subsystem at fault.]

Kinda. That driver does the following:

       setup the irq in CS5531

       request the interrupt to install the handler

       register the clockevents device

> [    1.589543] cs5535-clockevt: Registering MFGPT timer as a clock event, using IRQ 7
> [    1.604921] BUG: unable to handle kernel NULL pointer dereference at   (null)

> [    1.605101]  [<c02cf141>] ? mfgpt_tick+0x6e/0x77
...
> [    1.605339]  [<c039c1a9>] common_interrupt+0x29/0x30
...
> [    1.605394]  [<c013e4e7>] vprintk_emit+0x2b4/0x2be
> [    1.605426]  [<c013e5f2>] vprintk_default+0x12/0x14
> [    1.605446]  [<c0164cd6>] printk+0x11/0x13
> [    1.605462]  [<c04b625a>] cs5535_mfgpt_init+0xce/0xf1

So the interrupt hits before the clockevent device is registered and the event
handler is installed. So mfgpt_tick() will happily call a null pointer.

The patch below should fix^Wwork around the issue.

Thanks,

	tglx

8<----------------

--- a/drivers/clocksource/cs5535-clockevt.c
+++ b/drivers/clocksource/cs5535-clockevt.c
@@ -117,7 +117,8 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id)
 	/* Turn off the clock (and clear the event) */
 	disable_timer(cs5535_event_clock);
 
-	if (clockevent_state_shutdown(&cs5535_clockevent))
+	if (clockevent_state_shutdown(&cs5535_clockevent) ||
+	    clockevent_state_detached(&cs5535_clockevent))
 		return IRQ_HANDLED;
 
 	/* Clear the counter */

  reply	other threads:[~2016-02-02 14:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-02 14:21 4.4.1 regression from 4.1.x: Soekris net5501 crash in IRQ after mfgpt timer initialization Nix
2016-02-02 14:40 ` Thomas Gleixner [this message]
2016-02-02 15:03   ` Nix
2016-02-02 15:51     ` Thomas Gleixner
2016-02-02 16:07       ` Nix

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=alpine.DEB.2.11.1602021531400.25254@nanos \
    --to=tglx@linutronix.de \
    --cc=arnd@arndb.de \
    --cc=dilinger@queued.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nix@esperi.org.uk \
    /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.