new timeofday core subsystem
Subsystems (5)
RFC PATCH 1/6 new timeofday core subsystem
All,
I've been busy splitting out the NTP changes from the core timeofday
patch, in order to reduce the patch size and avoid any features vs cleanups confusion. Hopefully this will lead to a more productive discussion of the proposed changes.
However with OLS upon us, I figured I resend this out to just sync up with others who have been testing my patches. Unfortunately it is still a fairly large chunk of code, but I do intend to split this up more and address the 64bit issues brought up the last time I sent this out. But this will have to do for now since I'll unlikely be sending any patches next week.
In the rush in preparing for OLS I really haven't had a chance to test this beyond compiling it, so tread lightly.
Now that that is out of the way, here is the patch:
With the goal to simplify, streamline and consolidate the time-of-day infrastructure, I propose the following common implementation across all arches. This will allow generic bugs to be fixed once, reduce code duplication, and with many architectures sharing the same time source, this allows drivers to be written once for multiple architectures. Additionally it will better delineate the lines between the soft-timer subsystem and the time-of-day subsystem, opening the door for more flexible and better soft-timer management.
Features of this design:
========================
o Splits time of day management from timer interrupts
o Consolidates a large amount of code
o Generic algorithms which use time-source drivers chosen at runtime
o More consistent and readable code
For another description on the rework, see here:
http://lwn.net/Articles/120850/ (Many thanks to the LWN team for that easy to understand writeup!)
This patch implements the architecture independent portion of the new time of day subsystem. Included below is timeofday.c (which includes all the time of day management and accessor functions), timesource.c (for timesource specific management functions), interface definition .h files, the example jiffies timesource (lowest common denominator time source, mainly for use as example code) and minimal hooks into arch independent code.
This patch applies ontop of my timeofday-ntp cleanup patchset.
The patch does nothing without at least minimal architecture specific hooks (i386, x86-64 and other architecture examples to follow), and it should be able to be applied to a tree without affecting the existing code.
Finally I'd like to thank the following people who have contributed ideas, criticism, testing and code that has helped shape this work:
George Anzinger, Nish Aravamudan, Max Asbock, Dominik Brodowski, Darren
Hart, Christoph Lameter, Matt Mackal, Keith Mannthey, Martin Schwidefsky, Frank Sorenson, Ulrich Windl, Darrick Wong, Roman Zippel and any others whom I've accidentally forgotten.
thanks
-john
linux-2.6.13-rc3_timeofday-core_B4.patch
============================================
Documentation/kernel-parameters.txt +6 -1
@@ -52,6 +52,7 @@ restrictions referred to are that the re MTD MTD support is enabled. NET Appropriate network support is enabled. NUMA NUMA support is enabled. + NEW_TOD The new timeofday code is enabled. NFS Appropriate NFS support is enabled. OSS OSS sound support is enabled. PARIDE The ParIDE subsystem is enabled.
@@ -309,7 +310,7 @@ running once the system is up. Default value is set via a kernel config option. Value can be changed at runtime via /selinux/checkreqprot. - clock= [BUGS=IA-32, HW] gettimeofday timesource override. + clock= [BUGS=IA-32, HW] gettimeofday timesource override. [Deprecated] Forces specified timesource (if avaliable) to be used when calculating gettimeofday(). If specicified timesource is not avalible, it defaults to PIT.
@@ -1442,6 +1443,10 @@ running once the system is up. time Show timing data prefixed to each printk message line + timesource= [NEW_TOD] Override the default timesource + Override the default timesource and use the timesource + with the name specified. + tipar.timeout= [HW,PPT] Set communications timeout in tenths of a second (default 15).
drivers/Makefile +1 -0
@@ -65,3 +65,4 @@ obj-$(CONFIG_INFINIBAND) += infiniband/ obj-$(CONFIG_SGI_IOC4) += sn/ obj-y += firmware/ obj-$(CONFIG_CRYPTO) += crypto/ +obj-$(CONFIG_NEWTOD) += timesource/
drivers/char/hangcheck-timer.c +5 -0
@@ -49,6 +49,7 @@#include <linux/delay.h> #include <asm/uaccess.h> #include <linux/sysrq.h> +#include <linux/timeofday.h> #define VERSION_STR "0.9.0"
@@ -130,8 +131,12 @@ __setup("hcheck_dump_tasks", hangcheck_p#endif #ifdef HAVE_MONOTONIC +#ifndef CONFIG_NEWTOD extern unsigned long long monotonic_clock (void );#else +#define monotonic_clock () do_monotonic_clock() +#endif +#else static inline unsigned long long monotonic_clock (void ) {# ifdef __s390__
drivers/timesource/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y += jiffies.o
drivers/timesource/jiffies.c new file +69 -0
69 lines not on this page · raw message
include/asm-generic/timeofday.h new file +26 -0
@@ -0,0 +1,26 @@ +/* linux/include/asm-generic/timeofday.h +* +* This file contains the asm-generic interface +* to the arch specific calls used by the time of day subsystem +*/ +#ifndef _ASM_GENERIC_TIMEOFDAY_H +#define _ASM_GENERIC_TIMEOFDAY_H +#include <linux/types.h> +#include <linux/time.h> +#include <linux/timex.h> +#include <asm/div64.h> +#ifdef CONFIG_NEWTOD + +/* Required externs */ +extern nsec_t read_persistent_clock (void ); +extern void sync_persistent_clock (struct timespec ts); + +#ifdef CONFIG_NEWTOD_VSYSCALL +extern void arch_update_vsyscall_gtod (nsec_t wall_time,cycle_t offset_base, +struct timesource_t * timesource,int ntp_adj); +#else +#define arch_update_vsyscall_gtod (x,y,z,w) {} +#endif /* CONFIG_NEWTOD_VSYSCALL */ + +#endif /* CONFIG_NEWTOD */ +#endif
include/linux/ntp.h +0 -7
@@ -9,9 +9,6 @@#include <linux/time.h> #include <linux/timex.h> -/* Required to safely shift negative values */ -#define shiftR (x,s) (x < 0) ? (-((-x) >> (s))) : ((x) >> (s)) -/* NTP state machine interfaces */ void ntp_advance (unsigned long interval_nsec);int ntp_adjtimex (struct timex *);
@@ -20,8 +17,4 @@ void ntp_clear(void);int ntp_synced (void );long ntp_get_adjustment (void ); -/* these variables cannot be made static just yet */ -extern int tickadj; -extern long ntp_adjtime_offset; -#endif
include/linux/time.h +4 -0
@@ -27,6 +27,10 @@ struct timezone {#ifdef __KERNEL__ +/* timeofday base types */ +typedef u64 nsec_t ; +typedef u64 cycle_t ; +/* Parameters used to convert the timespec values */ #ifndef USEC_PER_SEC #define USEC_PER_SEC (1000000L)
include/linux/timeofday.h new file +59 -0
59 lines not on this page · raw message
include/linux/timesource.h new file +172 -0
172 lines not on this page · raw message
include/linux/timex.h +3 -0
@@ -227,6 +227,8 @@ struct timex {extern unsigned long tick_usec;/* USER_HZ period (usec) */ extern unsigned long tick_nsec;/* ACTHZ period (nsec) */ +#ifndef CONFIG_NEWTOD +#ifdef CONFIG_TIME_INTERPOLATION #define TIME_SOURCE_CPU 0
@@ -281,6 +283,7 @@ time_interpolator_reset(void) }#endif /* !CONFIG_TIME_INTERPOLATION */ +#endif /* !CONFIG_NEWTOD */ #endif /* KERNEL */
init/main.c +2 -0
@@ -47,6 +47,7 @@#include <linux/rmap.h> #include <linux/mempolicy.h> #include <linux/key.h> +#include <linux/timeofday.h> #include <asm/io.h> #include <asm/bugs.h>
@@ -474,6 +475,7 @@ asmlinkage void __init start_kernel(voidpidhash_init ();init_timers ();softirq_init (); +timeofday_init ();time_init ();/*
kernel/Makefile +1 -0
@@ -9,6 +9,7 @@ obj-y = sched.o fork.o exec_domain.o rcupdate.o intermodule.o extable.o params.o posix-timers.o \ kthread.o wait.o kfifo.o sys_ni.o posix-cpu-timers.o ntp.o +obj-$(CONFIG_NEWTOD) += timeofday.o timesource.o ntp.o obj-$(CONFIG_FUTEX) += futex.o obj-$(CONFIG_GENERIC_ISA_DMA) += dma.o obj-$(CONFIG_SMP) += cpu.o spinlock.o
kernel/ntp.c +53 -30
181 lines not on this page · raw message
kernel/time.c +18 -0
@@ -39,6 +39,7 @@#include <asm/uaccess.h> #include <asm/unistd.h> +#include <linux/timeofday.h> /* * The timezone where the local system is located. Used as a default by some
@@ -129,6 +130,7 @@ asmlinkage long sys_gettimeofday(struct* as real UNIX machines always do it. This avoids all headaches about * daylight saving times and warping kernel clocks. */ +#ifndef CONFIG_NEWTOD inline static void warp_clock (void ) {write_seqlock_irq (&xtime_lock);
@@ -138,6 +140,18 @@ inline static void warp_clock(void)write_sequnlock_irq (&xtime_lock); clock_was_set(); } +#else /* !CONFIG_NEWTOD */ +/* XXX - this is somewhat cracked out and should +be checked [email protected] +*/ +inline static void warp_clock (void ) +{ +struct timespec ts; +getnstimeofday (&ts); + ts.tv_sec += sys_tz.tz_minuteswest *60 ; +do_settimeofday (&ts); +} +#endif /* !CONFIG_NEWTOD */ /* * In case for some reason the CMOS clock has not already been running
@@ -214,6 +228,7 @@ void __attribute__ ((weak)) notify_arch_/* adjtimex mainly allows reading (and writing, if superuser) of * kernel time-keeping variables. used by xntpd. */ +#ifndef CONFIG_NEWTOD int do_adjtimex (struct timex *txc) {int result;
@@ -232,6 +247,7 @@ int do_adjtimex(struct timex *txc)notify_arch_cmos_timer (); return(result); } +#endif /* !CONFIG_NEWTOD */ asmlinkage long sys_adjtimex (struct timex __user *txc_p) {
@@ -378,6 +394,7 @@ EXPORT_SYMBOL(do_gettimeofday);#else +#ifndef CONFIG_NEWTOD /* * Simulate gettimeofday using do_gettimeofday which only allows a timeval * and therefore only yields usec accuracy
@@ -390,6 +407,7 @@ void getnstimeofday(struct timespec *tv) tv->tv_sec = x.tv_sec; tv->tv_nsec = x.tv_usec *NSEC_PER_USEC ; } +#endif /* !CONFIG_NEWTOD */ #endif #if (BITS_PER_LONG <64 )
kernel/timeofday.c new file +568 -0
568 lines not on this page · raw message
kernel/timer.c +4 -0
@@ -598,6 +598,7 @@ struct timespec wall_to_monotonic __attrEXPORT_SYMBOL (xtime); +#ifndef CONFIG_NEWTOD /* in the NTP reference this is called "hardclock()" */ static void update_wall_time_one_tick (void ) {
@@ -645,6 +646,9 @@ static void update_wall_time(unsigned lo } }while (ticks); } +#else /* !CONFIG_NEWTOD */ +#define update_wall_time (x) +#endif /* !CONFIG_NEWTOD */ /* * Called from the timer interrupt handler to charge one tick to the current
kernel/timesource.c new file +259 -0
259 lines not on this page · raw message
PATCH 2/7 new timeofday i386 arch specific changes, part 1 (v. B4)
All,
The conversion of i386 to use the new timeofday subsystem has been
split into 4 parts. This patch, the first of four, is just a simple cleanup for the i386 arch in preperation of moving the the new timeofday infrastructure. It simply moves some code from timer_pit.c to i8259.c.
It applies on top of my timeofday-core patch. This patch is part the timeofday-arch-i386 patchset, so without the following parts it is not expected to compile (although just this one should).
thanks
-john
linux-2.6.13-rc3_timeofday-arch-i386-part1_B4.patch
============================================
arch/i386/kernel/i8259.c +40 -0
@@ -24,6 +24,7 @@#include <asm/apic.h> #include <asm/arch_hooks.h> #include <asm/i8259.h> +#include <asm/i8253.h> #include <linux/irq.h>
@@ -399,6 +400,45 @@ void __init init_ISA_irqs (void) } } +void setup_pit_timer (void ) +{ +unsigned long flags; + +spin_lock_irqsave (&i8253_lock, flags); +outb_p (0x34 ,PIT_MODE );/* binary, mode 2, LSB/MSB, ch 0 */ +udelay (10 ); +outb_p (LATCH &0xff ,PIT_CH0 );/* LSB */ +udelay (10 ); +outb (LATCH >>8 ,PIT_CH0 );/* MSB */ +spin_unlock_irqrestore (&i8253_lock, flags); +} + +static int timer_resume (struct sys_device *dev) +{ +setup_pit_timer (); +return 0 ; +} + +static struct sysdev_class timer_sysclass = { +set_kset_name ("timer_pit" ), + .resume = timer_resume, +}; + +static struct sys_device device_timer = { + .id =0 , + .cls = &timer_sysclass, +}; + +static int __init init_timer_sysfs (void ) +{ +int error =sysdev_class_register (&timer_sysclass); +if (!error) + error =sysdev_register (&device_timer); +return error; +} + +device_initcall (init_timer_sysfs); +void __init init_IRQ (void ) {int i;
arch/i386/kernel/timers/timer_pit.c +0 -40
@@ -162,43 +162,3 @@ struct init_timer_opts __initdata timer_ .init = init_pit, .opts = &timer_pit, }; - -void setup_pit_timer (void ) -{ -unsigned long flags; - -spin_lock_irqsave (&i8253_lock, flags); -outb_p (0x34 ,PIT_MODE );/* binary, mode 2, LSB/MSB, ch 0 */ -udelay (10 ); -outb_p (LATCH &0xff ,PIT_CH0 );/* LSB */ -udelay (10 ); -outb (LATCH >>8 ,PIT_CH0 );/* MSB */ -spin_unlock_irqrestore (&i8253_lock, flags); -} - -static int timer_resume (struct sys_device *dev) -{ -setup_pit_timer (); -return 0 ; -} - -static struct sysdev_class timer_sysclass = { -set_kset_name ("timer_pit" ), - .resume = timer_resume, -}; - -static struct sys_device device_timer = { - .id =0 , - .cls = &timer_sysclass, -}; - -static int __init init_timer_sysfs (void ) -{ -int error =sysdev_class_register (&timer_sysclass); -if (!error) - error =sysdev_register (&device_timer); -return error; -} - -device_initcall (init_timer_sysfs); -
RFC PATCH 3/6 new timeofday i386 arch specific changes, part 2 (v. B4)
All,
The conversion of i386 to use the new timeofday subsystem has been
split into 4 parts. This patch, the second of four, is a cleanup patch for the i386 arch in preperation of moving the the new timeofday infrastructure. It moves some code from timer_tsc.c to a new tsc.c file.
It applies on top of my timeofday-arch-i386-part1 patch. This patch is part the timeofday-arch-i386 patchset, so without the following parts it is not expected to compile.
thanks
-john
linux-2.6.13-rc3_timeofday-arch-i386-part2_B4.patch
============================================
arch/i386/kernel/Makefile +1 -1
@@ -7,7 +7,7 @@ extra-y := head.o init_task.o vmlinux.ld obj-y := process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \ ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \ pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \ - doublefault.o quirks.o + doublefault.o quirks.o tsc.o obj-y += cpu/ obj-y += timers/
arch/i386/kernel/timers/common.c +0 -84
93 lines not on this page · raw message
arch/i386/kernel/timers/timer_tsc.c +0 -194
224 lines not on this page · raw message
arch/i386/kernel/tsc.c new file +298 -0
298 lines not on this page · raw message
RFC PATCH 4/6 new timeofday i386 arch specific changes, part 3 (v.B4)
All,
The conversion of i386 to use the new timeofday subsystem has been
split into 4 parts. This patch, the third of four, reworks some of the code in the new tsc.c file. Additionally it adds some new interfaces and hooks to use these new interfaces appropriately. This patch also renames some ACPI PM variables.
It applies on top of my timeofday-arch-i386-part2 patch. This patch is part the timeofday-arch-i386 patchset, so without the following parts it is not expected to compile.
thanks
-john
linux-2.6.13-rc3_timeofday-arch-i386-part3_B4.patch
============================================
arch/i386/kernel/acpi/boot.c +6 -5
@@ -633,7 +633,8 @@ static int __init acpi_parse_hpet(unsign#endif #ifdef CONFIG_X86_PM_TIMER -extern u32 pmtmr_ioport; +u32 acpi_pmtmr_ioport; +int acpi_pmtmr_buggy;#endif static int __init acpi_parse_fadt (unsigned long phys,unsigned long size)
@@ -664,13 +665,13 @@ static int __init acpi_parse_fadt(unsignif (fadt->xpm_tmr_blk.address_space_id !=ACPI_ADR_SPACE_SYSTEM_IO )return 0 ; - pmtmr_ioport = fadt->xpm_tmr_blk.address; + acpi_pmtmr_ioport = fadt->xpm_tmr_blk.address; }else {/* FADT rev. 1 */ - pmtmr_ioport = fadt->V1_pm_tmr_blk; + acpi_pmtmr_ioport = fadt->V1_pm_tmr_blk; } -if (pmtmr_ioport) - printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", pmtmr_ioport); +if (acpi_pmtmr_ioport) + printk(KERN_INFO PREFIX "PM-Timer IO Port: %#x\n", acpi_pmtmr_ioport);#endif return 0 ; }
arch/i386/kernel/setup.c +1 -0
@@ -1610,6 +1610,7 @@ void __init setup_arch(char **cmdline_p) conswitchp = &dummy_con;#endif #endif +tsc_init (); }#include "setup_arch_post.h"
arch/i386/kernel/tsc.c +99 -92
298 lines not on this page · raw message
drivers/acpi/processor_idle.c +4 -0
@@ -164,6 +164,7 @@ acpi_processor_power_activate (return ; } +extern void tsc_c3_compensate (unsigned long usecs);static atomic_t c3_cpu_count;
@@ -332,6 +333,9 @@ static void acpi_processor_idle (void)acpi_set_register (ACPI_BITREG_ARB_DISABLE ,0 ,ACPI_MTX_DO_NOT_LOCK ); } +/* compensate for TSC pause */ +tsc_c3_compensate ((((t2-t1)&0xFFFFFF )*286 )>>10 ); +/* Re-enable interrupts */ local_irq_enable ();/* Compute time (ticks) that we were actually asleep */
include/asm-i386/mach-default/mach_timer.h +3 -1
@@ -15,7 +15,9 @@#ifndef _MACH_TIMER_H#define _MACH_TIMER_H -#define CALIBRATE_LATCH (5 * LATCH) +#define CALIBRATE_TIME_MSEC 30/* 30 msecs */ +#define CALIBRATE_LATCH \ + ((CLOCK_TICK_RATE * CALIBRATE_TIME_MSEC + 1000/2)/1000)static inline void mach_prepare_counter (void ) {
include/asm-i386/mach-summit/mach_mpparse.h +2 -0
@@ -30,6 +30,7 @@ static inline int mps_oem_check(struct m (!strncmp(productid, "VIGIL SMP", 9) || !strncmp(productid, "EXA", 3) || !strncmp(productid, "RUTHLESS SMP", 12))){ +mark_tsc_unstable (); use_cyclone =1 ;/*enable cyclone-timer*/ setup_summit (); usb_early_handoff =1 ;
@@ -44,6 +45,7 @@ static inline int acpi_madt_oem_check(chif (!strncmp (oem_id,"IBM" ,3 ) && (!strncmp (oem_table_id,"SERVIGIL" ,8 ) || !strncmp (oem_table_id,"EXA" ,3 ))){ +mark_tsc_unstable (); use_cyclone =1 ;/*enable cyclone-timer*/ setup_summit (); usb_early_handoff =1 ;
include/asm-i386/timex.h +1 -33
@@ -8,6 +8,7 @@#include <linux/config.h> #include <asm/processor.h> +#include <asm/tsc.h> #ifdef CONFIG_X86_ELAN # define CLOCK_TICK_RATE 1189200/* AMD Elan has different frequency! */
@@ -16,39 +17,6 @@#endif -/* -* Standard way to access the cycle counter on i586+ CPUs. -* Currently only used on SMP. -* -* If you really have a SMP machine with i486 chips or older, -* compile for that, and this will just always return zero. -* That's ok, it just means that the nicer scheduling heuristics -* won't work for you. -* -* We only use the low 32 bits, and we'd simply better make sure -* that we reschedule before that wraps. Scheduling at least every -* four billion cycles just basically sounds like a good idea, -* regardless of how fast the machine is. -*/ -typedef unsigned long long cycles_t ; - -static inline cycles_t get_cycles (void ) -{ -unsigned long long ret=0 ; - -#ifndef CONFIG_X86_TSC -if (!cpu_has_tsc) -return 0 ; -#endif - -#if defined(CONFIG_X86_GENERIC ) || defined(CONFIG_X86_TSC ) -rdtscll (ret); -#endif -return ret; -} - -extern unsigned int cpu_khz; -extern int read_current_timer (unsigned long *timer_value);#define ARCH_HAS_READ_CURRENT_TIMER 1
include/asm-i386/tsc.h new file +50 -0
50 lines not on this page · raw message
RFC PATCH 5/6 new timeofday i386 arch specific changes, part 4 (v. B4)
All,
The conversion of i386 to use the new timeofday subsystem has been
split into 4 parts. This patch, the final of four, converts the i386 arch to use the new timeofday subsystem and removes the old timers/timer_opts infrastructure.
It applies on top of my timeofday-arch-i386-part3 patch. This patch is the last in the the timeofday-arch-i386 patchset, so you should be able to build and boot a kernel after it has been applied.
Note that this patch does not provide any i386 timesources, so you will only have the jiffies timesource. To get full replacements for the code being removed here, the following timeofday-timesources-i386 patch will need to be applied.
thanks
-john
linux-2.6.13-rc3_timeofday-arch-i386-part4_B4.patch
============================================
arch/i386/Kconfig +4 -0
@@ -14,6 +14,10 @@ config X86 486, 586, Pentiums, and various instruction-set-compatible chips by AMD, Cyrix, and others. +config NEWTOD + bool + default y + config MMU bool default y
arch/i386/kernel/Makefile +0 -1
@@ -10,7 +10,6 @@ obj-y := process.o semaphore.o signal.o doublefault.o quirks.o tsc.o obj-y += cpu/ -obj-y += timers/ obj-$(CONFIG_ACPI_BOOT) += acpi/ obj-$(CONFIG_X86_BIOS_REBOOT) += reboot.o obj-$(CONFIG_MCA) += mca.o
arch/i386/kernel/time.c +34 -179
311 lines not on this page · raw message
arch/i386/kernel/timers/Makefile deleted +0 -9
@@ -1,9 +0,0 @@ -# -# Makefile for x86 timers -# - -obj-y := timer.o timer_none.o timer_tsc.o timer_pit.o common.o - -obj-$(CONFIG_X86_CYCLONE_TIMER) += timer_cyclone.o -obj-$(CONFIG_HPET_TIMER) += timer_hpet.o -obj-$(CONFIG_X86_PM_TIMER) += timer_pm.o
arch/i386/kernel/timers/common.c deleted +0 -88
88 lines not on this page · raw message
arch/i386/kernel/timers/timer.c deleted +0 -75
75 lines not on this page · raw message
arch/i386/kernel/timers/timer_cyclone.c deleted +0 -259
259 lines not on this page · raw message
arch/i386/kernel/timers/timer_hpet.c deleted +0 -195
195 lines not on this page · raw message
arch/i386/kernel/timers/timer_none.c deleted +0 -39
@@ -1,39 +0,0 @@ -#include <linux/init.h> -#include <asm/timer.h> - -static void mark_offset_none (void ) -{ -/* nothing needed */ -} - -static unsigned long get_offset_none (void ) -{ -return 0 ; -} - -static unsigned long long monotonic_clock_none (void ) -{ -return 0 ; -} - -static void delay_none (unsigned long loops) -{ -int d0; - __asm__ __volatile__( -"\tjmp 1f\n" -".align 16\n" -"1:\tjmp 2f\n" -".align 16\n" -"2:\tdecl %0\n\tjns 2b" - :"=&a" (d0) - :"0" (loops)); -} - -/* none timer_opts struct */ -struct timer_opts timer_none = { - .name ="none" , - .mark_offset = mark_offset_none, - .get_offset = get_offset_none, - .monotonic_clock = monotonic_clock_none, - .delay = delay_none, -};
arch/i386/kernel/timers/timer_pit.c deleted +0 -164
164 lines not on this page · raw message
arch/i386/kernel/timers/timer_pm.c deleted +0 -259
259 lines not on this page · raw message
arch/i386/kernel/timers/timer_tsc.c deleted +0 -387
387 lines not on this page · raw message
arch/i386/lib/delay.c +13 -3
@@ -13,6 +13,7 @@#include <linux/config.h> #include <linux/sched.h> #include <linux/delay.h> +#include <linux/timeofday.h> #include <linux/module.h> #include <asm/processor.h> #include <asm/delay.h>
@@ -22,11 +23,20 @@#include <asm/smp.h> #endif -extern struct timer_opts * timer; - +/* XXX - For now just use a simple loop delay +* This has cpufreq issues, but so did the old method. +*/ void __delay (unsigned long loops) { - cur_timer->delay (loops); +int d0; + __asm__ __volatile__( +"\tjmp 1f\n" +".align 16\n" +"1:\tjmp 2f\n" +".align 16\n" +"2:\tdecl %0\n\tjns 2b" + :"=&a" (d0) + :"0" (loops)); }inline void __const_udelay (unsigned long xloops)
include/asm-i386/timeofday.h new file +4 -0
@@ -0,0 +1,4 @@ +#ifndef _ASM_I386_TIMEOFDAY_H +#define _ASM_I386_TIMEOFDAY_H +#include <asm-generic/timeofday.h> +#endif
include/asm-i386/timer.h +0 -55
66 lines not on this page · raw message
RFC PATCH 6/6 new timeofday i386 specific timesources
All,
This patch implements the time sources shared between i386 acpi_pm,
cyclone, hpet, pit, tsc and tsc-interp). The patch should apply on top of the timeofday-arch-i386-part4 patch.
The patch should be fairly straight forward, only adding the new timesources.
thanks
-john
linux-2.6.13-rc3_timeofday-timesources-i386_B4.patch
============================================
drivers/timesource/Makefile +7 -0
@@ -1 +1,8 @@ obj-y += jiffies.o + +obj-$(CONFIG_X86) += tsc.o +obj-$(CONFIG_X86) += i386_pit.o +obj-$(CONFIG_X86) += tsc-interp.o +obj-$(CONFIG_X86_CYCLONE_TIMER) += cyclone.o +obj-$(CONFIG_X86_PM_TIMER) += acpi_pm.o +obj-$(CONFIG_HPET_TIMER) += hpet.o
drivers/timesource/acpi_pm.c new file +152 -0
152 lines not on this page · raw message
drivers/timesource/cyclone.c new file +138 -0
138 lines not on this page · raw message
drivers/timesource/hpet.c new file +59 -0
59 lines not on this page · raw message
drivers/timesource/i386_pit.c new file +64 -0
64 lines not on this page · raw message
drivers/timesource/tsc-interp.c new file +112 -0
112 lines not on this page · raw message
drivers/timesource/tsc.c new file +83 -0
83 lines not on this page · raw message
Re: [PATCH 2/7] new timeofday i386 arch specific changes, part 1 (v. B4)
In reply to john stultzSorry about that, the subject should have been:
[RFC][PATCH 2/6] new timeofday i386 arch specific changes, part 1 (v. B4)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 1 line
+extern
nsec_tdo_monotonic_clock(void);
This looks okay ...
Quoted 11 lines
kernel/timeofday.c new file +11
-0+/** +* do_monotonic_clock - Returns monotonically increasing nanoseconds +* +* Returns the monotonically increasing number of nanoseconds +* since the system booted via __monotonic_clock() +*/ +nsec_t do_monotonic_clock (void ) +{ +nsec_t ret; +unsigned long seq; +
kernel/timeofday.c line 216
Quoted 10 lines
kernel/timeofday.c new file +10
-0+/* atomically read __monotonic_clock() */ +do { + seq =read_seqbegin (&system_time_lock); + + ret =__monotonic_clock (); + + }while (read_seqretry (&system_time_lock, seq)); + +return ret; +}
... but this conflicts with Nish's softtimer patches, which is implemented slightly differently. For those of us who are real gluttons for punishment, and want both sets of patches, are there problems just removing one of the do_monotonic_clock definitions?
Thanks,
Frank
- --
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
[email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFC2MYNaI0dwg4A47wRAiQoAJ9vUvpjE7KmhCNW7NJ6kfd0SuyvXwCg+NtN pXqoz0v5Tbf5OMFjhYSzPp0=
=LT9E
-----END PGP SIGNATURE-----
Quoted 25 lines · Frank Sorenson
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 1 line
+extern
nsec_tdo_monotonic_clock(void);This looks okay ...
Quoted 18 lines
kernel/timeofday.c new file +18
-0+/** +* do_monotonic_clock - Returns monotonically increasing nanoseconds +* +* Returns the monotonically increasing number of nanoseconds +* since the system booted via __monotonic_clock() +*/ +nsec_t do_monotonic_clock (void ) +{ +nsec_t ret; +unsigned long seq; + +/* atomically read __monotonic_clock() */ +do { + seq =read_seqbegin (&system_time_lock); + + ret =__monotonic_clock (); + + }while (read_seqretry (&system_time_lock, seq));
Quoted 8 lines
drivers/timesource/jiffies.c line 52
Quoted 3 lines
drivers/timesource/jiffies.c new file +3
-0+ +return ret; +}... but this conflicts with Nish's softtimer patches, which is implemented slightly differently. For those of us who are real gluttons for punishment, and want both sets of patches, are there problems just removing one of the
do_monotonic_clockdefinitions?
No, in fact, that would be expected. If you are going to apply John's patches and mine, then you can remove the definition I put in time.c (technically, I probably should have put that definition in a #ifndef CONFIG_NEWTOD/#endif block).
My version is basically a non-NEWTOD attempt to get nanosecond uptime. But, if you have John's timesources, then use them :)
Thanks,
Nish
New timeofday subsystem: Lockups
In reply to john stultz-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John, Nish, others:
I'm not sure whether this is an issue with John's TOD patches, John's NTP rework, or Nish's softtimer patches, but something in this combination seems to be locking up my system frequently. Often, it will completely hang during boot, and it periodically hangs while starting X or even just under normal (unstressed) use.
During several of the boot-ups, the NMI Watchdog has caught lockups. Here is the output of one of those lockups (hand-copied, so hopefully no mistakes):
NMI Watchdog detected LOCKUP on CPU0, eip c01248bb, registers:
Modules linked in: ipw2200 ieee80211 ieee80211_crypt
CPU: 0
EIP: 0060:[<c01248bb>] Not tainted VLI
EFLAGS: 00000046 (2.6.13-rc3-skas3-v9-pre7-fs6)
EIP is at get_jiffies_64+0x2b/0x40
eax: 00000000 ebx: ffbf503 ecx: 00011c84 edx: 00000000
esi: 00000000 edi: 00000000 ebp: c05cba00 esp: c065ff00
ds: 007b es: 007b ss: 0068
Process swapper (pid: 0, threadinfo=c065f000 task=c0552b80)
Stack: 000094ad 000088e3 c03b01d7 c06aca50 c0330d90 67347457 0000000c
000088e1
00000000 c0558080 c065f000 f7c42de4 00000000 00000082 c05cba00
c013e908
c06ac9c0 00000080 00000aa2 00000aa2 fffb7e00 f7c42de4 00000000
00000082
Call Trace:
[<c03b01d7>] read_tsc_interp+0x17/0x120
[<c0330d90>] __ide_do_rw_disk+0x200/0540
[<c013e908>] do_monotonic_clock+0x28/0x130
[<c01283e6>] add_timer+0x16/0x60
[<c0328738>] ide_set_handler+0x28/0x60
[<c032c7df>] task_in_intr+0x4f/0x100
[<c0327405>] ide_intr+0x95/0x1d0
[<c032c790>] task_in_intr+0x0/0x100
[<c014cae3>] handle_IRQ_event+0x33/0x70
[<c014cbe6>] __do_IRQ+0x53/0xa0
=========================
[<c03b01d7>] read_tsc_interp+0x17/0x120
[<c0104b86>] common_interrupt+0x1a/0x20
[<c013007b>] alloc_pidmap+0x8b/0x1f0
[<c03b016f>] tsc_interp_sync+0x4f/0xa0
[<c03b0120>] tsc_interp_sync+0x0/0xa0
[<c0128884>] run_timer_softirq+0xb4/0x1d0
[<c0124912>] __do_softirq+0x42/0xa0
[<c010688e>] do_softirq+0x4e/0x60
=======================
[<c0124a35>] irq_exit+0x35/0x40
[<c010674a>] do_IRQ+0x5a/0xa0
[<c0104b86>] common_interrupt+0x1a/0x20
[<c02b16fa>] acpi_processor_idle+0x10e/0x28e
[<c0102030>] default_idle+0x0/0x30
[<c01020d4>] cpu_idle+0x34/0x50
[<c0621856>] start_kernel+0x186/0x1f0
Code: 8b 0d 64 da 68 c0 56 53 90 8d b4 26 00 00 00 00 89 c8 8b 1d 80 5e55 c0 8b 35 84 5e 55 c0 89 ca 8b 0d 64 da 68 c0 83 e2 01 31 c8 <09> c2 75 e1 89 d8 89 f2 5b 5e c3 90 90 90 90 90 90 90 90 90 90
console shuts up ...
Hopefully someone can make something out of this!
Any ideas?
Thanks,
Frank
- --
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
[email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQFC4KloaI0dwg4A47wRAiosAKD7Hn+nzJEizqKvXDaXIfXw0T+0RACgrQnF NikzhdmXzPjL0Bi2D2aBOk4=
=EN1O
-----END PGP SIGNATURE-----
Re: New timeofday subsystem: Lockups
Quoted 9 lines · Frank Sorenson
I'm not sure whether this is an issue with John's TOD patches, John's NTP rework, or Nish's softtimer patches, but something in this combination seems to be locking up my system frequently. Often, it will completely hang during boot, and it periodically hangs while starting X or even just under normal (unstressed) use.
During several of the boot-ups, the NMI Watchdog has caught lockups. Here is the output of one of those lockups (hand-copied, so hopefully no mistakes):
Thanks for the detailed bug report! Hmmm. It looks like the TSC interpolator is deadlocking. I'll try to dig in and hunt that one down (although forgive me if I don't get back to you until sometime next week).
Thanks again for the great testing and reporting!
-john