diff options
author | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2008-12-31 09:11:42 -0500 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2008-12-31 09:11:49 -0500 |
commit | c742b31c03f37c5c499178f09f57381aa6c70131 (patch) | |
tree | db0e95b8299d997fcb1264126bc8efe10d0ddd51 /arch/s390/include | |
parent | 9cfb9b3c3a7361c793c031e9c3583b177ac5debd (diff) |
[PATCH] fast vdso implementation for CLOCK_THREAD_CPUTIME_ID
The extract cpu time instruction (ectg) instruction allows the user
process to get the current thread cputime without calling into the
kernel. The code that uses the instruction needs to switch to the
access registers mode to get access to the per-cpu info page that
contains the two base values that are needed to calculate the current
cputime from the CPU timer with the ectg instruction.
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/include')
-rw-r--r-- | arch/s390/include/asm/lowcore.h | 9 | ||||
-rw-r--r-- | arch/s390/include/asm/vdso.h | 15 |
2 files changed, 21 insertions, 3 deletions
diff --git a/arch/s390/include/asm/lowcore.h b/arch/s390/include/asm/lowcore.h index a547817cf1ab..ffdef5fe8587 100644 --- a/arch/s390/include/asm/lowcore.h +++ b/arch/s390/include/asm/lowcore.h | |||
@@ -106,8 +106,10 @@ | |||
106 | #define __LC_IPLDEV 0xDB8 | 106 | #define __LC_IPLDEV 0xDB8 |
107 | #define __LC_CURRENT 0xDD8 | 107 | #define __LC_CURRENT 0xDD8 |
108 | #define __LC_INT_CLOCK 0xDE8 | 108 | #define __LC_INT_CLOCK 0xDE8 |
109 | #define __LC_VDSO_PER_CPU 0xE38 | ||
109 | #endif /* __s390x__ */ | 110 | #endif /* __s390x__ */ |
110 | 111 | ||
112 | #define __LC_PASTE 0xE40 | ||
111 | 113 | ||
112 | #define __LC_PANIC_MAGIC 0xE00 | 114 | #define __LC_PANIC_MAGIC 0xE00 |
113 | #ifndef __s390x__ | 115 | #ifndef __s390x__ |
@@ -381,7 +383,12 @@ struct _lowcore | |||
381 | /* whether the kernel died with panic() or not */ | 383 | /* whether the kernel died with panic() or not */ |
382 | __u32 panic_magic; /* 0xe00 */ | 384 | __u32 panic_magic; /* 0xe00 */ |
383 | 385 | ||
384 | __u8 pad13[0x11b8-0xe04]; /* 0xe04 */ | 386 | /* Per cpu primary space access list */ |
387 | __u8 pad_0xe04[0xe3c-0xe04]; /* 0xe04 */ | ||
388 | __u32 vdso_per_cpu_data; /* 0xe3c */ | ||
389 | __u32 paste[16]; /* 0xe40 */ | ||
390 | |||
391 | __u8 pad13[0x11b8-0xe80]; /* 0xe80 */ | ||
385 | 392 | ||
386 | /* 64 bit extparam used for pfault, diag 250 etc */ | 393 | /* 64 bit extparam used for pfault, diag 250 etc */ |
387 | __u64 ext_params2; /* 0x11B8 */ | 394 | __u64 ext_params2; /* 0x11B8 */ |
diff --git a/arch/s390/include/asm/vdso.h b/arch/s390/include/asm/vdso.h index a44f4fe16a35..7bdd7c8ebc91 100644 --- a/arch/s390/include/asm/vdso.h +++ b/arch/s390/include/asm/vdso.h | |||
@@ -12,9 +12,9 @@ | |||
12 | #ifndef __ASSEMBLY__ | 12 | #ifndef __ASSEMBLY__ |
13 | 13 | ||
14 | /* | 14 | /* |
15 | * Note about this structure: | 15 | * Note about the vdso_data and vdso_per_cpu_data structures: |
16 | * | 16 | * |
17 | * NEVER USE THIS IN USERSPACE CODE DIRECTLY. The layout of this | 17 | * NEVER USE THEM IN USERSPACE CODE DIRECTLY. The layout of the |
18 | * structure is supposed to be known only to the function in the vdso | 18 | * structure is supposed to be known only to the function in the vdso |
19 | * itself and may change without notice. | 19 | * itself and may change without notice. |
20 | */ | 20 | */ |
@@ -28,10 +28,21 @@ struct vdso_data { | |||
28 | __u64 wtom_clock_nsec; /* 0x28 */ | 28 | __u64 wtom_clock_nsec; /* 0x28 */ |
29 | __u32 tz_minuteswest; /* Minutes west of Greenwich 0x30 */ | 29 | __u32 tz_minuteswest; /* Minutes west of Greenwich 0x30 */ |
30 | __u32 tz_dsttime; /* Type of dst correction 0x34 */ | 30 | __u32 tz_dsttime; /* Type of dst correction 0x34 */ |
31 | __u32 ectg_available; | ||
32 | }; | ||
33 | |||
34 | struct vdso_per_cpu_data { | ||
35 | __u64 ectg_timer_base; | ||
36 | __u64 ectg_user_time; | ||
31 | }; | 37 | }; |
32 | 38 | ||
33 | extern struct vdso_data *vdso_data; | 39 | extern struct vdso_data *vdso_data; |
34 | 40 | ||
41 | #ifdef CONFIG_64BIT | ||
42 | int vdso_alloc_per_cpu(int cpu, struct _lowcore *lowcore); | ||
43 | void vdso_free_per_cpu(int cpu, struct _lowcore *lowcore); | ||
44 | #endif | ||
45 | |||
35 | #endif /* __ASSEMBLY__ */ | 46 | #endif /* __ASSEMBLY__ */ |
36 | 47 | ||
37 | #endif /* __KERNEL__ */ | 48 | #endif /* __KERNEL__ */ |