Fix time going backward with clock=pit [2/2]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is patch 2 of a 2-patch series.  The diff is against the
2.6.17-rc3-git17 snapshot.  It nukes some code that is dead after the
first patch.

* * *

do_timer_overflow is no longer used now; nuke it.

(By the way, the comment "It means that a timer tick interrupt came
along while the previous one was pending, thus a tick was missed" in
do_timer_overflow was wrong.  The code was meant to handle the easier
and more common case where the PIT counter wrapped just before we read
it and the tick interrupt that that caused was still pending.)

Note: There is some other code in the kernel that was meant to support
what do_timer_overflow was doing here.  See the "Subtle..." comments
in do_timer_interrupt and check_timer.  Unfortunately I don't know how
much of that code (if any) can be cleaned out now, as I don't
understand the stuff about "NMI lines for the watchdog if run on an
82489DX-based system" or all the details of check_timer.

 include/asm-i386/mach-default/do_timer.h |   52 -------------------------------
 include/asm-i386/mach-visws/do_timer.h   |   26 ---------------
 include/asm-i386/mach-voyager/do_timer.h |   13 -------
 3 files changed, 91 deletions(-)

Index: linux-2.6.17-rc3-git17/include/asm-i386/mach-default/do_timer.h
===================================================================
--- linux-2.6.17-rc3-git17.orig/include/asm-i386/mach-default/do_timer.h
+++ linux-2.6.17-rc3-git17/include/asm-i386/mach-default/do_timer.h
@@ -32,55 +32,3 @@ static inline void do_timer_interrupt_ho
 		smp_local_timer_interrupt(regs);
 #endif
 }
-
-
-/* you can safely undefine this if you don't have the Neptune chipset */
-
-#define BUGGY_NEPTUN_TIMER
-
-/**
- * do_timer_overflow - process a detected timer overflow condition
- * @count:	hardware timer interrupt count on overflow
- *
- * Description:
- *	This call is invoked when the jiffies count has not incremented but
- *	the hardware timer interrupt has.  It means that a timer tick interrupt
- *	came along while the previous one was pending, thus a tick was missed
- **/
-static inline int do_timer_overflow(int count)
-{
-	int i;
-
-	spin_lock(&i8259A_lock);
-	/*
-	 * This is tricky when I/O APICs are used;
-	 * see do_timer_interrupt().
-	 */
-	i = inb(0x20);
-	spin_unlock(&i8259A_lock);
-	
-	/* assumption about timer being IRQ0 */
-	if (i & 0x01) {
-		/*
-		 * We cannot detect lost timer interrupts ... 
-		 * well, that's why we call them lost, don't we? :)
-		 * [hmm, on the Pentium and Alpha we can ... sort of]
-		 */
-		count -= LATCH;
-	} else {
-#ifdef BUGGY_NEPTUN_TIMER
-		/*
-		 * for the Neptun bug we know that the 'latch'
-		 * command doesn't latch the high and low value
-		 * of the counter atomically. Thus we have to 
-		 * substract 256 from the counter 
-		 * ... funny, isnt it? :)
-		 */
-		
-		count -= 256;
-#else
-		printk("do_slow_gettimeoffset(): hardware timer problem?\n");
-#endif
-	}
-	return count;
-}
Index: linux-2.6.17-rc3-git17/include/asm-i386/mach-visws/do_timer.h
===================================================================
--- linux-2.6.17-rc3-git17.orig/include/asm-i386/mach-visws/do_timer.h
+++ linux-2.6.17-rc3-git17/include/asm-i386/mach-visws/do_timer.h
@@ -25,29 +25,3 @@ static inline void do_timer_interrupt_ho
 		smp_local_timer_interrupt(regs);
 #endif
 }
-
-static inline int do_timer_overflow(int count)
-{
-	int i;
-
-	spin_lock(&i8259A_lock);
-	/*
-	 * This is tricky when I/O APICs are used;
-	 * see do_timer_interrupt().
-	 */
-	i = inb(0x20);
-	spin_unlock(&i8259A_lock);
-	
-	/* assumption about timer being IRQ0 */
-	if (i & 0x01) {
-		/*
-		 * We cannot detect lost timer interrupts ... 
-		 * well, that's why we call them lost, don't we? :)
-		 * [hmm, on the Pentium and Alpha we can ... sort of]
-		 */
-		count -= LATCH;
-	} else {
-		printk("do_slow_gettimeoffset(): hardware timer problem?\n");
-	}
-	return count;
-}
Index: linux-2.6.17-rc3-git17/include/asm-i386/mach-voyager/do_timer.h
===================================================================
--- linux-2.6.17-rc3-git17.orig/include/asm-i386/mach-voyager/do_timer.h
+++ linux-2.6.17-rc3-git17/include/asm-i386/mach-voyager/do_timer.h
@@ -10,16 +10,3 @@ static inline void do_timer_interrupt_ho
 
 	voyager_timer_interrupt(regs);
 }
-
-static inline int do_timer_overflow(int count)
-{
-	/* can't read the ISR, just assume 1 tick
-	   overflow */
-	if(count > LATCH || count < 0) {
-		printk(KERN_ERR "VOYAGER PROBLEM: count is %d, latch is %d\n", count, LATCH);
-		count = LATCH;
-	}
-	count -= LATCH;
-
-	return count;
-}
Index: linux-2.6.17-rc3-git17/arch/i386/kernel/time.c
===================================================================
--- linux-2.6.17-rc3-git17.orig/arch/i386/kernel/time.c
+++ linux-2.6.17-rc3-git17/arch/i386/kernel/time.c
@@ -254,6 +254,12 @@ static inline void do_timer_interrupt(in
 		 * manually to reset the IRR bit for do_slow_gettimeoffset().
 		 * This will also deassert NMI lines for the watchdog if run
 		 * on an 82489DX-based system.
+		 *
+		 * XXX The code that formerly looked at the IRR bit in
+		 * do_slow_gettimeoffset no longer exists.  Can we
+		 * remove the "timer_ack" code here and the
+		 * corresponding setup in check_timer, or do NMI
+		 * watchdogs still need this?
 		 */
 		spin_lock(&i8259A_lock);
 		outb(0x0c, PIC_MASTER_OCW3);


-- 
Tim Mann  work: [email protected]  home: [email protected]
          http://www.vmware.com  http://tim-mann.org
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux