Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1408973 > unrolled thread

Re: [PATCH] clocksource:fix kernel panic due missing event_handler in cs5535

Started byThomas Gleixner <tglx@linutronix.de>
First post2016-05-30 12:40 +0200
Last post2016-05-31 09:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] clocksource:fix kernel panic due missing event_handler  in cs5535 Thomas Gleixner <tglx@linutronix.de> - 2016-05-30 12:40 +0200
    Re: [PATCH] clocksource:fix kernel panic due missing event_handler  in cs5535 Hans Ulli Kroll <ulli.kroll@googlemail.com> - 2016-05-31 09:10 +0200

#1408973 — Re: [PATCH] clocksource:fix kernel panic due missing event_handler in cs5535

FromThomas Gleixner <tglx@linutronix.de>
Date2016-05-30 12:40 +0200
SubjectRe: [PATCH] clocksource:fix kernel panic due missing event_handler in cs5535
Message-ID<rEsM2-2Wp-25@gated-at.bofh.it>
On Mon, 30 May 2016, Hans Ulli Kroll wrote:

> Missing event_handler in mfgpt_tick() caused a kernel panic.

So the real problem is that the interrupt in the device is enabled _BEFORE_
the clock event device is registered.
 
> diff --git a/drivers/clocksource/cs5535-clockevt.c b/drivers/clocksource/cs5535-clockevt.c
> index 9a7e37c..6f186cf 100644
> --- a/drivers/clocksource/cs5535-clockevt.c
> +++ b/drivers/clocksource/cs5535-clockevt.c
> @@ -129,7 +129,9 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id)
>  		cs5535_mfgpt_write(cs5535_event_clock, MFGPT_REG_SETUP,
>  				MFGPT_SETUP_CNTEN | MFGPT_SETUP_CMP2);
>  
> -	cs5535_clockevent.event_handler(&cs5535_clockevent);
> +	if (cs5535_clockevent.event_handler)
> +		cs5535_clockevent.event_handler(&cs5535_clockevent);
> +

So what about fixing the above problem instead of having a conditional in the
interrupt handler fast path?

Thanks,

	tglx

[toc] | [next] | [standalone]


#1409915

FromHans Ulli Kroll <ulli.kroll@googlemail.com>
Date2016-05-31 09:10 +0200
Message-ID<rELYn-7O6-39@gated-at.bofh.it>
In reply to#1408973
HI

On Mon, 30 May 2016, Thomas Gleixner wrote:

> On Mon, 30 May 2016, Hans Ulli Kroll wrote:
> 
> > Missing event_handler in mfgpt_tick() caused a kernel panic.
> 
> So the real problem is that the interrupt in the device is enabled _BEFORE_
> the clock event device is registered.
>  
> > diff --git a/drivers/clocksource/cs5535-clockevt.c b/drivers/clocksource/cs5535-clockevt.c
> > index 9a7e37c..6f186cf 100644
> > --- a/drivers/clocksource/cs5535-clockevt.c
> > +++ b/drivers/clocksource/cs5535-clockevt.c
> > @@ -129,7 +129,9 @@ static irqreturn_t mfgpt_tick(int irq, void *dev_id)
> >  		cs5535_mfgpt_write(cs5535_event_clock, MFGPT_REG_SETUP,
> >  				MFGPT_SETUP_CNTEN | MFGPT_SETUP_CMP2);
> >  
> > -	cs5535_clockevent.event_handler(&cs5535_clockevent);
> > +	if (cs5535_clockevent.event_handler)
> > +		cs5535_clockevent.event_handler(&cs5535_clockevent);
> > +
> 
> So what about fixing the above problem instead of having a conditional in the
> interrupt handler fast path?
> 

So there in an default handler for this in the clockevent framework.
OK, for this approach.
I'll send another patch.

Greetings from Cologne
Hans Ulli Kroll

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web