The vdso implementation of vgetcpu has been ignoring the tcache
parameter since change 4307d1e5ada595c87f9a4d16db16ba5edb70dcb1,
but that overlooked the vsyscall implementation of vgetcpu.
This change ignores tcache in the common code, but passes the
pointer in from vdso so that it can be still used if there's a
new tcache implementation which addresses the problems mentioned
in 4307d1e5ada595c87f.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@xxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxx>
---
arch/x86/include/asm/vsyscall.h | 19 ++++---------------
arch/x86/vdso/vgetcpu.c | 3 +--
2 files changed, 5 insertions(+), 17 deletions(-)
diff --git a/arch/x86/include/asm/vsyscall.h b/arch/x86/include/asm/vsyscall.h
index 2fcd505..bb90047 100644
--- a/arch/x86/include/asm/vsyscall.h
+++ b/arch/x86/include/asm/vsyscall.h
@@ -48,27 +48,16 @@ int __vgetcpu(unsigned *cpu, unsigned *node, struct
getcpu_cache *tcache,
unsigned int p;
unsigned long j = 0;
- /* Fast cache - only recompute value once per jiffies and avoid
- relatively costly rdtscp/cpuid otherwise.
- This works because the scheduler usually keeps the process
- on the same CPU and this syscall doesn't guarantee its
- results anyways.
- We do this here because otherwise user space would do it on
- its own in a likely inferior way (no access to jiffies).
- If you don't like it pass NULL. */
- if (tcache && tcache->blob[0] == (j = jiffies)) {
- p = tcache->blob[1];
- } else if (vgetcpu_mode == VGETCPU_RDTSCP) {
+ /* tcache is ignored - it is too unreliable */
+
+ if (vgetcpu_mode == VGETCPU_RDTSCP) {
/* Load per CPU data from RDTSCP */
native_read_tscp(&p);
} else {
/* Load per CPU data from GDT */
asm("lsl %1,%0" : "=r" (p) : "r" (__PER_CPU_SEG));
}
- if (tcache) {
- tcache->blob[0] = j;
- tcache->blob[1] = p;
- }
+
if (cpu)
*cpu = p & 0xfff;
if (node)
diff --git a/arch/x86/vdso/vgetcpu.c b/arch/x86/vdso/vgetcpu.c
index 1f19f74..2c4f9ab 100644
--- a/arch/x86/vdso/vgetcpu.c
+++ b/arch/x86/vdso/vgetcpu.c
@@ -16,8 +16,7 @@
notrace long
__vdso_getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
{
- /* Ignore tcache to preserve old behaviour */
- return __vgetcpu(cpu, node, NULL, *vdso_jiffies, *vdso_vgetcpu_mode);
+ return __vgetcpu(cpu, node, tcache, *vdso_jiffies, *vdso_vgetcpu_mode);
}
long getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache)
--
1.6.2.5
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
|