linux-2.4.31_timer-change_A0
RFC 1/1 linux-2.4.31_timer-change_A0
Linus, Alan, all,
Just wanted to submit for comment a first pass at breaking uparch/i386/kernel/time.c into various timer_pit, timer_tsc chunks. The hope is to cleanup the existing code so it doesn't care what type of clock is providing the high-resolution offset for gettimeofday. This will also simplify adding support for my cyclone-timer patch as well as ACPI pm timer or any other high res counter.
Right now I've just taken the existing code put all TSC releated code into one file, all PIT related code into another, and created struct timer_ops that provides a generic interface. I've avoided making any changes to the actual code, so its as transparent a change as possible. I plan further cleanups to better separate the pit/tsc hardware initialization from the pit/tsc timer initialization, as well as properly moving the credits to be with their now-long-lost code.
It compiles and boots, but I've not caught all the corner cases (if init_tsc bombs due to calibrate_tsc failing, we don't properly fall back to the PIT), but this fleshes out how I'm moving the code around and should give everyone an idea of where I'm going.
Let me know what you think.
thanks
-john
arch/i386/kernel/Makefile +2 -2
@@ -6,12 +6,12 @@ O_TARGET := kernel.o -export-objs := mca.o msr.o i386_ksyms.o time.o +export-objs := mca.o msr.o i386_ksyms.o time.o timer_pit.o obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \ ptrace.o i8259.o ioport.o ldt.o setup.o time.o sys_i386.o \ pci-dma.o i386_ksyms.o i387.o bluesmoke.o dmi_scan.o \ - bootflag.o + bootflag.o timer_pit.o timer_tsc.o obj-y += cpu/ obj-$(CONFIG_MCA) += mca.o
arch/i386/kernel/time.c +13 -334
409 lines not on this page · raw message
arch/i386/kernel/timer_pit.c new file +180 -0
180 lines not on this page · raw message
arch/i386/kernel/timer_tsc.c new file +212 -0
212 lines not on this page · raw message
include/asm-i386/timer.h new file +16 -0
@@ -0,0 +1,16 @@ + +#ifndef _ASMi386_TIMER_H +#define _ASMi386_TIMER_H + +struct timer_opts { +int (*init)(void ); +void (*mark_offset)(void ); +unsigned long (*get_offset)(void ); +}; + +#define TICK_SIZE tick + +extern struct timer_opts timer_pit; +extern struct timer_opts timer_tsc; + +#endif
Quoted 7 lines · john stultz
Right now I've just taken the existing code put all TSC releated code into one file, all PIT related code into another, and created struct
timer_opsthat provides a generic interface. I've avoided making any changes to the actual code, so its as transparent a change as possible. I plan further cleanups to better separate the pit/tsc hardware initialization from the pit/tsc timer initialization, as well as properly moving the credits to be with their now-long-lost code.
Oh yes, credits to Alan for suggesting it all get wrapped up w/ timer_ops.
-john