lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 19 Jul 2015 00:18:37 +0200
From:	Alexandre Belloni <alexandre.belloni@...e-electrons.com>
To:	Thomas Gleixner <tglx@...utronix.de>
Cc:	Daniel Lezcano <daniel.lezcano@...aro.org>,
	Nicolas Ferre <nicolas.ferre@...el.com>,
	Boris Brezillon <boris.brezillon@...e-electrons.com>,
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
	David Dueck <davidcdueck@...glemail.com>
Subject: Re: [PATCH 3/3] clocksource: atmel-pit: Remove irq handler when
 clock event is unused

On 18/07/2015 at 10:20:53 +0200, Thomas Gleixner wrote :
> On Fri, 17 Jul 2015, Alexandre Belloni wrote:
> >  /*
> > + * IRQ handler for the timer.
> > + */
> > +static irqreturn_t at91sam926x_pit_interrupt(int irq, void *dev_id)
> > +{
> > +	struct pit_data *data = dev_id;
> > +
> > +	/*
> > +	 * irqs should be disabled here, but as the irq is shared they are only
> > +	 * guaranteed to be off if the timer irq is registered first.
> 
> That's wrong. We run all handlers with interrupts disabled for about 5
> years now.
> 
> > +	 */
> > +	WARN_ON_ONCE(!irqs_disabled());
> 

Yeah, I was skeptical when I read that...

> 
> > +	/* The PIT interrupt may be disabled, and is shared */
> > +	if (clockevent_state_periodic(&data->clkevt) &&
> > +	    (pit_read(data->base, AT91_PIT_SR) & AT91_PIT_PITS)) {
> > +		unsigned nr_ticks;
> > +
> > +		/* Get number of ticks performed before irq, and ack it */
> > +		nr_ticks = PIT_PICNT(pit_read(data->base, AT91_PIT_PIVR));
> > +		do {
> > +			data->cnt += data->cycle;
> > +			data->clkevt.event_handler(&data->clkevt);
> > +			nr_ticks--;
> > +		} while (nr_ticks);
> 
> I don't think you need this loop. You have a proper clocksource
> registered so the timekeeping code will handle the lost ticks nicely.
> 

... for both comments, this is just code I'm moving from one place to
another. I'll have a look a clean that up in a preliminary patch.
Thanks!


-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ