GENERIC_TIME patchset for x86_64
cover GENERIC_TIME patchset for x86_64
Andrew, Andi,
Here is the same patchset from lastnight, re-diffed against -mm
Thanks to Valdis Kletnieks for pointing out that it didn't apply.
thanks again!
-john
PATCH 1/5 vsyscall-gtod support for GENERIC_TIME
Provides generic infrastructure for vsyscall-gtod.
include/linux/clocksource.h | 8 ++++++++ kernel/timer.c | 1 + 2 files changed, 9 insertions(+)
linux-2.6.20-rc1_timeofday-vsyscall-support_C7.patch
============================================
include/linux/clocksource.h +8 -0
@@ -46,6 +46,7 @@ typedef u64 cycle_t;* @shift: cycle to nanosecond divisor (power of two) * @update_callback: called when safe to alter clocksource values * @is_continuous: defines if clocksource is free-running. +* @vread: vsyscall based read * @cycle_interval: Used internally by timekeeping core, please ignore. * @xtime_interval: Used internally by timekeeping core, please ignore. */
@@ -59,6 +60,7 @@ struct clocksource {u32 shift;int (*update_callback)(void );int is_continuous; +cycle_t (*vread)(void);/* timekeeping specific data, ignore */ cycle_t cycle_last, cycle_interval;
@@ -182,4 +184,10 @@ int clocksource_register(struct clocksouvoid clocksource_reselect (void );struct clocksource *clocksource_get_next (void ); +#ifdef CONFIG_GENERIC_TIME_VSYSCALL +extern void update_vsyscall (struct timespec *ts,struct clocksource *c); +#else +#define update_vsyscall (now, c) do { } while(0) +#endif +#endif /* _LINUX_CLOCKSOURCE_H */
kernel/timer.c +1 -0
@@ -1094,6 +1094,7 @@ #endif clock->xtime_nsec =0 ;clocksource_calculate_interval (clock, tick_nsec); } +update_vsyscall (&xtime, clock); }/*
PATCH 2/5 hpet_address cleanup
In reply to john stultzIn preparation for supporting generic timekeeping, this patch cleans up x86-64's use of vxtime.hpet_address, changing it to just hpet_address as is also used in i386. This is necessary since the vxtime structure will be going away.
arch/i386/kernel/acpi/boot.c | 23 ++++++----------------- arch/x86_64/kernel/apic.c | 3 ++- arch/x86_64/kernel/time.c | 36 +++++++++++++++++++----------------- include/asm-x86_64/hpet.h | 1 + 4 files changed, 28 insertions(+), 35 deletions(-)
linux-2.6.20-rc1_timeofday-arch-x86-64-hpet-address-cleanup_C7.patch
============================================
arch/i386/kernel/acpi/boot.c +6 -17
@@ -638,6 +638,7 @@ static int __init acpi_parse_sbf(unsigne }#ifdef CONFIG_HPET_TIMER +#include <asm/hpet.h> static int __init acpi_parse_hpet (unsigned long phys,unsigned long size) {
@@ -671,32 +672,20 @@ #define HPET_RESOURCE_NAME_SIZE 9 hpet_res->end = (1 *1024 ) -1 ; } + hpet_address = hpet_tbl->addr.addrl;#ifdef CONFIG_X86_64 - vxtime.hpet_address = hpet_tbl->addr.addrl | - ((long )hpet_tbl->addr.addrh <<32 ); - + hpet_address |= ((long )hpet_tbl->addr.addrh <<32 ); +#endif printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", - hpet_tbl->id, vxtime.hpet_address); - - res_start = vxtime.hpet_address; -#else /* X86 */ - { -extern unsigned long hpet_address; + hpet_tbl->id, hpet_address); - hpet_address = hpet_tbl->addr.addrl; - printk(KERN_INFO PREFIX "HPET id: %#x base: %#lx\n", - hpet_tbl->id, hpet_address); - - res_start = hpet_address; - } -#endif /* X86 */ + res_start = hpet_address;if (hpet_res) { hpet_res->start = res_start; hpet_res->end += res_start;insert_resource (&iomem_resource, hpet_res); } - return 0; }#else
arch/x86_64/kernel/apic.c +2 -1
@@ -37,6 +37,7 @@ #include <asm/nmi.h>#include <asm/idle.h> #include <asm/proto.h> #include <asm/timex.h> +#include <asm/hpet.h> #include <asm/apic.h> int apic_mapped;
@@ -763,7 +764,7 @@ static void setup_APIC_timer(unsigned inlocal_irq_save (flags);/* wait for irq slice */ -if (vxtime.hpet_address && hpet_use_timer) { +if (hpet_address && hpet_use_timer) {int trigger =hpet_readl (HPET_T0_CMP );while (hpet_readl (HPET_COUNTER ) >= trigger)/* do nothing */ ;
arch/x86_64/kernel/time.c +19 -17
@@ -67,6 +67,7 @@ #define US_SCALE 32 /* 2^32, arbitralrilunsigned int cpu_khz;/* TSC clocks / usec, not used here */ EXPORT_SYMBOL (cpu_khz); +unsigned long hpet_address;static unsigned long hpet_period;/* fsecs / HPET clock */ unsigned long hpet_tick;/* HPET clocks / interrupt */ int hpet_use_timer;/* Use counter of hpet for time keeping, otherwise PIT */
@@ -316,7 +317,7 @@ static noinline void handle_lost_ticks(iKERN_WARNING "Your time source seems to be instable or " "some driver is hogging interupts\n");print_symbol ("rip %s\n" ,get_irq_regs ()->rip); -if (vxtime.mode ==VXTIME_TSC && vxtime.hpet_address) { +if (vxtime.mode ==VXTIME_TSC && hpet_address) {printk (KERN_WARNING "Falling back to HPET\n" );if (hpet_use_timer) vxtime.last = hpet_readl(HPET_T0_CMP) -
@@ -324,6 +325,7 @@ static noinline void handle_lost_ticks(ielse vxtime.last =hpet_readl (HPET_COUNTER ); vxtime.mode =VXTIME_HPET ; + vxtime.hpet_address = hpet_address; do_gettimeoffset = do_gettimeoffset_hpet; }/* else should fall back to PIT, but code missing. */
@@ -354,7 +356,7 @@ void main_timer_handler(void)write_seqlock (&xtime_lock); -if (vxtime.hpet_address) +if (hpet_address) offset =hpet_readl (HPET_COUNTER );if (hpet_use_timer) {
@@ -717,7 +719,7 @@ static __init int late_hpet_init(void)struct hpet_data hd;unsigned int ntimer; -if (!vxtime.hpet_address) +if (!hpet_address)return 0 ;memset (&hd,0 ,sizeof (hd));
@@ -730,7 +732,7 @@ static __init int late_hpet_init(void)* Register with driver. * Timer0 and Timer1 is used by platform. */ - hd.hd_phys_address = vxtime.hpet_address; + hd.hd_phys_address = hpet_address; hd.hd_address = (void __iomem *)fix_to_virt (FIX_HPET_BASE ); hd.hd_nirqs = ntimer; hd.hd_flags =HPET_DATA_PLATFORM ;
@@ -799,10 +801,10 @@ static int hpet_init(void) {unsigned int id; -if (!vxtime.hpet_address) +if (!hpet_address)return -1 ; -set_fixmap_nocache (FIX_HPET_BASE , vxtime.hpet_address); -__set_fixmap (VSYSCALL_HPET , vxtime.hpet_address,PAGE_KERNEL_VSYSCALL_NOCACHE ); +set_fixmap_nocache (FIX_HPET_BASE , hpet_address); +__set_fixmap (VSYSCALL_HPET , hpet_address,PAGE_KERNEL_VSYSCALL_NOCACHE );/* * Read the period, compute tick and quotient.
@@ -856,7 +858,7 @@ void __init pit_stop_interrupt(void)void __init stop_timer_interrupt (void ) {char *name; -if (vxtime.hpet_address) { +if (hpet_address) { name ="HPET" ;hpet_timer_stop_set_go (0 ); }else {
@@ -879,8 +881,7 @@ static struct irqaction irq0 = {void __init time_init (void ) {if (nohpet) - vxtime.hpet_address =0 ; - + hpet_address =0 ; xtime.tv_sec =get_cmos_time (); xtime.tv_nsec =0 ;
@@ -890,7 +891,7 @@ void __init time_init(void)if (!hpet_init ()) vxtime_hz = (FSEC_PER_SEC + hpet_period /2 ) / hpet_period;else - vxtime.hpet_address =0 ; + hpet_address =0 ;if (hpet_use_timer) {/* set tick_nsec to use the proper rate for HPET */
@@ -898,7 +899,7 @@ void __init time_init(void) cpu_khz =hpet_calibrate_tsc (); timename ="HPET" ; #ifdef CONFIG_X86_PM_TIMER - }else if (pmtmr_ioport && !vxtime.hpet_address) { + }else if (pmtmr_ioport && !hpet_address) { vxtime_hz =PM_TIMER_FREQUENCY ; timename ="PM" ;pit_init ();
@@ -957,23 +958,24 @@ void time_init_gtod(void)if (unsynchronized_tsc ()) notsc =1 ; -if (cpu_has (&boot_cpu_data,X86_FEATURE_RDTSCP )) +if (cpu_has (&boot_cpu_data,X86_FEATURE_RDTSCP )) vgetcpu_mode =VGETCPU_RDTSCP ;else vgetcpu_mode =VGETCPU_LSL ; -if (vxtime.hpet_address && notsc) { +if (hpet_address && notsc) { timetype = hpet_use_timer ?"HPET" :"PIT/HPET" ;if (hpet_use_timer) vxtime.last =hpet_readl (HPET_T0_CMP ) - hpet_tick;else vxtime.last =hpet_readl (HPET_COUNTER ); vxtime.mode =VXTIME_HPET ; + vxtime.hpet_address = hpet_address; do_gettimeoffset = do_gettimeoffset_hpet;#ifdef CONFIG_X86_PM_TIMER /* Using PM for gettimeofday is quite slow, but we have no other choice because the TSC is too unreliable on some systems. */ - }else if (pmtmr_ioport && !vxtime.hpet_address && notsc) { + }else if (pmtmr_ioport && !hpet_address && notsc) { timetype ="PM" ; do_gettimeoffset = do_gettimeoffset_pm; vxtime.mode =VXTIME_PMTMR ;
@@ -1033,7 +1035,7 @@ static int timer_resume(struct sys_devic sleep_length =0 ; ctime = sleep_start; } -if (vxtime.hpet_address) +if (hpet_address)hpet_reenable ();else i8254_timer_resume ();
@@ -1117,7 +1119,7 @@ static unsigned int hpet_t1_cmp; /* cachint is_hpet_enabled (void ) { -return vxtime.hpet_address !=0 ; +return hpet_address !=0 ; }/*
include/asm-x86_64/hpet.h +1 -0
@@ -58,6 +58,7 @@ extern int hpet_rtc_timer_init(void);extern int apic_is_clustered_box (void );extern int hpet_use_timer; +extern unsigned long hpet_address;#ifdef CONFIG_HPET_EMULATE_RTC extern int hpet_mask_rtc_irq_bit (unsigned long bit_mask);
PATCH 3/5 Split x86_64/kernel/time.c up
In reply to john stultzIn preparation for the x86_64 generic time conversion, this patch splits out TSC and HPET related code from arch/x86_64/kernel/time.c into respective hpet.c and tsc.c files.
arch/x86_64/kernel/Makefile | 2 arch/x86_64/kernel/hpet.c | 437 ++++++++++++++++++++++++++++++ arch/x86_64/kernel/time.c | 628 -------------------------------------------- arch/x86_64/kernel/tsc.c | 201 ++++++++++++++ include/asm-x86_64/hpet.h | 6 include/asm-x86_64/timex.h | 11 6 files changed, 660 insertions(+), 625 deletions(-)
linux-2.6.20-rc1_timeofday-arch-x86-64-split-hpet-tsc-time_C7.patch
============================================
arch/x86_64/kernel/Makefile +1 -1
@@ -8,7 +8,7 @@ obj-y := process.o signal.o entry.o trap ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \ x8664_ksyms.o i387.o syscall.o vsyscall.o \ setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o \ - pci-dma.o pci-nommu.o alternative.o + pci-dma.o pci-nommu.o alternative.o hpet.o tsc.o obj-$(CONFIG_STACKTRACE) += stacktrace.o obj-$(CONFIG_X86_MCE) += mce.o therm_throt.o
arch/x86_64/kernel/hpet.c new file +438 -0
438 lines not on this page · raw message
arch/x86_64/kernel/time.c +4 -635
698 lines not on this page · raw message
arch/x86_64/kernel/tsc.c new file +209 -0
209 lines not on this page · raw message
include/asm-x86_64/hpet.h +6 -0
@@ -56,9 +56,15 @@extern int is_hpet_enabled (void );extern int hpet_rtc_timer_init (void );extern int apic_is_clustered_box (void ); +extern int hpet_arch_init (void ); +extern int hpet_timer_stop_set_go (unsigned long tick); +extern int hpet_reenable (void ); +extern unsigned int hpet_calibrate_tsc (void );extern int hpet_use_timer;extern unsigned long hpet_address; +extern unsigned long hpet_period; +extern unsigned long hpet_tick;#ifdef CONFIG_HPET_EMULATE_RTC extern int hpet_mask_rtc_irq_bit (unsigned long bit_mask);
include/asm-x86_64/timex.h +11 -0
@@ -44,6 +44,17 @@ extern unsigned int cpu_khz;extern int read_current_timer (unsigned long *timer_value);#define ARCH_HAS_READ_CURRENT_TIMER 1 +#define USEC_PER_TICK (USEC_PER_SEC / HZ) +#define NSEC_PER_TICK (NSEC_PER_SEC / HZ) +#define FSEC_PER_TICK (FSEC_PER_SEC / HZ) + +#define NS_SCALE 10/* 2^10, carefully chosen */ +#define US_SCALE 32/* 2^32, arbitralrily chosen */ +extern struct vxtime_data vxtime; +extern unsigned int do_gettimeoffset_hpet (void ); +extern unsigned int do_gettimeoffset_tsc (void ); +extern void set_cyc2ns_scale (unsigned long khz); +extern int notsc;#endif
Re: [PATCH -mm 3/5][time][x86_64] Split x86_64/kernel/time.c up
Quoted 14 lines · On Wed, 20 Dec 2006 17:13:37 -0500 john stultz <[email protected]> wrote:
arch/x86_64/kernel/hpet.c new file +14
-0+ +unsigned int __init hpet_calibrate_tsc (void ) +{ +int tsc_start, hpet_start; +int tsc_now, hpet_now; +unsigned long flags; + +local_irq_save (flags); +local_irq_disable (); + + hpet_start =hpet_readl (HPET_COUNTER ); +rdtscl (tsc_start); + + do {
arch/x86_64/kernel/hpet.c line 178
Quoted 10 lines
arch/x86_64/kernel/hpet.c new file +10
-0+local_irq_disable (); + hpet_now =hpet_readl (HPET_COUNTER ); + tsc_now =get_cycles_sync (); +local_irq_restore (flags); + }while ((tsc_now - tsc_start) <TICK_COUNT && + (hpet_now - hpet_start) <TICK_COUNT ); + +return (tsc_now - tsc_start) *1000000000L + / ((hpet_now - hpet_start) * hpet_period /1000 ); +}
What a confused function. If called with local irqs disabled it'll fail to enable interrupts in that loop. Perhaps that's deliberate, dunno.
Plus local_irq_save() disables interrupts, so the first local_irq_disable() is not needed.
I will kill the unneeded local_irq_disable() and then shall back slowly away from it.
PATCH 4/5 Convert x86_64 to use GENERIC_TIME
In reply to john stultzThis patch converts x86_64 to use the GENERIC_TIME infrastructure and adds clocksource structures for both TSC and HPET (ACPI PM is shared w/ i386).
arch/x86_64/Kconfig | 4 arch/x86_64/kernel/apic.c | 2 arch/x86_64/kernel/hpet.c | 65 ++++++++ arch/x86_64/kernel/pmtimer.c | 58 ------- arch/x86_64/kernel/smpboot.c | 1 arch/x86_64/kernel/time.c | 301 ----------------------------------------- arch/x86_64/kernel/tsc.c | 108 ++++++++------ drivers/char/hangcheck-timer.c | 2 include/asm-x86_64/proto.h | 2 include/asm-x86_64/timex.h | 5 10 files changed, 137 insertions(+), 411 deletions(-)
linux-2.6.20-rc1_timeofday-arch-x86-64-generic-time-conversion_C7.patch
============================================
arch/x86_64/Kconfig +4 -0
@@ -24,6 +24,10 @@ config X86 bool default y +config GENERIC_TIME + bool + default y + config ZONE_DMA32 bool default y
arch/x86_64/kernel/apic.c +1 -1
@@ -785,7 +785,7 @@ static void setup_APIC_timer(unsigned in/* Turn off PIT interrupt if we use APIC timer as main timer. Only works with the PM timer right now TBD fix it for HPET too. */ -if (vxtime.mode ==VXTIME_PMTMR && +if ((pmtmr_ioport !=0 ) &&smp_processor_id () == boot_cpu_id && apic_runs_main_timer ==1 && !cpu_isset (boot_cpu_id, timer_interrupt_broadcast_ipi_mask)) {
arch/x86_64/kernel/hpet.c +59 -6
74 lines not on this page · raw message
arch/x86_64/kernel/pmtimer.c +0 -58
76 lines not on this page · raw message
arch/x86_64/kernel/smpboot.c +0 -1
@@ -1181,7 +1181,6 @@ void __init smp_cpus_done(unsigned int msmp_cleanup_boot ();setup_ioapic_dest ();check_nmi_watchdog (); -time_init_gtod (); }#ifdef CONFIG_HOTPLUG_CPU
arch/x86_64/kernel/time.c +5 -294
378 lines not on this page · raw message
arch/x86_64/kernel/tsc.c +66 -42
145 lines not on this page · raw message
drivers/char/hangcheck-timer.c +1 -1
@@ -117,7 +117,7 @@ __setup("hcheck_reboot", hangcheck_parse__setup ("hcheck_dump_tasks" , hangcheck_parse_dump_tasks);#endif /* not MODULE */ -#if defined(CONFIG_X86_64 ) || defined(CONFIG_S390 ) +#if defined(CONFIG_S390 )# define HAVE_MONOTONIC # define TIMER_FREQ 1000000000ULL#elif defined(CONFIG_IA64 )
include/asm-x86_64/proto.h +0 -2
@@ -45,11 +45,9 @@ extern u32 pmtmr_ioport;#else #define pmtmr_ioport 0#endif -extern unsigned long long monotonic_base;extern int sysctl_vsyscall;extern int nohpet;extern unsigned long vxtime_hz; -extern void time_init_gtod (void );extern void early_printk (const char *fmt, ...) __attribute__((format (printf,1 ,2 )));
include/asm-x86_64/timex.h +1 -4
@@ -52,9 +52,6 @@ extern int read_current_timer(unsigned l#define US_SCALE 32/* 2^32, arbitralrily chosen */ extern struct vxtime_data vxtime; - -extern unsigned int do_gettimeoffset_hpet (void ); -extern unsigned int do_gettimeoffset_tsc (void ); +extern void mark_tsc_unstable (void );extern void set_cyc2ns_scale (unsigned long khz); -extern int notsc;#endif
Re: [PATCH -mm 4/5][time][x86_64] Convert x86_64 to use GENERIC_TIME
Quoted 3 lines · On Wed, 20 Dec 2006 17:13:43 -0500 john stultz <[email protected]> wrote:
This patch converts
x86_64to use theGENERIC_TIMEinfrastructure and adds clocksource structures for both TSC and HPET (ACPI PM is shared w/ i386).
printk timestamping shows a time of zero all the time, because nothing calls set_cyc2ns_scale() any more.
I stuck it in time_init():
arch/x86_64/kernel/time.c renamed from arch/x86_64/kernel/time.c~time-x86_64-convert-x86_64-to-use-generic_time-fix +1 -0
@@ -361,6 +361,7 @@ void __init time_init(void)else vgetcpu_mode =VGETCPU_LSL ; +set_cyc2ns_scale (cpu_khz);printk (KERN_INFO "time.c: Detected %d.%03d MHz processor.\n" , cpu_khz /1000 , cpu_khz %1000 );setup_irq (0 , &irq0);
_
PATCH 5/5 Re-enable vsyscall support for x86_64
In reply to john stultzCleanup and re-enable vsyscall gettimeofday using the generic clocksource infrastructure.
arch/x86_64/Kconfig | 4 + arch/x86_64/kernel/hpet.c | 6 + arch/x86_64/kernel/time.c | 6 - arch/x86_64/kernel/tsc.c | 7 ++ arch/x86_64/kernel/vmlinux.lds.S | 28 +++------ arch/x86_64/kernel/vsyscall.c | 121 +++++++++++++++++++++++---------------- include/asm-x86_64/proto.h | 2 include/asm-x86_64/timex.h | 1 include/asm-x86_64/vsyscall.h | 33 +--------- 9 files changed, 105 insertions(+), 103 deletions(-)
linux-2.6.20-rc1_timeofday-arch-x86-64-vsyscall-reenablement_C7.patch
============================================
arch/x86_64/Kconfig +4 -0
@@ -28,6 +28,10 @@ config GENERIC_TIME bool default y +config GENERIC_TIME_VSYSCALL + bool + default y + config ZONE_DMA32 bool default y
arch/x86_64/kernel/hpet.c +6 -0
@@ -443,6 +443,11 @@ static cycle_t read_hpet(void)return (cycle_t )readl (hpet_ptr); } +static cycle_t __vsyscall_fn vread_hpet(void) +{ +return (cycle_t )readl ((void *)fix_to_virt (VSYSCALL_HPET ) +0xf0 ); +} +struct clocksource clocksource_hpet = { .name ="hpet" , .rating =250 ,
@@ -451,6 +456,7 @@ struct clocksource clocksource_hpet = { .mult = 0, /* set below */ .shift = HPET_SHIFT, .is_continuous = 1, + .vread = vread_hpet, };static int __init init_hpet_clocksource (void )
arch/x86_64/kernel/time.c +0 -6
@@ -53,13 +53,7 @@ DEFINE_SPINLOCK(rtc_lock);EXPORT_SYMBOL (rtc_lock);DEFINE_SPINLOCK (i8253_lock); -unsigned long vxtime_hz =PIT_TICK_RATE ; - -struct vxtime_data __vxtime __section_vxtime; /* for vsyscalls */ -volatile unsigned long __jiffies __section_jiffies =INITIAL_JIFFIES ; -struct timespec __xtime __section_xtime; -struct timezone __sys_tz __section_sys_tz;unsigned long profile_pc (struct pt_regs *regs) {
arch/x86_64/kernel/tsc.c +7 -0
@@ -193,6 +193,12 @@ static cycle_t read_tsc(void)return ret; } +static cycle_t __vsyscall_fn vread_tsc(void) +{ +cycle_t ret = (cycle_t )get_cycles_sync (); +return ret; +} +static struct clocksource clocksource_tsc = { .name ="tsc" , .rating =300 ,
@@ -202,6 +208,7 @@ static struct clocksource clocksource_ts .shift = 22, .update_callback = tsc_update_callback, .is_continuous = 1, + .vread = vread_tsc, };static int tsc_update_callback (void )
arch/x86_64/kernel/vmlinux.lds.S +11 -17
@@ -88,31 +88,25 @@ SECTIONS __vsyscall_0 = VSYSCALL_VIRT_ADDR; . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); - .xtime_lock : AT(VLOAD(.xtime_lock)) { *(.xtime_lock) } - xtime_lock = VVIRT(.xtime_lock); - - .vxtime : AT(VLOAD(.vxtime)) { *(.vxtime) } - vxtime = VVIRT(.vxtime); + .vsyscall_fn : AT(VLOAD(.vsyscall_fn)) { *(.vsyscall_fn) } + . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); + .vsyscall_gtod_data : AT(VLOAD(.vsyscall_gtod_data)) + { *(.vsyscall_gtod_data) } + vsyscall_gtod_data = VVIRT(.vsyscall_gtod_data); .vgetcpu_mode : AT(VLOAD(.vgetcpu_mode)) { *(.vgetcpu_mode) } vgetcpu_mode = VVIRT(.vgetcpu_mode); - .sys_tz : AT(VLOAD(.sys_tz)) { *(.sys_tz) } - sys_tz = VVIRT(.sys_tz); - - .sysctl_vsyscall : AT(VLOAD(.sysctl_vsyscall)) { *(.sysctl_vsyscall) } - sysctl_vsyscall = VVIRT(.sysctl_vsyscall); - - .xtime : AT(VLOAD(.xtime)) { *(.xtime) } - xtime = VVIRT(.xtime); - . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); .jiffies : AT(VLOAD(.jiffies)) { *(.jiffies) } jiffies = VVIRT(.jiffies); - .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1)) { *(.vsyscall_1) } - .vsyscall_2 ADDR(.vsyscall_0) + 2048: AT(VLOAD(.vsyscall_2)) { *(.vsyscall_2) } - .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) { *(.vsyscall_3) } + .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT(VLOAD(.vsyscall_1)) + { *(.vsyscall_1) } + .vsyscall_2 ADDR(.vsyscall_0) + 2048: AT(VLOAD(.vsyscall_2)) + { *(.vsyscall_2) } + .vsyscall_3 ADDR(.vsyscall_0) + 3072: AT(VLOAD(.vsyscall_3)) + { *(.vsyscall_3) } . = VSYSCALL_VIRT_ADDR + 4096;
arch/x86_64/kernel/vsyscall.c +71 -48
181 lines not on this page · raw message
include/asm-x86_64/proto.h +0 -2
@@ -45,9 +45,7 @@ extern u32 pmtmr_ioport;#else #define pmtmr_ioport 0#endif -extern int sysctl_vsyscall;extern int nohpet; -extern unsigned long vxtime_hz;extern void early_printk (const char *fmt, ...) __attribute__((format (printf,1 ,2 )));
include/asm-x86_64/timex.h +0 -1
@@ -51,7 +51,6 @@ extern int read_current_timer(unsigned l#define NS_SCALE 10/* 2^10, carefully chosen */ #define US_SCALE 32/* 2^32, arbitralrily chosen */ -extern struct vxtime_data vxtime;extern void mark_tsc_unstable (void );extern void set_cyc2ns_scale (unsigned long khz);#endif
include/asm-x86_64/vsyscall.h +6 -25
@@ -16,46 +16,27 @@ enum vsyscall_num {#ifdef __KERNEL__#include <linux/seqlock.h> -#define __section_vxtime __attribute__ ((unused, __section__ (".vxtime"), aligned(16)))#define __section_vgetcpu_mode __attribute__ ((unused, __section__ (".vgetcpu_mode"), aligned(16)))#define __section_jiffies __attribute__ ((unused, __section__ (".jiffies"), aligned(16))) -#define __section_sys_tz __attribute__ ((unused, __section__ (".sys_tz"), aligned(16))) -#define __section_sysctl_vsyscall __attribute__ ((unused, __section__ (".sysctl_vsyscall"), aligned(16))) -#define __section_xtime __attribute__ ((unused, __section__ (".xtime"), aligned(16))) -#define __section_xtime_lock __attribute__ ((unused, __section__ (".xtime_lock"), aligned(16))) - -#define VXTIME_TSC 1 -#define VXTIME_HPET 2 -#define VXTIME_PMTMR 3 + +/* Definitions for CONFIG_GENERIC_TIME definitions */ +#define __section_vsyscall_gtod_data __attribute__ \ + ((unused, __section__ (".vsyscall_gtod_data"),aligned(16))) +#define __vsyscall_fn __attribute__ ((unused,__section__(".vsyscall_fn")))#define VGETCPU_RDTSCP 1#define VGETCPU_LSL 2 -struct vxtime_data { -long hpet_address;/* HPET base address */ -int last; -unsigned long last_tsc; -long quot; -long tsc_quot; -int mode; -}; -#define hpet_readl (a) readl((const void __iomem *)fix_to_virt(FIX_HPET_BASE) + a)#define hpet_writel (d,a) writel(d, (void __iomem *)fix_to_virt(FIX_HPET_BASE) + a) -/* vsyscall space (readonly) */ -extern struct vxtime_data __vxtime;extern int __vgetcpu_mode; -extern struct timespec __xtime;extern volatile unsigned long __jiffies; -extern struct timezone __sys_tz; -extern seqlock_t __xtime_lock;/* kernel space (writeable) */ -extern struct vxtime_data vxtime;extern int vgetcpu_mode;extern struct timezone sys_tz; -extern int sysctl_vsyscall; +extern struct vsyscall_gtod_data_t vsyscall_gtod_data;#endif /* __KERNEL__ */
Re: [PATCH -mm 5/5][time][x86_64] Re-enable vsyscall support for x86_64
Quoted 2 lines · On Wed, 20 Dec 2006 17:13:49 -0500 john stultz <[email protected]> wrote:
Cleanup and re-enable vsyscall gettimeofday using the generic clocksource infrastructure.
This patch disagrees violently with the post-2.6.20-rc1-mm1 introduce-time_data-a-new-structure-to-hold-jiffies-xtime-xtime_lock-wall_to_monotonic-calc_load_count-and-avenrun.patch, which I dropped to make way for this (sorry).
Quoted 3 lines · john stultz
Andrew, Andi,
Here is the same patchset from lastnight, re-diffed against -mm
This one does indeed apply, compile, and boot.
Quoted 1 line
Thanks to Valdis Kletnieks for pointing out that it didn't apply.
Not being a locking ninja or a PCI demigod, I figure I can at least contribute testing and mostly-parseable bug reports. :)