diff --git a/arch/i386/kernel/time-xen.c b/arch/i386/kernel/time-xen.c index abdea83..d36f1c0 100644 --- a/arch/i386/kernel/time-xen.c +++ b/arch/i386/kernel/time-xen.c @@ -86,6 +86,7 @@ struct vxtime_data __vxtime __section_vxtime; /* for vsyscalls */ volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; unsigned long __wall_jiffies __section_wall_jiffies = INITIAL_JIFFIES; struct timespec __xtime __section_xtime; +struct timespec __wall_to_monotonic __section_wall_to_monotonic; struct timezone __sys_tz __section_sys_tz; #endif diff --git a/arch/x86_64/kernel/time.c b/arch/x86_64/kernel/time.c index 830c7d6..187e252 100644 --- a/arch/x86_64/kernel/time.c +++ b/arch/x86_64/kernel/time.c @@ -99,6 +99,7 @@ struct vxtime_data __vxtime __section_vxtime; /* for vsyscalls */ volatile unsigned long __jiffies __section_jiffies = INITIAL_JIFFIES; unsigned long __wall_jiffies __section_wall_jiffies = INITIAL_JIFFIES; struct timespec __xtime __section_xtime; +struct timespec __wall_to_monotonic __section_wall_to_monotonic; struct timezone __sys_tz __section_sys_tz; /* -1=>disabled, 0=>autoconfigure, 1=>enabled */ diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S index daff4d4..4553021 100644 --- a/arch/x86_64/kernel/vmlinux.lds.S +++ b/arch/x86_64/kernel/vmlinux.lds.S @@ -121,6 +121,10 @@ SECTIONS .xtime : AT(VLOAD(.xtime)) { *(.xtime) } xtime = VVIRT(.xtime); + .wall_to_monotonic : AT(VLOAD(.wall_to_monotonic)) { *(.wall_to_monotonic) } + wall_to_monotonic = VVIRT(.wall_to_monotonic); + + . = ALIGN(CONFIG_X86_L1_CACHE_BYTES); .jiffies : AT(VLOAD(.jiffies)) { *(.jiffies) } jiffies = VVIRT(.jiffies); diff --git a/arch/x86_64/vdso/vclock_gettime.c b/arch/x86_64/vdso/vclock_gettime.c index 3e586bf..d195db2 100644 --- a/arch/x86_64/vdso/vclock_gettime.c +++ b/arch/x86_64/vdso/vclock_gettime.c @@ -96,8 +96,8 @@ static noinline int do_monotonic(struct timespec *ts) seq = read_seqbegin(vdso_xtime_lock); secs = vdso_xtime->tv_sec; ns = vdso_xtime->tv_nsec + vgetns(); - secs += wall_to_monotonic.tv_sec; - ns += wall_to_monotonic.tv_nsec; + secs += vdso_wall_to_monotonic->tv_sec; + ns += vdso_wall_to_monotonic->tv_nsec; } while (unlikely(read_seqretry(vdso_xtime_lock, seq))); vset_normalized_timespec(ts, secs, ns); return 0; diff --git a/arch/x86_64/vdso/vextern.h b/arch/x86_64/vdso/vextern.h index 8cf4051..c3abc27 100644 --- a/arch/x86_64/vdso/vextern.h +++ b/arch/x86_64/vdso/vextern.h @@ -16,4 +16,5 @@ VEXTERN(xtime_lock) VEXTERN(xtime) VEXTERN(sys_tz) VEXTERN(vgetcpu_mode) +VEXTERN(wall_to_monotonic) VEXTERN(sysctl_vsyscall) diff --git a/include/asm-x86_64/vsyscall.h b/include/asm-x86_64/vsyscall.h index e9cb8e0..cd2af48 100644 --- a/include/asm-x86_64/vsyscall.h +++ b/include/asm-x86_64/vsyscall.h @@ -22,6 +22,7 @@ enum vsyscall_num { #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_wall_to_monotonic __attribute__ ((unused, __section__ (".wall_to_monotonic"), aligned(16))) #define __section_xtime_lock __attribute__ ((unused, __section__ (".xtime_lock"), aligned(16))) #define VXTIME_TSC 1 @@ -49,6 +50,7 @@ struct vxtime_data { extern struct vxtime_data __vxtime; extern int __vgetcpu_mode; extern struct timespec __xtime; +extern struct timespec __wall_to_monotonic; extern volatile unsigned long __jiffies; extern unsigned long __wall_jiffies; extern struct timezone __sys_tz; @@ -62,6 +64,7 @@ extern unsigned long wall_jiffies; extern struct timezone sys_tz; extern int sysctl_vsyscall; extern seqlock_t xtime_lock; +extern struct timespec wall_to_monotonic; extern int sysctl_vsyscall; diff --git a/kernel/timer.c b/kernel/timer.c index 8b3b7d7..3be1f4c 100644 --- a/kernel/timer.c +++ b/kernel/timer.c @@ -811,6 +811,7 @@ struct timespec xtime __attribute__ ((aligned (16))); struct timespec wall_to_monotonic __attribute__ ((aligned (16))); EXPORT_SYMBOL(xtime); +EXPORT_SYMBOL(wall_to_monotonic); /* Don't completely fail for HZ > 500. */ int tickadj = 500/HZ ? : 1; /* microsecs */