lkml.org 
[lkml]   [2011]   [Mar]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 3/6] x86-64: Put vsyscall_gtod_data at a fixed virtual address
Date
This generates slightly better code because vclock_gettime doesn't
need to load the address.

Signed-off-by: Andy Lutomirski <luto@mit.edu>
---
arch/x86/kernel/vmlinux.lds.S | 13 +++++++------
arch/x86/vdso/vextern.h | 9 ++++++++-
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/arch/x86/kernel/vmlinux.lds.S b/arch/x86/kernel/vmlinux.lds.S
index bf47007..1f545ff 100644
--- a/arch/x86/kernel/vmlinux.lds.S
+++ b/arch/x86/kernel/vmlinux.lds.S
@@ -174,12 +174,6 @@ SECTIONS
*(.vsyscall_fn)
}

- . = ALIGN(L1_CACHE_BYTES);
- .vsyscall_gtod_data : AT(VLOAD(.vsyscall_gtod_data)) {
- *(.vsyscall_gtod_data)
- }
-
- vsyscall_gtod_data = VVIRT(.vsyscall_gtod_data);
.vsyscall_clock : AT(VLOAD(.vsyscall_clock)) {
*(.vsyscall_clock)
}
@@ -208,6 +202,13 @@ SECTIONS
*(.vsyscall_3)
}

+ /* This address must be kept in sync with arch/x86/vdso/vextern.h */
+ .vsyscall_gtod_data ADDR(.vsyscall_0) + 3072 + 256:
+ AT(VLOAD(.vsyscall_gtod_data)) {
+ *(.vsyscall_gtod_data)
+ }
+ vsyscall_gtod_data = VVIRT(.vsyscall_gtod_data);
+
. = __vsyscall_0 + PAGE_SIZE;

#undef VSYSCALL_ADDR
diff --git a/arch/x86/vdso/vextern.h b/arch/x86/vdso/vextern.h
index 1683ba2..5bfa77c 100644
--- a/arch/x86/vdso/vextern.h
+++ b/arch/x86/vdso/vextern.h
@@ -2,6 +2,11 @@
#include <asm/vsyscall.h>
#define VEXTERN(x) \
extern typeof(x) *vdso_ ## x __attribute__((visibility("hidden")));
+#define VEXTERN_FIXED(x, offset) \
+ static typeof(x) * const vdso_ ## x = \
+ (void *)(VSYSCALL_START + (offset));
+#else
+#define VEXTERN_FIXED(x, offset)
#endif

#define VMAGIC 0xfeedbabeabcdefabUL
@@ -13,4 +18,6 @@

VEXTERN(jiffies)
VEXTERN(vgetcpu_mode)
-VEXTERN(vsyscall_gtod_data)
+VEXTERN_FIXED(vsyscall_gtod_data, 3072 + 256) /* Hard-coded in linker script */
+
+#undef VEXTERN_FIXED
--
1.7.4


\
 
 \ /
  Last update: 2011-03-28 17:15    [from the cache]
©2003-2011 Jasper Spaans