Commit e2ac56f6 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] get_offset_pit and do_timer_overflow vs IRQ locking

From: john stultz <johnstul@us.ibm.com>, Alexander Atanasov <alex@ssi.bg>

We want to make sure we update jiffies_p and count_p atomically.  So I'm
inserting the spin_unlock_irqrestore() after we update count_p, rather then
just before.
parent 0ebcfd99
......@@ -54,7 +54,7 @@ static void delay_pit(unsigned long loops)
}
/* This function must be called with interrupts disabled
/* This function must be called with xtime_lock held.
* It was inspired by Steve McCanne's microtime-i386 for BSD. -- jrs
*
* However, the pc-audio speaker driver changes the divisor so that
......@@ -93,7 +93,7 @@ static unsigned long get_offset_pit(void)
static unsigned long jiffies_p = 0;
/*
* cache volatile jiffies temporarily; we have IRQs turned off.
* cache volatile jiffies temporarily; we have xtime_lock.
*/
unsigned long jiffies_t;
......@@ -119,8 +119,6 @@ static unsigned long get_offset_pit(void)
count = LATCH - 1;
}
spin_unlock_irqrestore(&i8253_lock, flags);
/*
* avoiding timer inconsistencies (they are rare, but they happen)...
* there are two kinds of problems that must be avoided here:
......@@ -130,7 +128,6 @@ static unsigned long get_offset_pit(void)
* (see c't 95/10 page 335 for Neptun bug.)
*/
if( jiffies_t == jiffies_p ) {
if( count > count_p ) {
/* the nutcase */
......@@ -141,6 +138,8 @@ static unsigned long get_offset_pit(void)
count_p = count;
spin_unlock_irqrestore(&i8253_lock, flags);
count = ((LATCH-1) - count) * TICK_SIZE;
count = (count + LATCH/2) / LATCH;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment