[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.21.1811131407120.2697@nanos.tec.linutronix.de>
Date: Tue, 13 Nov 2018 14:10:36 -0800 (PST)
From: Thomas Gleixner <tglx@...utronix.de>
To: Finn Thain <fthain@...egraphics.com.au>
cc: Geert Uytterhoeven <geert@...ux-m68k.org>,
Arnd Bergmann <arnd@...db.de>,
Stephen N Chivers <schivers@....com.au>,
Daniel Lezcano <daniel.lezcano@...aro.org>,
John Stultz <john.stultz@...aro.org>,
linux-m68k@...ts.linux-m68k.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 13/13] m68k: mvme16x: Convert to clocksource APIy
On Wed, 14 Nov 2018, Finn Thain wrote:
> On Tue, 13 Nov 2018, I wrote:
>
> > On Mon, 12 Nov 2018, Thomas Gleixner wrote:
> >
> > > > +static u32 clk_total;
> > > > +
> > > > +#define PCC_TIMER_CLOCK_FREQ 1000000
> > > > +#define PCC_TIMER_CYCLES (PCC_TIMER_CLOCK_FREQ / HZ)
> > > > +
> > > > static irqreturn_t mvme16x_timer_int (int irq, void *dev_id)
> > > > {
> > > > + irq_handler_t tick_handler = dev_id;
> > > > + unsigned long flags;
> > > > +
> > > > + local_irq_save(flags);
> > >
> > > No need for local_irq_save() here. Interrupt handlers are guaranteed to be
> > > called with interrupts disabled.
> > >
> >
> > That's not the case on m68k, as I understand it. However, the CPU
> > interrupt level does prevent interrupt handlers from nesting.
> >
>
> What I mean by that is, the interrupt level (IPL) prevents interrupt
> handlers from being re-entered. But a handler can still get interrupted by
> a higher priority interrupt request. In the past I've had to add defensive
> locking because of this.
>
> In these patches I've assumed it was possible for some higher priority
> interrupt handler to perform a clocksource read after the timer handler
> started executing. Hence the use of local_irq_save/restore.
>
> To be sure, I've just run a quick test and confirmed that the timer
> handler can indeed get interrupted by the ethernet interrupt handler.
Urgh. Then you have more serious trouble. If the interrupting handler
calls any of the time accessor functions then you can actually live lock
when the interrupt happens in the middle of the write locked section of the
core timekeeping update. So you really want to disable interrupts across
the whole timer interrupt function or make sure that the timer interrupt is
the highest priority one on the system.
Thanks,
tglx
Powered by blists - more mailing lists