From: Matt Mackall <mpm@selenic.com>
To: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Subject: [PATCH 9/15] misc: Make sysenter support optional
Date: Fri, 11 Nov 2005 02:35:53 -0600 [thread overview]
Message-ID: <10.282480653@selenic.com> (raw)
In-Reply-To: <9.282480653@selenic.com>
This adds configurable sysenter support on x86. This saves about 5k on
small systems.
text data bss dec hex
3330172 529036 190556 4049764 3dcb64 baseline
3329604 524164 190556 4044324 3db624 sysenter
$ bloat-o-meter vmlinux{-baseline,}
add/remove: 0/2 grow/shrink: 0/3 up/down: 0/-316 (-316)
function old new delta
__restore_processor_state 76 62 -14
identify_cpu 520 500 -20
create_elf_tables 923 883 -40
sysenter_setup 113 - -113
enable_sep_cpu 129 - -129
Most of the savings is not including the vsyscall DSO which doesn't
show up with bloat-o-meter:
$ size arch/i386/kernel/vsyscall.o
text data bss dec hex filename
0 4826 0 4826 12da arch/i386/kernel/vsyscall.o
$ nm arch/i386/kernel/vsyscall.o
00000961 T vsyscall_int80_end
00000000 T vsyscall_int80_start
000012da T vsyscall_sysenter_end
00000961 T vsyscall_sysenter_start
Signed-off-by: Matt Mackall <mpm@selenic.com>
Index: 2.6.14-misc/arch/i386/kernel/Makefile
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/Makefile 2005-11-11 00:32:13.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/Makefile 2005-11-11 00:32:17.000000000 -0800
@@ -29,7 +29,7 @@ obj-$(CONFIG_X86_NUMAQ) += numaq.o
obj-$(CONFIG_X86_SUMMIT_NUMA) += summit.o
obj-$(CONFIG_KPROBES) += kprobes.o
obj-$(CONFIG_MODULES) += module.o
-obj-y += sysenter.o vsyscall.o
+obj-$(CONFIG_SYSENTER) += sysenter.o vsyscall.o
obj-$(CONFIG_ACPI_SRAT) += srat.o
obj-$(CONFIG_HPET_TIMER) += time_hpet.o
obj-$(CONFIG_EFI) += efi.o efi_stub.o
Index: 2.6.14-misc/arch/i386/kernel/entry.S
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/entry.S 2005-11-11 00:32:13.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/entry.S 2005-11-11 00:32:17.000000000 -0800
@@ -177,6 +177,7 @@ need_resched:
# sysenter call handler stub
ENTRY(sysenter_entry)
+#ifdef CONFIG_SYSENTER
movl TSS_sysenter_esp0(%esp),%esp
sysenter_past_esp:
sti
@@ -219,7 +220,7 @@ sysenter_past_esp:
xorl %ebp,%ebp
sti
sysexit
-
+#endif
# system call handler stub
ENTRY(system_call)
@@ -506,6 +507,8 @@ device_not_available_emulate:
* by hand onto the new stack - while updating the return eip past
* the instruction that would have done it for sysenter.
*/
+
+#ifdef CONFIG_SYSENTER
#define FIX_STACK(offset, ok, label) \
cmpw $__KERNEL_CS,4(%esp); \
jne ok; \
@@ -514,6 +517,10 @@ label: \
pushfl; \
pushl $__KERNEL_CS; \
pushl $sysenter_past_esp
+#else
+#define FIX_STACK(offset, ok, label) \
+label:
+#endif
KPROBE_ENTRY(debug)
cmpl $sysenter_entry,(%esp)
Index: 2.6.14-misc/arch/i386/power/cpu.c
===================================================================
--- 2.6.14-misc.orig/arch/i386/power/cpu.c 2005-11-11 00:31:55.000000000 -0800
+++ 2.6.14-misc/arch/i386/power/cpu.c 2005-11-11 00:32:17.000000000 -0800
@@ -109,11 +109,13 @@ void __restore_processor_state(struct sa
loadsegment(gs, ctxt->gs);
loadsegment(ss, ctxt->ss);
+#ifdef CONFIG_SYSENTER
/*
* sysenter MSRs
*/
if (boot_cpu_has(X86_FEATURE_SEP))
enable_sep_cpu();
+#endif
fix_processor_context();
do_fpu_end();
Index: 2.6.14-misc/include/asm-i386/elf.h
===================================================================
--- 2.6.14-misc.orig/include/asm-i386/elf.h 2005-11-11 00:32:01.000000000 -0800
+++ 2.6.14-misc/include/asm-i386/elf.h 2005-11-11 00:32:17.000000000 -0800
@@ -134,11 +134,13 @@ extern int dump_task_extended_fpu (struc
#define VSYSCALL_ENTRY ((unsigned long) &__kernel_vsyscall)
extern void __kernel_vsyscall;
+#ifdef CONFIG_SYSENTER
#define ARCH_DLINFO \
do { \
NEW_AUX_ENT(AT_SYSINFO, VSYSCALL_ENTRY); \
NEW_AUX_ENT(AT_SYSINFO_EHDR, VSYSCALL_BASE); \
} while (0)
+#endif
/*
* These macros parameterize elf_core_dump in fs/binfmt_elf.c to write out
Index: 2.6.14-misc/init/Kconfig
===================================================================
--- 2.6.14-misc.orig/init/Kconfig 2005-11-11 00:32:13.000000000 -0800
+++ 2.6.14-misc/init/Kconfig 2005-11-11 00:32:17.000000000 -0800
@@ -357,6 +357,14 @@ config VM86
XFree86 to initialize some video cards via BIOS. Disabling this
option saves about 6k.
+config SYSENTER
+ depends X86
+ default y
+ bool "Enable syscalls via sysenter" if EMBEDDED
+ help
+ Disabling this feature removes sysenter handling as well as
+ vsyscall fixmaps.
+
config CC_OPTIMIZE_FOR_SIZE
bool "Optimize for size" if EMBEDDED
default y if ARM || H8300
Index: 2.6.14-misc/arch/i386/kernel/cpu/common.c
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/cpu/common.c 2005-11-11 00:32:13.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/cpu/common.c 2005-11-11 00:32:40.000000000 -0800
@@ -429,9 +429,11 @@ void __devinit identify_cpu(struct cpuin
/* Init Machine Check Exception if available. */
mcheck_init(c);
+#ifdef CONFIG_SYSENTER
if (c == &boot_cpu_data)
sysenter_setup();
enable_sep_cpu();
+#endif
if (c == &boot_cpu_data)
mtrr_bp_init();
next prev parent reply other threads:[~2005-11-11 8:39 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-11 8:35 [PATCH 0/15] misc: Miscellaneous bits from -tiny Matt Mackall
2005-11-11 8:35 ` [PATCH 1/15] misc: Add bloat-o-meter to scripts Matt Mackall
2005-11-11 8:35 ` [PATCH 2/15] misc: Uninline some namei.c functions Matt Mackall
2005-11-11 8:35 ` [PATCH 3/15] misc: Uninline some open.c functions Matt Mackall
2005-11-11 8:35 ` [PATCH 4/15] misc: Uninline some inode.c functions Matt Mackall
2005-11-11 8:35 ` [PATCH 5/15] misc: Uninline some fslocks.c functions Matt Mackall
2005-11-11 8:35 ` [PATCH 6/15] misc: Trim non-IPX builds Matt Mackall
2005-11-11 8:35 ` [PATCH 7/15] misc: Make x86 doublefault handling optional Matt Mackall
2005-11-11 8:35 ` [PATCH 8/15] misc: Make vm86 support optional Matt Mackall
2005-11-11 8:35 ` Matt Mackall [this message]
2005-11-11 8:35 ` [PATCH 10/15] misc: Make *[ug]id16 " Matt Mackall
2005-11-11 8:35 ` [PATCH 11/15] misc: Allow dropping panic text strings from kernel image Matt Mackall
2005-11-11 8:35 ` [PATCH 12/15] misc: Configurable panic support Matt Mackall
2005-11-11 8:35 ` [PATCH 13/15] misc: Configure ELF core dump support Matt Mackall
2005-11-11 8:35 ` [PATCH 14/15] misc: Configurable number of supported IDE interfaces Matt Mackall
2005-11-11 8:35 ` [PATCH 15/15] misc: Configurable support for PCI serial ports Matt Mackall
2005-11-11 11:03 ` Geert Uytterhoeven
2006-01-07 16:50 ` Russell King
2006-01-08 2:26 ` Matt Mackall
2005-11-11 10:14 ` [PATCH 14/15] misc: Configurable number of supported IDE interfaces Bartlomiej Zolnierkiewicz
2005-11-11 17:18 ` Matt Mackall
2005-11-11 17:34 ` Roman Zippel
2005-11-11 17:37 ` Matt Mackall
2005-11-11 17:47 ` Matt Mackall
2005-11-11 17:49 ` Roman Zippel
2005-11-11 11:03 ` [PATCH 11/15] misc: Allow dropping panic text strings from kernel image Geert Uytterhoeven
2005-11-11 17:21 ` Matt Mackall
2005-11-12 6:06 ` Andrew Morton
2005-11-11 10:22 ` [PATCH 10/15] misc: Make *[ug]id16 support optional Geert Uytterhoeven
2005-11-16 13:21 ` Rob Landley
2005-11-16 18:01 ` Matt Mackall
2005-12-20 15:46 ` Zdenek Pavlas
2005-12-20 16:50 ` Rob Landley
2005-12-21 17:30 ` Zdenek Pavlas
2005-11-12 5:57 ` [PATCH 9/15] misc: Make sysenter " Andrew Morton
2005-11-12 5:55 ` [PATCH 8/15] misc: Make vm86 " Andrew Morton
2005-11-13 3:30 ` [PATCH 7/15] misc: Make x86 doublefault handling optional Andi Kleen
2005-11-16 13:13 ` Rob Landley
2005-11-16 18:21 ` Matt Mackall
2005-11-16 19:21 ` Scott Garfinkle
2005-11-16 19:45 ` Adrian Bunk
2005-12-12 10:36 ` Ingo Molnar
2005-12-12 16:22 ` Andi Kleen
2005-12-12 15:32 ` Matt Mackall
2005-12-13 8:39 ` Ingo Molnar
2005-11-14 1:57 ` [PATCH 6/15] misc: Trim non-IPX builds Adrian Bunk
2005-11-18 5:22 ` [2.6 patch] move some code to net/ipx/af_ipx.c Adrian Bunk
2005-11-18 17:27 ` Matt Mackall
2005-11-18 20:24 ` Arnaldo Carvalho de Melo
2005-12-05 21:35 ` Adrian Bunk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10.282480653@selenic.com \
--to=mpm@selenic.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox