[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <BANLkTi=jtUv9k5FxqGJ9rXpZivpfhTN=wQ@mail.gmail.com>
Date: Thu, 12 May 2011 07:16:36 -0400
From: Andrew Lutomirski <luto@....edu>
To: Borislav Petkov <bp@...64.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Ingo Molnar <mingo@...e.hu>, Andi Kleen <andi@...stfloor.org>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Nick Piggin <npiggin@...e.de>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <eric.dumazet@...il.com>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH v3 1/6] x86-64: Clean up vdso/kernel shared variables
On Tue, May 10, 2011 at 10:48 AM, Borislav Petkov <bp@...64.org> wrote:
> On Tue, May 10, 2011 at 10:15:03AM -0400, Andy Lutomirski wrote:
>> Variables that are shared between the vdso and the kernel are
>> currently a bit of a mess. They are each defined with their own
>> magic, they are accessed differently in the kernel, the vsyscall page,
>> and the vdso, and one of them (vsyscall_clock) doesn't even really
>> exist.
>>
>> This changes them all to use a common mechanism. All of them are
>> delcared in vvar.h with a fixed address (validated by the linker
>> script). In the kernel (as before), they look like ordinary
>> read-write variables. In the vsyscall page and the vdso, they are
>> accessed through a new macro VVAR, which gives read-only access.
>>
>> The vdso is now loaded verbatim into memory without any fixups. As a
>> side bonus, access from the vdso is faster because a level of
>> indirection is removed.
>> ---
>> arch/x86/include/asm/vdso.h | 14 ----------
>> arch/x86/include/asm/vgtod.h | 2 -
>> arch/x86/include/asm/vsyscall.h | 12 +-------
>> arch/x86/include/asm/vvar.h | 52 +++++++++++++++++++++++++++++++++++++++
>> arch/x86/kernel/time.c | 2 +-
>> arch/x86/kernel/tsc.c | 4 +-
>> arch/x86/kernel/vmlinux.lds.S | 34 ++++++++-----------------
>> arch/x86/kernel/vsyscall_64.c | 46 +++++++++++++++-------------------
>> arch/x86/vdso/Makefile | 2 +-
>> arch/x86/vdso/vclock_gettime.c | 3 +-
>> arch/x86/vdso/vdso.lds.S | 7 -----
>> arch/x86/vdso/vextern.h | 16 ------------
>> arch/x86/vdso/vgetcpu.c | 3 +-
>> arch/x86/vdso/vma.c | 27 --------------------
>> arch/x86/vdso/vvar.c | 12 ---------
>> 15 files changed, 91 insertions(+), 145 deletions(-)
>> create mode 100644 arch/x86/include/asm/vvar.h
>> delete mode 100644 arch/x86/vdso/vextern.h
>> delete mode 100644 arch/x86/vdso/vvar.c
>>
>> +/* DECLARE_VVAR(offset, type, name) */
>> +
>> +DECLARE_VVAR(0, volatile unsigned long, jiffies)
>> +DECLARE_VVAR(128, struct vsyscall_gtod_data, vsyscall_gtod_data)
>> +DECLARE_VVAR(256, int, vgetcpu_mode)
>
> Why so spread out? Maybe put each on a single cacheline instead?
They're currently on their own cachelines. I just spread them out
because there's room and that way modification to their types is less
likely to make them conflict.
I'll add a patch at the end of the series to pack them into two
cachelines. All of the variables are read-mostly so it should be a
win.
--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists