Skip to contentSkip to conversation

misc: Miscellaneous bits from -tiny

PATCH In review Matt Mackall 13 participants 50 messages Nov 11, 2005 – Jan 8, 2006

Subsystems (14)
lore
Share & tools
lore
#0 lore raw

cover misc: Miscellaneous bits from -tiny

This is a set of fairly straightforward patches from the -tiny tree.

They're largely independent, except that several of them touch init/Kconfig and the second panic related patch does depend on the first one.

This work is sponsored in part by the CE Linux Forum.

#1 lore raw

PATCH 1/15 misc: Add bloat-o-meter to scripts

This is a rewrite of Andi Kleen's bloat-o-meter with sorting and reporting of gainers/decliners. Sample output:

add/remove: 0/8 grow/shrink: 2/0 up/down: 88/-4424 (-4336)

function                                     old     new   delta
__copy_to_user_ll                             59     103     +44
__copy_from_user_ll                           59     103     +44
fill_note                                     32       -     -32
maydump                                       58       -     -58
dump_seek                                     67       -     -67
writenote                                    180       -    -180
elf_dump_thread_status                       274       -    -274
fill_psinfo                                  308       -    -308
fill_prstatus                                466       -    -466
elf_core_dump                               3039       -   -3039

The summary line says:
no functions added, 8 removed
two functions grew, none shrunk
we gained 88 bytes and lost 4424 (or -4336 net)

This work was sponsored in part by CE Linux Forum

scripts/bloat-o-meter new file +58 -0
Index: tiny/scripts/bloat-o-meter
===================================================================
@@ -0,0 +1,58 @@
+#!/usr/bin/python
+#
+# Copyright 2004 Matt Mackall <[email protected]>
+#
+# inspired by perl Bloat-O-Meter (c) 1997 by Andi Kleen
+#
+# This software may be used and distributed according to the terms
+# of the GNU General Public License, incorporated herein by reference.
+
+import sys, os, re
+
+if len(sys.argv) != 3:
+    sys.stderr.write("usage: %s file1 file2\n" % sys.argv[0])
+    sys.exit(-1)
+
+def getsizes(file):
+    sym = {}
+    for l in os.popen("nm --size-sort " + file).readlines():
+        size, type, name = l[:-1].split()
+        if type in "tTdDbB":
+            sym[name] = int(size, 16)
+    return sym
+
+old = getsizes(sys.argv[1])
+new = getsizes(sys.argv[2])
+grow, shrink, add, remove, up, down = 0, 0, 0, 0, 0, 0
+delta, common = [], {}
+
+for a in old:
+    if a in new:
+        common[a] = 1
+
+for name in old:
+    if name not in common:
+        remove += 1
+        down += old[name]
+        delta.append((-old[name], name))
+
+for name in new:
+    if name not in common:
+        add += 1
+        up += new[name]
+        delta.append((new[name], name))
+
+for name in common:
+        d = new.get(name, 0) - old.get(name, 0)
+        if d>0: grow, up = grow+1, up+d
+        if d<0: shrink, down = shrink+1, down-d
+        delta.append((d, name))
+
+delta.sort()
+delta.reverse()
+
+print "add/remove: %s/%s grow/shrink: %s/%s up/down: %s/%s (%s)" % \
+      (add, remove, grow, shrink, up, -down, up-down)
+print "%-40s %7s %7s %+7s" % ("function", "old", "new", "delta")
+for d, n in delta:
+    if d: print "%-40s %7s %7s %+7d" % (n, old.get(n,"-"), new.get(n,"-"), d)
#2 lore raw

PATCH 2/15 misc: Uninline some namei.c functions

uninline various namei.c functions

add/remove: 4/0 grow/shrink: 0/13 up/down: 1077/-3632 (-2555)

function                                     old     new   delta
do_follow_link                                 -     398    +398
follow_dotdot                                  -     380    +380
may_delete                                     -     249    +249
may_create                                     -      50     +50
vfs_follow_link                              411     410      -1
sys_mknod                                    372     371      -1
page_getlink                                 176     175      -1
vfs_create                                   166     149     -17
vfs_symlink                                  140     118     -22
vfs_mknod                                    200     178     -22
vfs_mkdir                                    148     126     -22
vfs_link                                     250     227     -23
vfs_rmdir                                    331     163    -168
vfs_unlink                                   309     131    -178

open_namei 1683 1258 -425
vfs_rename 988 495 -493
__link_path_walk 3744 1485 -2259

fs/namei.c +6 -11
Index: 2.6.14-misc/fs/namei.c
===================================================================
@@ -471,7 +471,7 @@ walk_init_root(const char *name, struct 
 	return 1;
 }
 
-static inline int __vfs_follow_link(struct nameidata *nd, const char *link)
+int vfs_follow_link(struct nameidata *nd, const char *link)
 {
 	int res = 0;
 	char *name;
@@ -528,7 +528,7 @@ static inline int __do_follow_link(struc
 		char *s = nd_get_link(nd);
 		error = 0;
 		if (s)
-			error = __vfs_follow_link(nd, s);
+			error = vfs_follow_link(nd, s);
 		if (dentry->d_inode->i_op->put_link)
 			dentry->d_inode->i_op->put_link(dentry, nd, cookie);
 	}
@@ -561,7 +561,7 @@ static inline void path_to_nameidata(str
  * Without that kind of total limit, nasty chains of consecutive
  * symlinks can cause almost arbitrarily long lookups. 
  */
-static inline int do_follow_link(struct path *path, struct nameidata *nd)
+static int do_follow_link(struct path *path, struct nameidata *nd)
 {
 	int err = -ELOOP;
 	if (current->link_count >= MAX_NESTED_LINKS)
@@ -657,7 +657,7 @@ int follow_down(struct vfsmount **mnt, s
 	return 0;
 }
 
-static inline void follow_dotdot(struct nameidata *nd)
+static void follow_dotdot(struct nameidata *nd)
 {
 	while(1) {
 		struct vfsmount *parent;
@@ -1261,7 +1261,7 @@ static inline int check_sticky(struct in
  * 10. We don't allow removal of NFS sillyrenamed files; it's handled by
  *     nfs_async_unlink().
  */
-static inline int may_delete(struct inode *dir,struct dentry *victim,int isdir)
+static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
 {
 	int error;
 
@@ -1300,7 +1300,7 @@ static inline int may_delete(struct inod
  *  3. We should have write and exec permissions on dir
  *  4. We can't do it if dir is immutable (done in permission())
  */
-static inline int may_create(struct inode *dir, struct dentry *child,
+static int may_create(struct inode *dir, struct dentry *child,
 			     struct nameidata *nd)
 {
 	if (child->d_inode)
@@ -2415,11 +2415,6 @@ int generic_readlink(struct dentry *dent
 	return PTR_ERR(cookie);
 }
 
-int vfs_follow_link(struct nameidata *nd, const char *link)
-{
-	return __vfs_follow_link(nd, link);
-}
-
 /* get the link contents into pagecache */
 static char *page_getlink(struct dentry * dentry, struct page **ppage)
 {
#3 lore raw

PATCH 3/15 misc: Uninline some open.c functions

uninline some open.c functions

add/remove: 3/0 grow/shrink: 0/6 up/down: 679/-1166 (-487)

function                                     old     new   delta
do_sys_truncate                                -     336    +336
do_sys_ftruncate                               -     317    +317
__put_unused_fd                                -      26     +26
put_unused_fd                                 57      49      -8
sys_close                                    150     119     -31
sys_ftruncate64                              260      26    -234
sys_ftruncate                                272      24    -248
sys_truncate                                 339      25    -314
sys_truncate64                               336       5    -331
fs/open.c +3 -3
Index: 2.6.14-misc/fs/open.c
===================================================================
@@ -212,7 +212,7 @@ int do_truncate(struct dentry *dentry, l
 	return err;
 }
 
-static inline long do_sys_truncate(const char __user * path, loff_t length)
+static long do_sys_truncate(const char __user * path, loff_t length)
 {
 	struct nameidata nd;
 	struct inode * inode;
@@ -278,7 +278,7 @@ asmlinkage long sys_truncate(const char 
 	return do_sys_truncate(path, (long)length);
 }
 
-static inline long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
+static long do_sys_ftruncate(unsigned int fd, loff_t length, int small)
 {
 	struct inode * inode;
 	struct dentry *dentry;
@@ -959,7 +959,7 @@ out:
 
 EXPORT_SYMBOL(get_unused_fd);
 
-static inline void __put_unused_fd(struct files_struct *files, unsigned int fd)
+static void __put_unused_fd(struct files_struct *files, unsigned int fd)
 {
 	struct fdtable *fdt = files_fdtable(files);
 	__FD_CLR(fd, fdt->open_fds);
#4 lore raw

PATCH 4/15 misc: Uninline some inode.c functions

uninline a couple inode.c functions

add/remove: 2/0 grow/shrink: 0/5 up/down: 256/-428 (-172)

function                                     old     new   delta
ifind                                          -     136    +136
ifind_fast                                     -     120    +120
ilookup5_nowait                              131      80     -51
ilookup                                      158      71     -87
ilookup5                                     171      80     -91
iget_locked                                  190      95     -95
iget5_locked                                 240     136    -104
fs/inode.c +2 -2
Index: tiny/fs/inode.c
===================================================================
@@ -770,7 +770,7 @@ EXPORT_SYMBOL(igrab);
  *
  * Note, @test is called with the inode_lock held, so can't sleep.
  */
-static inline struct inode *ifind(struct super_block *sb,
+static struct inode *ifind(struct super_block *sb,
 		struct hlist_head *head, int (*test)(struct inode *, void *),
 		void *data, const int wait)
 {
@@ -804,7 +804,7 @@ static inline struct inode *ifind(struct
  *
  * Otherwise NULL is returned.
  */
-static inline struct inode *ifind_fast(struct super_block *sb,
+static struct inode *ifind_fast(struct super_block *sb,
 		struct hlist_head *head, unsigned long ino)
 {
 	struct inode *inode;
#5 lore raw

PATCH 5/15 misc: Uninline some fslocks.c functions

uninline some file locking functions

add/remove: 3/0 grow/shrink: 0/15 up/down: 256/-1525 (-1269)
function old new delta

locks_free_lock                                -     134    +134
posix_same_owner                               -      69     +69
__locks_delete_block                           -      53     +53
posix_locks_conflict                         126     108     -18
locks_remove_posix                           266     237     -29
locks_wake_up_blocks                         121      87     -34
locks_block_on_timeout                        83      47     -36
locks_insert_block                           157     120     -37
locks_delete_block                            62      23     -39
posix_unblock_lock                           104      59     -45
posix_locks_deadlock                         162     100     -62
locks_delete_lock                            228     119    -109
sys_flock                                    338     217    -121
__break_lease                                600     474    -126
lease_init                                   252     122    -130
fcntl_setlk64                                793     649    -144
fcntl_setlk                                  793     649    -144
__posix_lock_file                           1477    1026    -451
fs/locks.c +3 -4
Index: 2.6.14-misc/fs/locks.c
===================================================================
@@ -154,7 +154,7 @@ static struct file_lock *locks_alloc_loc
 }
 
 /* Free a lock which is not in use. */
-static inline void locks_free_lock(struct file_lock *fl)
+static void locks_free_lock(struct file_lock *fl)
 {
 	if (fl == NULL) {
 		BUG();
@@ -475,8 +475,7 @@ static inline int locks_overlap(struct f
 /*
  * Check whether two locks have the same owner.
  */
-static inline int
-posix_same_owner(struct file_lock *fl1, struct file_lock *fl2)
+static int posix_same_owner(struct file_lock *fl1, struct file_lock *fl2)
 {
 	if (fl1->fl_lmops && fl1->fl_lmops->fl_compare_owner)
 		return fl2->fl_lmops == fl1->fl_lmops &&
@@ -487,7 +486,7 @@ posix_same_owner(struct file_lock *fl1, 
 /* Remove waiter from blocker's block list.
  * When blocker ends up pointing to itself then the list is empty.
  */
-static inline void __locks_delete_block(struct file_lock *waiter)
+static void __locks_delete_block(struct file_lock *waiter)
 {
 	list_del_init(&waiter->fl_block);
 	list_del_init(&waiter->fl_link);
#6 lore raw

PATCH 6/15 misc: Trim non-IPX builds

trivial: drop unused 802.3 code if we compile without IPX

(originally from http://wohnheim.fh-wedel.de/~joern/software/kernel/je/25/)

net/802/Makefile +1 -3
Index: tiny/net/802/Makefile
===================================================================
@@ -2,8 +2,6 @@
 # Makefile for the Linux 802.x protocol layers.
 #
 
-obj-y			:= p8023.o
-
 # Check the p8022 selections against net/core/Makefile.
 obj-$(CONFIG_SYSCTL)	+= sysctl_net_802.o
 obj-$(CONFIG_LLC)	+= p8022.o psnap.o
@@ -11,5 +9,5 @@ obj-$(CONFIG_TR)	+= p8022.o psnap.o tr.o
 obj-$(CONFIG_NET_FC)	+=                 fc.o
 obj-$(CONFIG_FDDI)	+=                 fddi.o
 obj-$(CONFIG_HIPPI)	+=                 hippi.o
-obj-$(CONFIG_IPX)	+= p8022.o psnap.o
+obj-$(CONFIG_IPX)	+= p8022.o psnap.o p8023.o
 obj-$(CONFIG_ATALK)	+= p8022.o psnap.o
#7 lore raw

PATCH 7/15 misc: Make x86 doublefault handling optional

This adds configurable support for doublefault reporting on x86

add/remove: 0/3 grow/shrink: 0/1 up/down: 0/-13048 (-13048)

function                                     old     new   delta
cpu_init                                     846     786     -60
doublefault_fn                               188       -    -188
doublefault_stack                           4096       -   -4096
doublefault_tss                             8704       -   -8704
arch/i386/kernel/Makefile +2 -1
Index: 2.6.14-misc/arch/i386/kernel/Makefile
===================================================================
@@ -7,7 +7,7 @@ extra-y := head.o init_task.o vmlinux.ld
 obj-y	:= process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
 		ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
 		pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \
-		doublefault.o quirks.o i8237.o
+		quirks.o i8237.o
 
 obj-y				+= cpu/
 obj-y				+= timers/
@@ -33,6 +33,7 @@ obj-y				+= 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
+obj-$(CONFIG_DOUBLEFAULT) 	+= doublefault.o
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 
 EXTRA_AFLAGS   := -traditional
arch/i386/kernel/cpu/common.c +2 -0
Index: 2.6.14-misc/arch/i386/kernel/cpu/common.c
===================================================================
@@ -628,8 +628,10 @@ void __devinit cpu_init(void)
 	load_TR_desc();
 	load_LDT(&init_mm.context);
 
+#ifdef CONFIG_DOUBLEFAULT
 	/* Set up doublefault TSS pointer in the GDT */
 	__set_tss_desc(cpu, GDT_ENTRY_DOUBLEFAULT_TSS, &doublefault_tss);
+#endif
 
 	/* Clear %fs and %gs. */
 	asm volatile ("xorl %eax, %eax; movl %eax, %fs; movl %eax, %gs");
init/Kconfig +9 -0
Index: 2.6.14-misc/init/Kconfig
===================================================================
@@ -315,6 +315,15 @@ config BUG
           option for embedded systems with no facilities for reporting errors.
           Just say Y.
 
+config DOUBLEFAULT
+	depends X86
+	default y if X86
+	bool "Enable doublefault exception handler" if EMBEDDED
+	help
+          This option allows trapping of rare doublefault exceptions that
+          would otherwise cause a system to silently reboot. Disabling this
+          option saves about 4k.
+
 config BASE_FULL
 	default y
 	bool "Enable full-sized data structures for core" if EMBEDDED
#8 lore raw

PATCH 8/15 misc: Make vm86 support optional

Make vm86 support optional

add/remove: 0/14 grow/shrink: 0/5 up/down: 0/-5221 (-5221)

function                                     old     new   delta
do_simd_coprocessor_error                    133     132      -1
irqbits                                        4       -      -4
irqbits_lock                                   8       -      -8
release_thread                                72      52     -20
do_debug                                     212     186     -26
do_general_protection                        475     428     -47
do_trap                                      196     140     -56
release_vm86_irqs                            112       -    -112
vm86_irqs                                    128       -    -128
sys_vm86old                                  146       -    -146
irq_handler                                  151       -    -151
mark_screen_rdonly                           159       -    -159
sys_vm86                                     199       -    -199
handle_vm86_trap                             231       -    -231
save_v86_state                               339       -    -339
do_sys_vm86                                  379       -    -379
do_vm86_irq_handling                         482       -    -482
do_int                                       508       -    -508
handle_vm86_fault                           2225       -   -2225
arch/i386/kernel/entry.S +9 -1
Index: 2.6.14-misc/arch/i386/kernel/entry.S
===================================================================
@@ -313,15 +313,21 @@ work_resched:
 
 work_notifysig:				# deal with pending signals and
 					# notify-resume requests
-	testl $VM_MASK, EFLAGS(%esp)
 	movl %esp, %eax
+
+#ifdef CONFIG_VM86
+	testl $VM_MASK, EFLAGS(%esp)
 	jne work_notifysig_v86		# returning to kernel-space or
 					# vm86-space
+#endif
+
 	xorl %edx, %edx
 	call do_notify_resume
 	jmp resume_userspace
 
 	ALIGN
+
+#ifdef CONFIG_VM86
 work_notifysig_v86:
 	pushl %ecx			# save ti_flags for do_notify_resume
 	call save_v86_state		# %eax contains pt_regs pointer
@@ -333,6 +339,8 @@ work_notifysig_v86:
 
 	# perform syscall exit tracing
 	ALIGN
+#endif
+
 syscall_trace_entry:
 	movl $-ENOSYS,EAX(%esp)
 	movl %esp, %eax
arch/i386/kernel/process.c +2 -0
Index: 2.6.14-misc/arch/i386/kernel/process.c
===================================================================
@@ -428,7 +428,9 @@ void release_thread(struct task_struct *
 		}
 	}
 
+#ifdef CONFIG_VM86
 	release_vm86_irqs(dead_task);
+#endif
 }
 
 /*
arch/i386/kernel/traps.c +15 -0
Index: 2.6.14-misc/arch/i386/kernel/traps.c
===================================================================
@@ -371,8 +371,10 @@ static void __kprobes do_trap(int trapnr
 	tsk->thread.trap_no = trapnr;
 
 	if (regs->eflags & VM_MASK) {
+#ifdef CONFIG_VM86
 		if (vm86)
 			goto vm86_trap;
+#endif
 		goto trap_signal;
 	}
 
@@ -393,11 +395,13 @@ static void __kprobes do_trap(int trapnr
 		return;
 	}
 
+#ifdef CONFIG_VM86
 	vm86_trap: {
 		int ret = handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, trapnr);
 		if (ret) goto trap_signal;
 		return;
 	}
+#endif
 }
 
 #define DO_ERROR(trapnr, signr, str, name) \
@@ -452,6 +456,7 @@ DO_VM86_ERROR( 3, SIGTRAP, "int3", int3)
 #endif
 DO_VM86_ERROR( 4, SIGSEGV, "overflow", overflow)
 DO_VM86_ERROR( 5, SIGSEGV, "bounds", bounds)
+
 DO_ERROR_INFO( 6, SIGILL,  "invalid operand", invalid_op, ILL_ILLOPN, regs->eip)
 DO_ERROR( 9, SIGFPE,  "coprocessor segment overrun", coprocessor_segment_overrun)
 DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
@@ -497,8 +502,10 @@ fastcall void __kprobes do_general_prote
 	current->thread.error_code = error_code;
 	current->thread.trap_no = 13;
 
+#ifdef CONFIG_VM86
 	if (regs->eflags & VM_MASK)
 		goto gp_in_vm86;
+#endif
 
 	if (!user_mode(regs))
 		goto gp_in_kernel;
@@ -508,10 +515,12 @@ fastcall void __kprobes do_general_prote
 	force_sig(SIGSEGV, current);
 	return;
 
+#ifdef CONFIG_VM86
 gp_in_vm86:
 	local_irq_enable();
 	handle_vm86_fault((struct kernel_vm86_regs *) regs, error_code);
 	return;
+#endif
 
 gp_in_kernel:
 	if (!fixup_exception(regs)) {
@@ -732,8 +741,10 @@ fastcall void __kprobes do_debug(struct 
 			goto clear_dr7;
 	}
 
+#ifdef CONFIG_VM86
 	if (regs->eflags & VM_MASK)
 		goto debug_vm86;
+#endif
 
 	/* Save debug status register where ptrace can see it */
 	tsk->thread.debugreg[6] = condition;
@@ -762,9 +773,11 @@ clear_dr7:
 	set_debugreg(0, 7);
 	return;
 
+#ifdef CONFIG_VM86
 debug_vm86:
 	handle_vm86_trap((struct kernel_vm86_regs *) regs, error_code, 1);
 	return;
+#endif
 
 clear_TF_reenable:
 	set_tsk_thread_flag(tsk, TIF_SINGLESTEP);
@@ -902,11 +915,13 @@ fastcall void do_simd_coprocessor_error(
 		 * Handle strange cache flush from user space exception
 		 * in all other cases.  This is undocumented behaviour.
 		 */
+#ifdef CONFIG_VM86
 		if (regs->eflags & VM_MASK) {
 			handle_vm86_fault((struct kernel_vm86_regs *)regs,
 					  error_code);
 			return;
 		}
+#endif
 		current->thread.trap_no = 19;
 		current->thread.error_code = error_code;
 		die_if_kernel("cache flush denied", regs, error_code);
arch/i386/kernel/vm86.c +0 -1
Index: 2.6.14-misc/arch/i386/kernel/vm86.c
===================================================================
@@ -805,4 +805,3 @@ static int do_vm86_irq_handling(int subf
 	}
 	return -EINVAL;
 }
-
arch/i386/kernel/Makefile +2 -1
Index: 2.6.14-misc/arch/i386/kernel/Makefile
===================================================================
@@ -4,7 +4,7 @@
 
 extra-y := head.o init_task.o vmlinux.lds
 
-obj-y	:= process.o semaphore.o signal.o entry.o traps.o irq.o vm86.o \
+obj-y	:= process.o semaphore.o signal.o entry.o traps.o irq.o \
 		ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
 		pci-dma.o i386_ksyms.o i387.o dmi_scan.o bootflag.o \
 		quirks.o i8237.o
@@ -34,6 +34,7 @@ obj-$(CONFIG_ACPI_SRAT) 	+= srat.o
 obj-$(CONFIG_HPET_TIMER) 	+= time_hpet.o
 obj-$(CONFIG_EFI) 		+= efi.o efi_stub.o
 obj-$(CONFIG_DOUBLEFAULT) 	+= doublefault.o
+obj-$(CONFIG_VM86)		+= vm86.o
 obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
 
 EXTRA_AFLAGS   := -traditional
arch/i386/kernel/sys_i386.c +1 -0
Index: 2.6.14-misc/arch/i386/kernel/sys_i386.c
===================================================================
@@ -22,6 +22,7 @@
 
 #include <asm/uaccess.h>
 #include <asm/ipc.h>
+#include <asm/unistd.h>
 
 /*
  * sys_pipe() is the normal C calling standard for creating
init/Kconfig +10 -0
Index: 2.6.14-misc/init/Kconfig
===================================================================
@@ -347,6 +347,16 @@ config EPOLL
 	  Disabling this option will cause the kernel to be built without
 	  support for epoll family of system calls.
 
+config VM86
+	depends X86
+	default y
+	bool "Enable VM86 support" if EMBEDDED
+	help
+          This option is required by programs like DOSEMU to run 16-bit legacy
+	  code on X86 processors. It also may be needed by software like
+          XFree86 to initialize some video cards via BIOS. Disabling this
+          option saves about 6k.
+
 config CC_OPTIMIZE_FOR_SIZE
 	bool "Optimize for size" if EMBEDDED
 	default y if ARM || H8300
kernel/sys_ni.c +2 -0
Index: 2.6.14-misc/kernel/sys_ni.c
===================================================================
@@ -82,6 +82,8 @@ cond_syscall(compat_sys_socketcall);
 cond_syscall(sys_inotify_init);
 cond_syscall(sys_inotify_add_watch);
 cond_syscall(sys_inotify_rm_watch);
+cond_syscall(sys_vm86old);
+cond_syscall(sys_vm86);
 
 /* arch-specific weak syscall entries */
 cond_syscall(sys_pciconfig_read);
#9 lore raw

PATCH 9/15 misc: Make sysenter support optional

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
arch/i386/kernel/Makefile +1 -1
Index: 2.6.14-misc/arch/i386/kernel/Makefile
===================================================================
@@ -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
arch/i386/kernel/entry.S +8 -1
Index: 2.6.14-misc/arch/i386/kernel/entry.S
===================================================================
@@ -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)
arch/i386/power/cpu.c +2 -0
Index: 2.6.14-misc/arch/i386/power/cpu.c
===================================================================
@@ -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();
include/asm-i386/elf.h +2 -0
Index: 2.6.14-misc/include/asm-i386/elf.h
===================================================================
@@ -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
init/Kconfig +8 -0
Index: 2.6.14-misc/init/Kconfig
===================================================================
@@ -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
arch/i386/kernel/cpu/common.c +2 -0
Index: 2.6.14-misc/arch/i386/kernel/cpu/common.c
===================================================================
@@ -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();
#10 lore raw

PATCH 10/15 misc: Make *[ug]id16 support optional

Configurable 16-bit UID and friends support

This allows turning off the legacy 16 bit UID interfaces on embedded platforms.

text data bss dec hex filename

3330172  529036  190556 4049764  3dcb64 vmlinux-baseline
3328268  529040  190556 4047864  3dc3f8 vmlinux
init/Kconfig +10 -1
Index: 2.6.14-misc/init/Kconfig
===================================================================
@@ -364,7 +364,16 @@ config SYSENTER
 	help
 	  Disabling this feature removes sysenter handling as well as
 	  vsyscall fixmaps.
- 
+
+config UID16
+	bool "Enable 16-bit UID system calls" if EMBEDDED
+	depends !ALPHA && !PPC && !PPC64 && !PARISC && !V850 && !ARCH_S390X
+	depends !X86_64 || IA32_EMULATION
+	depends !SPARC64 || SPARC32_COMPAT
+	help
+	  This enables the legacy 16-bit UID syscall wrappers.
+
+
 config CC_OPTIMIZE_FOR_SIZE
 	bool "Optimize for size" if EMBEDDED
 	default y if ARM || H8300
arch/sparc/Kconfig +0 -4
Index: 2.6.14-misc/arch/sparc/Kconfig
===================================================================
@@ -9,10 +9,6 @@ config MMU
 	bool
 	default y
 
-config UID16
-	bool
-	default y
-
 config HIGHMEM
 	bool
 	default y
arch/arm26/Kconfig +0 -4
Index: 2.6.14-misc/arch/arm26/Kconfig
===================================================================
@@ -34,10 +34,6 @@ config FORCE_MAX_ZONEORDER
         int
         default 9
 
-config UID16
-	bool
-	default y
-
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
arch/m68k/Kconfig +0 -4
Index: 2.6.14-misc/arch/m68k/Kconfig
===================================================================
@@ -10,10 +10,6 @@ config MMU
 	bool
 	default y
 
-config UID16
-	bool
-	default y
-
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
arch/ppc64/Kconfig +0 -3
Index: 2.6.14-misc/arch/ppc64/Kconfig
===================================================================
@@ -13,9 +13,6 @@ config MMU
 config PPC_STD_MMU
 	def_bool y
 
-config UID16
-	bool
-
 config RWSEM_GENERIC_SPINLOCK
 	bool
 
arch/sh/Kconfig +0 -4
Index: 2.6.14-misc/arch/sh/Kconfig
===================================================================
@@ -14,10 +14,6 @@ config SUPERH
 	  gaming console.  The SuperH port has a home page at
 	  <http://www.linux-sh.org/>.
 
-config UID16
-	bool
-	default y
-
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
arch/s390/Kconfig +0 -5
Index: 2.6.14-misc/arch/s390/Kconfig
===================================================================
@@ -27,11 +27,6 @@ config ARCH_S390
 	bool
 	default y
 
-config UID16
-	bool
-	default y
-	depends on ARCH_S390X = 'n'
-
 source "init/Kconfig"
 
 menu "Base setup"
arch/cris/Kconfig +0 -4
Index: 2.6.14-misc/arch/cris/Kconfig
===================================================================
@@ -9,10 +9,6 @@ config MMU
 	bool
 	default y
 
-config UID16
-	bool
-	default y
-
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
arch/x86_64/Kconfig +0 -5
Index: 2.6.14-misc/arch/x86_64/Kconfig
===================================================================
@@ -517,11 +517,6 @@ config SYSVIPC_COMPAT
 	depends on COMPAT && SYSVIPC
 	default y
 
-config UID16
-	bool
-	depends on IA32_EMULATION
-	default y
-
 endmenu
 
 source "net/Kconfig"
arch/arm/Kconfig +0 -4
Index: 2.6.14-misc/arch/arm/Kconfig
===================================================================
@@ -46,10 +46,6 @@ config MCA
 	  <file:Documentation/mca.txt> (and especially the web page given
 	  there) before attempting to build an MCA bus kernel.
 
-config UID16
-	bool
-	default y
-
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
arch/um/Kconfig +0 -4
Index: 2.6.14-misc/arch/um/Kconfig
===================================================================
@@ -23,10 +23,6 @@ config SBUS
 config PCI
 	bool
 
-config UID16
-	bool
-	default y
-
 config GENERIC_CALIBRATE_DELAY
 	bool
 	default y
arch/m68knommu/Kconfig +0 -4
Index: 2.6.14-misc/arch/m68knommu/Kconfig
===================================================================
@@ -17,10 +17,6 @@ config FPU
 	bool
 	default n
 
-config UID16
-	bool
-	default y
-
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
arch/ppc/Kconfig +0 -3
Index: 2.6.14-misc/arch/ppc/Kconfig
===================================================================
@@ -8,9 +8,6 @@ config MMU
 	bool
 	default y
 
-config UID16
-	bool
-
 config GENERIC_HARDIRQS
 	bool
 	default y
arch/parisc/Kconfig +0 -3
Index: 2.6.14-misc/arch/parisc/Kconfig
===================================================================
@@ -19,9 +19,6 @@ config MMU
 config STACK_GROWSUP
 	def_bool y
 
-config UID16
-	bool
-
 config RWSEM_GENERIC_SPINLOCK
 	def_bool y
 
arch/sparc64/Kconfig +0 -5
Index: 2.6.14-misc/arch/sparc64/Kconfig
===================================================================
@@ -305,11 +305,6 @@ config COMPAT
 	depends on SPARC32_COMPAT
 	default y
 
-config UID16
-	bool
-	depends on SPARC32_COMPAT
-	default y
-
 config BINFMT_ELF32
 	tristate "Kernel support for 32-bit ELF binaries"
 	depends on SPARC32_COMPAT
arch/v850/Kconfig +0 -3
Index: 2.6.14-misc/arch/v850/Kconfig
===================================================================
@@ -10,9 +10,6 @@ mainmenu "uClinux/v850 (w/o MMU) Kernel 
 config MMU
        	bool
 	default n
-config UID16
-	bool
-	default n
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
arch/h8300/Kconfig +0 -4
Index: 2.6.14-misc/arch/h8300/Kconfig
===================================================================
@@ -21,10 +21,6 @@ config FPU
 	bool
 	default n
 
-config UID16
-	bool
-	default y
-
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
arch/alpha/Kconfig +0 -3
Index: 2.6.14-misc/arch/alpha/Kconfig
===================================================================
@@ -18,9 +18,6 @@ config MMU
 	bool
 	default y
 
-config UID16
-	bool
-
 config RWSEM_GENERIC_SPINLOCK
 	bool
 
arch/i386/Kconfig +0 -4
Index: 2.6.14-misc/arch/i386/Kconfig
===================================================================
@@ -29,10 +29,6 @@ config MMU
 config SBUS
 	bool
 
-config UID16
-	bool
-	default y
-
 config GENERIC_ISA_DMA
 	bool
 	default y
kernel/sys_ni.c +19 -0
Index: 2.6.14-misc/kernel/sys_ni.c
===================================================================
@@ -84,6 +84,25 @@ cond_syscall(sys_inotify_add_watch);
 cond_syscall(sys_inotify_rm_watch);
 cond_syscall(sys_vm86old);
 cond_syscall(sys_vm86);
+cond_syscall(sys_chown16);
+cond_syscall(sys_fchown16);
+cond_syscall(sys_getegid16);
+cond_syscall(sys_geteuid16);
+cond_syscall(sys_getgid16);
+cond_syscall(sys_getgroups16);
+cond_syscall(sys_getresgid16);
+cond_syscall(sys_getresuid16);
+cond_syscall(sys_getuid16);
+cond_syscall(sys_lchown16);
+cond_syscall(sys_setfsgid16);
+cond_syscall(sys_setfsuid16);
+cond_syscall(sys_setgid16);
+cond_syscall(sys_setgroups16);
+cond_syscall(sys_setregid16);
+cond_syscall(sys_setresgid16);
+cond_syscall(sys_setresuid16);
+cond_syscall(sys_setreuid16);
+cond_syscall(sys_setuid16);
 
 /* arch-specific weak syscall entries */
 cond_syscall(sys_pciconfig_read);
#11 lore raw

PATCH 11/15 misc: Allow dropping panic text strings from kernel image

Configurable support for panic strings

This drops panic message strings from the kernel image while maintaining normal panic functionality.

$ size vmlinux vmlinux-baseline
   text    data     bss     dec     hex filename
3330172  529036  190556 4049764  3dcb64 vmlinux-baseline
3326488  529036  189532 4045056  3db900 vmlinux
include/linux/kernel.h +5 -0
Index: 2.6.14-misc/include/linux/kernel.h
===================================================================
@@ -87,8 +87,13 @@ extern int cond_resched(void);
 
 extern struct notifier_block *panic_notifier_list;
 extern long (*panic_blink)(long time);
+#ifdef CONFIG_FULL_PANIC
 NORET_TYPE void panic(const char * fmt, ...)
 	__attribute__ ((NORET_AND format (printf, 1, 2)));
+#else
+#define panic(fmt, ...) tiny_panic(0, ## __VA_ARGS__)
+NORET_TYPE void tiny_panic(int a, ...) ATTRIB_NORET;
+#endif
 fastcall NORET_TYPE void do_exit(long error_code)
 	ATTRIB_NORET;
 NORET_TYPE void complete_and_exit(struct completion *, long)
init/Kconfig +8 -0
Index: 2.6.14-misc/init/Kconfig
===================================================================
@@ -324,6 +324,14 @@ config DOUBLEFAULT
           would otherwise cause a system to silently reboot. Disabling this
           option saves about 4k.
 
+config FULL_PANIC
+	default y
+	bool "Full panic reporting data" if EMBEDDED
+	help
+	  This includes text descriptions of panics in addition to stack dumps.
+          Disabling compiles out the explanations for panics, saving
+	  string space. Use with caution.
+
 config BASE_FULL
 	default y
 	bool "Enable full-sized data structures for core" if EMBEDDED
kernel/panic.c +22 -2
Index: 2.6.14-misc/kernel/panic.c
===================================================================
@@ -54,12 +54,18 @@ EXPORT_SYMBOL(panic_blink);
  *
  *	This function never returns.
  */
- 
+
+#ifdef CONFIG_FULL_PANIC
 NORET_TYPE void panic(const char * fmt, ...)
 {
-	long i;
 	static char buf[1024];
 	va_list args;
+#else
+NORET_TYPE void tiny_panic(int a, ...)
+{
+#endif
+	long i;
+
 #if defined(CONFIG_ARCH_S390)
         unsigned long caller = (unsigned long) __builtin_return_address(0);
 #endif
@@ -72,10 +78,16 @@ NORET_TYPE void panic(const char * fmt, 
 	preempt_disable();
 
 	bust_spinlocks(1);
+
+#ifdef CONFIG_FULL_PANIC
 	va_start(args, fmt);
 	vsnprintf(buf, sizeof(buf), fmt, args);
 	va_end(args);
 	printk(KERN_EMERG "Kernel panic - not syncing: %s\n",buf);
+#else
+	printk(KERN_EMERG "Kernel panic - not syncing\n");
+#endif
+
 	bust_spinlocks(0);
 
 	/*
@@ -94,7 +106,11 @@ NORET_TYPE void panic(const char * fmt, 
 	smp_send_stop();
 #endif
 
+#ifdef CONFIG_FULL_PANIC
 	notifier_call_chain(&panic_notifier_list, 0, buf);
+#else
+	notifier_call_chain(&panic_notifier_list, 0, "");
+#endif
 
 	if (!panic_blink)
 		panic_blink = no_blink;
@@ -136,7 +152,11 @@ NORET_TYPE void panic(const char * fmt, 
 	}
 }
 
+#ifdef CONFIG_FULL_PANIC
 EXPORT_SYMBOL(panic);
+#else
+EXPORT_SYMBOL(tiny_panic);
+#endif
 
 /**
  *	print_tainted - return a string to represent the kernel taint state.
#12 lore raw

PATCH 12/15 misc: Configurable panic support

Configurable no-op of panic()

Similar to disabling printk and BUG_ON, this allows completely removing the panic infrastructure for systems where it isn't useful.

text data bss dec hex

3330172  529036  190556 4049764  3dcb64 baseline
3324560  529016  189532 4043108  3db164 no-panic
init/Kconfig +9 -0
Index: 2.6.14-misc/init/Kconfig
===================================================================
@@ -324,7 +324,16 @@ config DOUBLEFAULT
           would otherwise cause a system to silently reboot. Disabling this
           option saves about 4k.
 
+config PANIC
+	default y
+	bool "Enable panic reporting code" if EMBEDDED
+	help
+	  Disabling this completely removes panic handling code.
+          Warning: this can result in data loss if a panic condition
+          occurs, as the kernel may ignore the condition entirely.
+
 config FULL_PANIC
+        depends PANIC
 	default y
 	bool "Full panic reporting data" if EMBEDDED
 	help
init/main.c +1 -0
Index: 2.6.14-misc/init/main.c
===================================================================
@@ -742,4 +742,5 @@ static int init(void * unused)
 	run_init_process("/bin/sh");
 
 	panic("No init found.  Try passing init= option to kernel.");
+	return 0;
 }
kernel/panic.c +6 -4
Index: 2.6.14-misc/kernel/panic.c
===================================================================
@@ -37,15 +37,16 @@ static int __init panic_setup(char *str)
 }
 __setup("panic=", panic_setup);
 
+/* Returns how long it waited in ms */
+long (*panic_blink)(long time);
+EXPORT_SYMBOL(panic_blink);
+
+#ifdef CONFIG_PANIC
 static long no_blink(long time)
 {
 	return 0;
 }
 
-/* Returns how long it waited in ms */
-long (*panic_blink)(long time);
-EXPORT_SYMBOL(panic_blink);
-
 /**
  *	panic - halt the system
  *	@fmt: The text string to print
@@ -157,6 +158,7 @@ EXPORT_SYMBOL(panic);
 #else
 EXPORT_SYMBOL(tiny_panic);
 #endif
+#endif
 
 /**
  *	print_tainted - return a string to represent the kernel taint state.
include/linux/kernel.h +6 -0
Index: 2.6.14-misc/include/linux/kernel.h
===================================================================
@@ -87,6 +87,11 @@ extern int cond_resched(void);
 
 extern struct notifier_block *panic_notifier_list;
 extern long (*panic_blink)(long time);
+#ifndef CONFIG_PANIC
+NORET_TYPE static inline void panic(const char * fmt, ...)
+	__attribute__ ((NORET_AND format (printf, 1, 2)));
+NORET_TYPE static inline void panic(const char * fmt, ...) {}
+#else
 #ifdef CONFIG_FULL_PANIC
 NORET_TYPE void panic(const char * fmt, ...)
 	__attribute__ ((NORET_AND format (printf, 1, 2)));
@@ -94,6 +99,7 @@ NORET_TYPE void panic(const char * fmt, 
 #define panic(fmt, ...) tiny_panic(0, ## __VA_ARGS__)
 NORET_TYPE void tiny_panic(int a, ...) ATTRIB_NORET;
 #endif
+#endif
 fastcall NORET_TYPE void do_exit(long error_code)
 	ATTRIB_NORET;
 NORET_TYPE void complete_and_exit(struct completion *, long)
#13 lore raw

PATCH 13/15 misc: Configure ELF core dump support

configurable support for ELF core dumps

text data bss dec hex filename

3330172  529036  190556 4049764  3dcb64 vmlinux-baseline
3325552  528912  190556 4045020  3db8dc vmlinux-no-elf

add/remove: 0/8 grow/shrink: 0/0 up/down: 0/-4424 (-4424)
function old new delta

fill_note                                     32       -     -32
maydump                                       58       -     -58
dump_seek                                     67       -     -67
writenote                                    180       -    -180
elf_dump_thread_status                       274       -    -274
fill_psinfo                                  308       -    -308
fill_prstatus                                466       -    -466
elf_core_dump                               3039       -   -3039
fs/binfmt_elf.c +2 -2
Index: 2.6.14-misc/fs/binfmt_elf.c
===================================================================
@@ -58,7 +58,7 @@ extern int dump_fpu (struct pt_regs *, e
  * If we don't support core dumping, then supply a NULL so we
  * don't even try.
  */
-#ifdef USE_ELF_CORE_DUMP
+#if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE)
 static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file);
 #else
 #define elf_core_dump	NULL
@@ -1108,7 +1108,7 @@ out:
  * Note that some platforms still use traditional core dumps and not
  * the ELF core dump.  Each platform can select it as appropriate.
  */
-#ifdef USE_ELF_CORE_DUMP
+#if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE)
 
 /*
  * ELF core dumper
init/Kconfig +6 -0
Index: 2.6.14-misc/init/Kconfig
===================================================================
@@ -341,6 +341,12 @@ config FULL_PANIC
           Disabling compiles out the explanations for panics, saving
 	  string space. Use with caution.
 
+config ELF_CORE
+	default y
+	bool "Enable ELF core dumps" if EMBEDDED
+	help
+	  Enable support for generating core dumps. Disabling saves about 4k.
+
 config BASE_FULL
 	default y
 	bool "Enable full-sized data structures for core" if EMBEDDED
#14 lore raw

PATCH 14/15 misc: Configurable number of supported IDE interfaces

Configurable number of supported IDE interfaces

This overrides the default limit (which may be set per arch with CONFIG_IDE_MAX_HWIFS). This is the result of setting interfaces to 1:

text data bss dec hex filename

3330172  529036  190556 4049764  3dcb64 vmlinux-baseline
3329352  528928  172124 4030404  3d7fc4 vmlinux
drivers/ide/setup-pci.c +1 -1
Index: 2.6.14-misc/drivers/ide/setup-pci.c
===================================================================
@@ -102,7 +102,7 @@ static ide_hwif_t *ide_match_hwif(unsign
 				return hwif;	/* pick an unused entry */
 		}
 	}
-	for (h = 0; h < 2; ++h) {
+	for (h = 0; h < 2 && h < MAX_HWIFS; ++h) {
 		hwif = ide_hwifs + h;
 		if (hwif->chipset == ide_unknown)
 			return hwif;	/* pick an unused entry */
include/linux/ide.h +5 -0
Index: 2.6.14-misc/include/linux/ide.h
===================================================================
@@ -309,6 +309,11 @@ static inline void ide_init_hwif_ports(h
 }
 #endif /* IDE_ARCH_OBSOLETE_INIT */
 
+#if defined(CONFIG_IDE_HWIFS) && CONFIG_IDE_HWIFS > 0
+#undef MAX_HWIFS
+#define MAX_HWIFS CONFIG_IDE_HWIFS
+#endif
+
 /* Currently only m68k, apus and m8xx need it */
 #ifndef IDE_ARCH_ACK_INTR
 # define ide_ack_intr(hwif) (1)
init/Kconfig +9 -0
Index: 2.6.14-misc/init/Kconfig
===================================================================
@@ -457,6 +457,15 @@ config CC_ALIGN_JUMPS
 	  no dummy operations need be executed.
 	  Zero means use compiler's default.
 
+config IDE_HWIFS
+	depends IDE
+	int "Number of IDE hardware interfaces (0 for default)" if EMBEDDED
+	range 0 20
+	default 0
+	help
+	  Select the maximum number of IDE interfaces (0 for default).
+          Saves up to 14k.
+
 endmenu		# General setup
 
 config TINY_SHMEM
#15 lore raw

PATCH 15/15 misc: Configurable support for PCI serial ports

Configurable support for PCI serial devices

This allows disabling support for _non_-legacy PCI serial devices.

text data bss dec hex filename

3332260  529420  190812 4052492  3dd60c vmlinux
3327944  523060  190812 4041816  3dac58 vmlinux-pci-serial
drivers/serial/Makefile +1 -1
Index: 2.6.14-misc/drivers/serial/Makefile
===================================================================
@@ -8,7 +8,7 @@ serial-8250-y :=
 serial-8250-$(CONFIG_SERIAL_8250_ACPI) += 8250_acpi.o
 serial-8250-$(CONFIG_PNP) += 8250_pnp.o
 serial-8250-$(CONFIG_GSC) += 8250_gsc.o
-serial-8250-$(CONFIG_PCI) += 8250_pci.o
+serial-8250-$(CONFIG_SERIAL_PCI) += 8250_pci.o
 serial-8250-$(CONFIG_HP300) += 8250_hp300.o
 
 obj-$(CONFIG_SERIAL_CORE) += serial_core.o
init/Kconfig +9 -0
Index: 2.6.14-misc/init/Kconfig
===================================================================
@@ -473,6 +473,15 @@ config BOOTFLAG
 	help
 	  This enables support for the Simple Bootflag Specification.
 
+config SERIAL_PCI
+	depends PCI && SERIAL_8250
+	default y
+	bool "Enable standard PCI serial support" if EMBEDDED
+	help
+	  This builds standard PCI serial support. You may be able to disable
+          this feature if you are only need legacy serial support.
+	  Saves about 9K.
+
 endmenu		# General setup
 
 config TINY_SHMEM
#16 lore raw

Re: [PATCH 15/15] misc: Configurable support for PCI serial ports

init/Kconfig config BOOTFLAG · line 482

Quoted 13 lines · Matt Mackall
init/Kconfig +7 -0
@@ -473,6 +473,15 @@ config BOOTFLAG
 	help
 	  This enables support for the Simple Bootflag Specification.
 
+config SERIAL_PCI
+	depends PCI && SERIAL_8250
+	default y
+	bool "Enable standard PCI serial support" if EMBEDDED
+	help
+	  This builds standard PCI serial support. You may be able to disable
+          this feature if you are only need legacy serial support.
                                 ^^^

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#17 lore raw

Re: [PATCH 15/15] misc: Configurable support for PCI serial ports

In reply to Matt Mackall
Quoted 3 lines · Matt Mackall

Configurable support for PCI serial devices

This allows disabling support for _non_-legacy PCI serial devices.

Why is the config for SERIAL_PCI in init/Kconfig rather than drivers/serial/Kconfig ?

Quoted 18 lines
init/Kconfig +9 -0
@@ -473,6 +473,15 @@ config BOOTFLAG
 	help
 	  This enables support for the Simple Bootflag Specification.
 
+config SERIAL_PCI
+	depends PCI && SERIAL_8250
+	default y
+	bool "Enable standard PCI serial support" if EMBEDDED
+	help
+	  This builds standard PCI serial support. You may be able to disable
+          this feature if you are only need legacy serial support.
+	  Saves about 9K.
+
 endmenu		# General setup
 
 config TINY_SHMEM
Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
#18 lore raw

Re: [PATCH 15/15] misc: Configurable support for PCI serial ports

Quoted 7 lines · Russell King
Quoted 3 lines · Matt Mackall

Configurable support for PCI serial devices

This allows disabling support for _non_-legacy PCI serial devices.

Why is the config for SERIAL_PCI in init/Kconfig rather than drivers/serial/Kconfig ?

No good reason, will fix.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#19 lore raw

Re: [PATCH 14/15] misc: Configurable number of supported IDE interfaces

In reply to Matt Mackall

You are duplicating functionality of CONFIG_IDE_MAX_HWIFS, please find a way to use it for EMBEDDED.

Also please cc: linux-ide on IDE related patches.

Quoted 60 lines · Matt Mackall

Configurable number of supported IDE interfaces

This overrides the default limit (which may be set per arch with CONFIG_IDE_MAX_HWIFS). This is the result of setting interfaces to 1:

text data bss dec hex filename

3330172  529036  190556 4049764  3dcb64 vmlinux-baseline
3329352  528928  172124 4030404  3d7fc4 vmlinux

Index: 2.6.14-misc/drivers/ide/setup-pci.c
===================================================================

drivers/ide/setup-pci.c 2005-11-09 11:27:23.000000000 -0800 renamed from drivers/ide/setup-pci.c 2005-10-27 17:02:08.000000000 -0700 +1 -1
@@ -102,7 +102,7 @@ static ide_hwif_t *ide_match_hwif(unsign
                                return hwif;    /* pick an unused entry */
                }
        }
-       for (h = 0; h < 2; ++h) {
+       for (h = 0; h < 2 && h < MAX_HWIFS; ++h) {
                hwif = ide_hwifs + h;
                if (hwif->chipset == ide_unknown)
                        return hwif;    /* pick an unused entry */

Index: 2.6.14-misc/include/linux/ide.h
===================================================================

include/linux/ide.h 2005-11-09 11:27:23.000000000 -0800 renamed from include/linux/ide.h 2005-11-01 10:54:33.000000000 -0800 +5 -0
@@ -309,6 +309,11 @@ static inline void ide_init_hwif_ports(h
 }
 #endif /* IDE_ARCH_OBSOLETE_INIT */
 
+#if defined(CONFIG_IDE_HWIFS) && CONFIG_IDE_HWIFS > 0
+#undef MAX_HWIFS
+#define MAX_HWIFS CONFIG_IDE_HWIFS
+#endif
+
 /* Currently only m68k, apus and m8xx need it */
 #ifndef IDE_ARCH_ACK_INTR
 # define ide_ack_intr(hwif) (1)

Index: 2.6.14-misc/init/Kconfig
===================================================================

init/Kconfig 2005-11-09 11:27:23.000000000 -0800 renamed from init/Kconfig 2005-11-09 11:27:20.000000000 -0800 +9 -0
@@ -457,6 +457,15 @@ config CC_ALIGN_JUMPS
          no dummy operations need be executed.
          Zero means use compiler's default.
 
+config IDE_HWIFS
+       depends IDE
+       int "Number of IDE hardware interfaces (0 for default)" if EMBEDDED
+       range 0 20
+       default 0
+       help
+         Select the maximum number of IDE interfaces (0 for default).
+          Saves up to 14k.
+
 endmenu                # General setup
 
 config TINY_SHMEM
#20 lore raw

Re: [PATCH 14/15] misc: Configurable number of supported IDE interfaces

On Fri, Nov 11, 2005 at 11:14:08AM +0100, Bartlomiej Zolnierkiewicz wrote:
[top-posting adjusted]

Quoted 5 lines
Quoted 2 lines

This overrides the default limit (which may be set per arch with CONFIG_IDE_MAX_HWIFS). This is the result of setting interfaces to 1:

You are duplicating functionality of CONFIG_IDE_MAX_HWIFS, please find a way to use it for EMBEDDED.

It's intentional. The current CONFIG_IDE_MAX_HWIFS is a hidden variable that sets a per architecture maximum. To the best of my knowledge, there's no way to do, say:

default 4 if ARCH_FOO
default 1 if ARCH_BAR

..so I'm stuck with using two config symbols anyway.

I've thought about it, this is the best I could come up with. If you can come up with something cleaner, I'm all ears.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#21 lore raw

Re: [PATCH 14/15] misc: Configurable number of supported IDE interfaces

Hi,

Quoted 8 lines · Matt Mackall

It's intentional. The current CONFIG_IDE_MAX_HWIFS is a hidden variable that sets a per architecture maximum. To the best of my knowledge, there's no way to do, say:

default 4 if ARCH_FOO
default 1 if ARCH_BAR

..so I'm stuck with using two config symbols anyway.

Where is the problem? This should work fine. With the latest kernel you can even use a dynamic range:

config IDE_HWIFS

	int "..."
	range 1 IDE_MAX_HWIFS

bye, Roman

#22 lore raw

Re: [PATCH 14/15] misc: Configurable number of supported IDE interfaces

Quoted 8 lines · Roman Zippel

Hi,

Quoted 4 lines · Matt Mackall

It's intentional. The current CONFIG_IDE_MAX_HWIFS is a hidden variable that sets a per architecture maximum. To the best of my knowledge, there's no way to do, say:

Quoted 6 lines
Quoted 4 lines

default 4 if ARCH_FOO
default 1 if ARCH_BAR

..so I'm stuck with using two config symbols anyway.

Where is the problem? This should work fine.

Does it? Didn't work when last I checked (which was a while ago).

Quoted 5 lines

With the latest kernel you can even use a dynamic range:

config IDE_HWIFS

	int "..."
	range 1 IDE_MAX_HWIFS

But this suggests a good reason to hold on to both variables.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#23 lore raw

Re: [PATCH 14/15] misc: Configurable number of supported IDE interfaces

Quoted 7 lines · Matt Mackall
Quoted 5 lines

With the latest kernel you can even use a dynamic range:

config IDE_HWIFS

	int "..."
	range 1 IDE_MAX_HWIFS

But this suggests a good reason to hold on to both variables.

..except that not all arches define it. In fact, only sh and Alpha do.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#24 lore raw

Re: [PATCH 14/15] misc: Configurable number of supported IDE interfaces

In reply to Matt Mackall

Hi,

Quoted 4 lines · Matt Mackall
Quoted 4 lines
Quoted 4 lines

It's intentional. The current CONFIG_IDE_MAX_HWIFS is a hidden variable that sets a per architecture maximum. To the best of my knowledge, there's no way to do, say:

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

default 4 if ARCH_FOO
default 1 if ARCH_BAR

..so I'm stuck with using two config symbols anyway.

Where is the problem? This should work fine.

Does it? Didn't work when last I checked (which was a while ago).

I don't know what you tried, for me it does.

Quoted 7 lines
Quoted 5 lines

With the latest kernel you can even use a dynamic range:

config IDE_HWIFS

	int "..."
	range 1 IDE_MAX_HWIFS

But this suggests a good reason to hold on to both variables.

You _can_ use it, I didn't say you have to use it.

bye, Roman

#25 lore raw

Re: [PATCH 11/15] misc: Allow dropping panic text strings from kernel image

In reply to Matt Mackall

kernel/panic.c NORET_TYPE void panic(const char * fmt, · line 113

Quoted 13 lines · Matt Mackall

Index: 2.6.14-misc/kernel/panic.c
===================================================================

kernel/panic.c +4 -0
@@ -94,7 +106,11 @@ NORET_TYPE void panic(const char * fmt, 
 	smp_send_stop();
 #endif
 
+#ifdef CONFIG_FULL_PANIC
 	notifier_call_chain(&panic_notifier_list, 0, buf);
+#else
+	notifier_call_chain(&panic_notifier_list, 0, "");
+#endif

If you `#define buf ""' above, you can kill this #ifdef.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#26 lore raw

Re: [PATCH 11/15] misc: Allow dropping panic text strings from kernel image

Quoted 9 lines · Geert Uytterhoeven
Quoted 8 lines · Matt Mackall

Index: 2.6.14-misc/kernel/panic.c
===================================================================

kernel/panic.c +0 -0
@@ -94,7 +106,11 @@ NORET_TYPE void panic(const char * fmt, 
 	smp_send_stop();
 #endif
 
Quoted 7 lines

kernel/panic.c NORET_TYPE void panic(const char * fmt, · line 113

Quoted 5 lines
kernel/panic.c +4 -0
+#ifdef CONFIG_FULL_PANIC
 	notifier_call_chain(&panic_notifier_list, 0, buf);
+#else
+	notifier_call_chain(&panic_notifier_list, 0, "");
+#endif

If you `#define buf ""' above, you can kill this #ifdef.

I don't know that trading an ifdef for a define is an improvement.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#27 lore raw

Re: [PATCH 11/15] misc: Allow dropping panic text strings from kernel image

In reply to Matt Mackall
Quoted 2 lines · Matt Mackall

Configurable support for panic strings

This does make a bit of a mess. You could lose one ifdef by leaving `buf' present in panic(), as

	static char buf[1];

But still, a bit more inventiveness is needed, IMO.

#28 lore raw

Re: [PATCH 10/15] misc: Make *[ug]id16 support optional

In reply to Matt Mackall
Quoted 15 lines · Matt Mackall

Configurable 16-bit UID and friends support

This allows turning off the legacy 16 bit UID interfaces on embedded platforms.

text data bss dec hex filename

3330172  529036  190556 4049764  3dcb64 vmlinux-baseline
3328268  529040  190556 4047864  3dc3f8 vmlinux

Index: 2.6.14-misc/init/Kconfig
===================================================================

init/Kconfig config SYSENTER · line 370

Quoted 8 lines
init/Kconfig +4 -1
@@ -364,7 +364,16 @@ config SYSENTER
 	help
 	  Disabling this feature removes sysenter handling as well as
 	  vsyscall fixmaps.
- 
+
+config UID16
+	bool "Enable 16-bit UID system calls" if EMBEDDED
+	depends !ALPHA && !PPC && !PPC64 && !PARISC && !V850 && !ARCH_S390X

Wouldn't it be better to explicitly list the architectures that support it? I assume new architectures won't implement it anyway?

init/Kconfig config SYSENTER · line 372

Quoted 2 lines
init/Kconfig +2 -0
+	depends !X86_64 || IA32_EMULATION
+	depends !SPARC64 || SPARC32_COMPAT

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#29 lore raw

Re: [PATCH 10/15] misc: Make *[ug]id16 support optional

In reply to Matt Mackall
Quoted 4 lines · Matt Mackall

Configurable 16-bit UID and friends support

This allows turning off the legacy 16 bit UID interfaces on embedded platforms.

Is there an easy way to make sure our programs aren't using these? (If I build a new system from source with busybox and uclibc, how do I know if I can disable this?)

The help text is highly unrevealing...

Rob

#30 lore raw

Re: [PATCH 10/15] misc: Make *[ug]id16 support optional

Quoted 9 lines · Rob Landley
Quoted 4 lines · Matt Mackall

Configurable 16-bit UID and friends support

This allows turning off the legacy 16 bit UID interfaces on embedded platforms.

Is there an easy way to make sure our programs aren't using these? (If I build a new system from source with busybox and uclibc, how do I know if I can disable this?)

These should only be found in legacy binaries, ie 5+ years old.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#31 lore raw

Re: [PATCH 10/15] misc: Make *[ug]id16 support optional

Quoted 4 lines · Matt Mackall
Quoted 1 line · Rob Landley

Is there an easy way to make sure our programs aren't using these? (If I build a new system from source with busybox and uclibc, how do I know if I can disable this?)

These should only be found in legacy binaries, ie 5+ years old.

Not true, unfortunately. To make uClibc work with linux-tiny and [ug]id16 disabled one has to apply patches like this. uClibc probably assumes 16 bit __kernel_[ug]id_t and uses legacy syscalls exclusively.

libc/sysdeps/linux/common/chown.c +1 -6
@@ -10,16 +10,11 @@
 #include "syscalls.h"
 #include <unistd.h>
 
-#define __NR___syscall_chown __NR_chown
+#define __NR___syscall_chown __NR_chown32
 static inline _syscall3(int, __syscall_chown, const char *, path,
                __kernel_uid_t, owner, __kernel_gid_t, group);
 
 int chown(const char *path, uid_t owner, gid_t group)
 {
-       if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
-               || ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
-               __set_errno(EINVAL);
-               return -1;
-       }
        return (__syscall_chown(path, owner, group));
 }
Signature · 2 lines
Zdenek Pavlas
NEXTRA Czech Republic s.r.o.  http://www.nextra.cz
#32 lore raw

Re: [PATCH 10/15] misc: Make *[ug]id16 support optional

Quoted 6 lines · Zdenek Pavlas
Quoted 5 lines · Matt Mackall
Quoted 3 lines · Rob Landley

Is there an easy way to make sure our programs aren't using these? (If I build a new system from source with busybox and uclibc, how do I know if I can disable this?)

Quoted 6 lines
Quoted 1 line

These should only be found in legacy binaries, ie 5+ years old.

Not true, unfortunately. To make uClibc work with linux-tiny and [ug]id16 disabled one has to apply patches like this. uClibc probably assumes 16 bit __kernel_[ug]id_t and uses legacy syscalls exclusively.

They've been fixing that. Working with linux-tiny is definitely something uClibc is interested in. When you say "patches like this", do you have a complete list or is there something we could grep for?

Quoted 10 lines
libc/sysdeps/linux/common/chown.c +1 -1
@@ -10,16 +10,11 @@
  #include "syscalls.h"
  #include <unistd.h>
 
-#define __NR___syscall_chown __NR_chown
+#define __NR___syscall_chown __NR_chown32
  static inline _syscall3(int, __syscall_chown, const char *, path,
                 __kernel_uid_t, owner, __kernel_gid_t, group);

libc/sysdeps/linux/common/chown.c line 20

Quoted 10 lines
libc/sysdeps/linux/common/chown.c +0 -5
 
  int chown(const char *path, uid_t owner, gid_t group)
  {
-       if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
-               || ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
-               __set_errno(EINVAL);
-               return -1;
-       }
         return (__syscall_chown(path, owner, group));
  }

Rob

Signature · 2 lines
Steve Ballmer: Innovation!  Inigo Montoya: You keep using that word.
I do not think it means what you think it means.
#33 lore raw

Re: [PATCH 10/15] misc: Make *[ug]id16 support optional

Quoted 1 line · Rob Landley

They've been fixing that. Working with linux-tiny is definitely something uClibc is interested in. When you say "patches like this", do you have a complete list or is there something we could grep for?

I've made linux-tiny + uClibc + busybox to work with following patch. Very lightly tested, not sure it's correct or complete, but at least stuff like 'su', 'chown' etc started to work.

Signature · 3 lines
Zdenek Pavlas
Application Developer
NEXTRA Czech Republic s.r.o.  http://www.nextra.cz
libc/sysdeps/linux/common/chown.c +1 -6
@@ -10,16 +10,11 @@
 #include "syscalls.h"
 #include <unistd.h>
 
-#define __NR___syscall_chown __NR_chown
+#define __NR___syscall_chown __NR_chown32
 static inline _syscall3(int, __syscall_chown, const char *, path,
 		__kernel_uid_t, owner, __kernel_gid_t, group);
 
 int chown(const char *path, uid_t owner, gid_t group)
 {
-	if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
-		|| ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
-		__set_errno(EINVAL);
-		return -1;
-	}
 	return (__syscall_chown(path, owner, group));
 }
libc/sysdeps/linux/common/fchown.c +1 -6
@@ -10,16 +10,11 @@
 #include "syscalls.h"
 #include <unistd.h>
 
-#define __NR___syscall_fchown __NR_fchown
+#define __NR___syscall_fchown __NR_fchown32
 static inline _syscall3(int, __syscall_fchown, int, fd,
 		__kernel_uid_t, owner, __kernel_gid_t, group);
 
 int fchown(int fd, uid_t owner, gid_t group)
 {
-	if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
-		|| ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
-		__set_errno(EINVAL);
-		return -1;
-	}
 	return (__syscall_fchown(fd, owner, group));
 }
libc/sysdeps/linux/common/getegid.c +1 -1
@@ -11,7 +11,7 @@
 #include <unistd.h>
 
 #ifdef	__NR_getegid
-#define __NR___syscall_getegid __NR_getegid
+#define __NR___syscall_getegid __NR_getegid32
 static inline _syscall0(int, __syscall_getegid);
 gid_t getegid(void)
 {
libc/sysdeps/linux/common/geteuid.c +1 -1
@@ -11,7 +11,7 @@
 #include <unistd.h>
 
 #ifdef	__NR_geteuid
-#define __NR___syscall_geteuid __NR_geteuid
+#define __NR___syscall_geteuid __NR_geteuid32
 static inline _syscall0(int, __syscall_geteuid);
 uid_t geteuid(void)
 {
libc/sysdeps/linux/common/getgid.c +1 -1
@@ -10,7 +10,7 @@
 #include "syscalls.h"
 #include <unistd.h>
 
-#define __NR___syscall_getgid __NR_getgid
+#define __NR___syscall_getgid __NR_getgid32
 #if defined (__alpha__)
 #define __NR_getgid     __NR_getxgid
 #endif
libc/sysdeps/linux/common/getuid.c +1 -1
@@ -13,7 +13,7 @@
 #if defined (__alpha__)
 #define __NR_getuid     __NR_getxuid
 #endif
-#define __NR___syscall_getuid __NR_getuid
+#define __NR___syscall_getuid __NR_getuid32
 
 static inline _syscall0(int, __syscall_getuid);
 
libc/sysdeps/linux/common/lchown.c +1 -6
@@ -10,16 +10,11 @@
 #include "syscalls.h"
 #include <unistd.h>
 
-#define __NR___syscall_lchown __NR_lchown
+#define __NR___syscall_lchown __NR_lchown32
 static inline _syscall3(int, __syscall_lchown, const char *, path,
 		__kernel_uid_t, owner, __kernel_gid_t, group);
 
 int lchown(const char *path, uid_t owner, gid_t group)
 {
-	if (((owner + 1) > (uid_t) ((__kernel_uid_t) - 1U))
-		|| ((group + 1) > (gid_t) ((__kernel_gid_t) - 1U))) {
-		__set_errno(EINVAL);
-		return -1;
-	}
 	return __syscall_lchown(path, owner, group);
 }
libc/sysdeps/linux/common/setegid.c +0 -6
@@ -10,12 +10,6 @@
 {
     int result;
 
-    if (gid == (gid_t) ~0)
-    {
-	__set_errno (EINVAL);
-	return -1;
-    }
-
 #ifdef __NR_setresgid
     result = setresgid(-1, gid, -1);
     if (result == -1 && errno == ENOSYS)
libc/sysdeps/linux/common/seteuid.c +0 -6
@@ -10,12 +10,6 @@
 {
     int result;
 
-    if (uid == (uid_t) ~0)
-    {
-	__set_errno (EINVAL);
-	return -1;
-    }
-
 #ifdef __NR_setresuid
     result = setresuid(-1, uid, -1);
     if (result == -1 && errno == ENOSYS)
libc/sysdeps/linux/common/setgid.c +1 -5
@@ -10,14 +10,10 @@
 #include "syscalls.h"
 #include <unistd.h>
 
-#define __NR___syscall_setgid __NR_setgid
+#define __NR___syscall_setgid __NR_setgid32
 static inline _syscall1(int, __syscall_setgid, __kernel_gid_t, gid);
 
 int setgid(gid_t gid)
 {
-	if (gid == (gid_t) ~ 0 || gid != (gid_t) ((__kernel_gid_t) gid)) {
-		__set_errno(EINVAL);
-		return -1;
-	}
 	return (__syscall_setgid(gid));
 }
libc/sysdeps/linux/common/setgroups.c +1 -1
@@ -11,7 +11,7 @@
 #include <unistd.h>
 #include <grp.h>
 
-#define __NR___syscall_setgroups __NR_setgroups
+#define __NR___syscall_setgroups __NR_setgroups32
 static inline _syscall2(int, __syscall_setgroups,
 		size_t, size, const __kernel_gid_t *, list);
 
libc/sysdeps/linux/common/setuid.c +1 -5
@@ -10,14 +10,10 @@
 #include "syscalls.h"
 #include <unistd.h>
 
-#define __NR___syscall_setuid __NR_setuid
+#define __NR___syscall_setuid __NR_setuid32
 static inline _syscall1(int, __syscall_setuid, __kernel_uid_t, uid);
 
 int setuid(uid_t uid)
 {
-	if (uid == (uid_t) ~ 0 || uid != (uid_t) ((__kernel_uid_t) uid)) {
-		__set_errno(EINVAL);
-		return -1;
-	}
 	return (__syscall_setuid(uid));
 }
#34 lore raw

Re: [PATCH 9/15] misc: Make sysenter support optional

In reply to Matt Mackall
Quoted 24 lines · Matt Mackall

his 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
Quoted 5 lines
 $ 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

Similarly, stub out sysenter_setup() and enable_sep_cpu() and we lose a bunch of ifdefs.

#35 lore raw

Re: [PATCH 8/15] misc: Make vm86 support optional

In reply to Matt Mackall
Quoted 16 lines · Matt Mackall

Make vm86 support optional

add/remove: 0/14 grow/shrink: 0/5 up/down: 0/-5221 (-5221)

function                                     old     new   delta
do_simd_coprocessor_error                    133     132      -1
irqbits                                        4       -      -4
irqbits_lock                                   8       -      -8
release_thread                                72      52     -20
do_debug                                     212     186     -26
do_general_protection                        475     428     -47
do_trap                                      196     140     -56
release_vm86_irqs                            112       -    -112
vm86_irqs                                    128       -    -128
sys_vm86old                                  146       -    -146
irq_handler                                  151       -    -151
Quoted 8 lines
mark_screen_rdonly                           159       -    -159
sys_vm86                                     199       -    -199
handle_vm86_trap                             231       -    -231
save_v86_state                               339       -    -339
do_sys_vm86                                  379       -    -379
do_vm86_irq_handling                         482       -    -482
do_int                                       508       -    -508
handle_vm86_fault                           2225       -   -2225

bix:/usr/src/25> grep '#ifdef' patches/tiny-make-vm86-support-optional.patch +#ifdef CONFIG_VM86
+#ifdef CONFIG_VM86
+#ifdef CONFIG_VM86
+#ifdef CONFIG_VM86
+#ifdef CONFIG_VM86
+#ifdef CONFIG_VM86
+#ifdef CONFIG_VM86
+#ifdef CONFIG_VM86
+#ifdef CONFIG_VM86
+#ifdef CONFIG_VM86

This one has a rather low bytes-to-ifdefs ratio.

I bet you can get most of these benefits by stubbing out handle_vm86_*() and friends and perhaps setting VM_MASK to zero.

#36 lore raw

Re: [PATCH 7/15] misc: Make x86 doublefault handling optional

In reply to Matt Mackall
Quoted 1 line · Matt Mackall

This adds configurable support for doublefault reporting on x86

I think that's a bad idea. Users will disable it and then send bad bug reports. Better bug reports are worth 4K.

-Andi

#37 lore raw

Re: [PATCH 7/15] misc: Make x86 doublefault handling optional

In reply to Matt Mackall
Quoted 1 line · Matt Mackall

This adds configurable support for doublefault reporting on x86

...

Quoted 9 lines
init/Kconfig +7 -0
+config DOUBLEFAULT
+ depends X86
+ default y if X86
+ bool "Enable doublefault exception handler" if EMBEDDED
+ help
+          This option allows trapping of rare doublefault exceptions that
+          would otherwise cause a system to silently reboot. Disabling

this + option saves about 4k.
+

What causes doublefaults? Is it triggerable from userspace, or is it something funky the kernel does?

Trying to figure out when it would be worth using this...

Rob

#38 lore raw

Re: [PATCH 7/15] misc: Make x86 doublefault handling optional

Quoted 15 lines · Rob Landley
Quoted 1 line · Matt Mackall

This adds configurable support for doublefault reporting on x86

...

Quoted 9 lines
init/Kconfig +7 -0
+config DOUBLEFAULT
+ depends X86
+ default y if X86
+ bool "Enable doublefault exception handler" if EMBEDDED
+ help
+          This option allows trapping of rare doublefault exceptions that
+          would otherwise cause a system to silently reboot. Disabling

this + option saves about 4k.
+

What causes doublefaults? Is it triggerable from userspace, or is it something funky the kernel does?

Double faults happen when a fault occurs while entering a fault handler.

They're extremely rare in the field. In my experience, they only occur when you've got hardware troubles or are hacking on the fault handling code. They're rare enough that I showed one to akpm a few months back and he claimed he'd never seen one before.

If a fault occurs while trying to invoke the double fault handler (perhaps because you don't have one), you get a triple fault which causes a reboot.

Quoted 1 line

Trying to figure out when it would be worth using this...

Typical usage for this and similar options is in boxes that have no useful logging or diagnostic facilities.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#39 lore raw

Re: [PATCH 7/15] misc: Make x86 doublefault handling optional

I tend to agree with the spirit of Andi's comment -- disabling this will (I think) make the rare time when it happens into something impossible to debug without a new kernel and reproducing the problem. Not being familiar with EMBEDDED, I am curious whether the savings is critical.

#40 lore raw

Re: [PATCH 7/15] misc: Make x86 doublefault handling optional

Quoted 5 lines · Scott Garfinkle

I tend to agree with the spirit of Andi's comment -- disabling this will (I think) make the rare time when it happens into something impossible to debug without a new kernel and reproducing the problem. Not being familiar with EMBEDDED, I am curious whether the savings is critical.

menuconfig EMBEDDED
bool "Configure standard kernel features (for small systems)" help
This option allows certain base kernel options and settings to be disabled or tweaked. This is for specialized environments which can tolerate a "non-standard" kernel. Only use this if you really know what you are doing.

So yes, Matt's patch does make sense.

cu
Adrian

BTW: Don't strip the Cc when replying to linux-kernel.

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#41 lore raw

Re: [PATCH 7/15] misc: Make x86 doublefault handling optional

In reply to Scott Garfinkle
Quoted 3 lines · Scott Garfinkle

I tend to agree with the spirit of Andi's comment -- disabling this will (I think) make the rare time when it happens into something impossible to debug without a new kernel and reproducing the problem.

in the past couple of years i saw double-faults at a rate of perhaps once a year - and i frequently hack lowlevel glue code! So the usefulness of this code in the field, and especially on an embedded platforms, is extremely limited.

in fact, i've experienced triple-faults (== spontaneous reboots) to be at least 10 times more frequent than double-faults! I.e. _if_ your kernel (or hardware) is screwed up to the degree that it would double-fault, it will much more likely also triple-fault.

IIRC we added the double-fault handler to debug the PAE code originally. Now years down the road, making it configurable-out if EMBEDDED makes lots of sense.

Ingo

#42 lore raw

Re: [PATCH 7/15] misc: Make x86 doublefault handling optional

Quoted 5 lines · Ingo Molnar

in the past couple of years i saw double-faults at a rate of perhaps once a year - and i frequently hack lowlevel glue code! So the usefulness of this code in the field, and especially on an embedded platforms, is extremely limited.

If it only saves an hour or developer time on some bug report it has already justified its value.

Also to really save memory there are much better areas of attack than this relatively slim code.

Quoted 4 lines

in fact, i've experienced triple-faults (== spontaneous reboots) to be at least 10 times more frequent than double-faults! I.e. _if_ your kernel (or hardware) is screwed up to the degree that it would double-fault, it will much more likely also triple-fault.

A common case where this doesn't hold is breaking the [er]sp in kernel code.

-Andi (who sees double faults more often)

#43 lore raw

Re: [PATCH 7/15] misc: Make x86 doublefault handling optional

Quoted 7 lines · Andi Kleen
Quoted 5 lines · Ingo Molnar

in the past couple of years i saw double-faults at a rate of perhaps once a year - and i frequently hack lowlevel glue code! So the usefulness of this code in the field, and especially on an embedded platforms, is extremely limited.

Quoted 5 lines

If it only saves an hour or developer time on some bug report it has already justified its value.

Also to really save memory there are much better areas of attack than this relatively slim code.

Such as? Odds are good I've already attacked them, but I'd be happy for some new ideas.

I think anything easily disabled larger than 1k is a pretty decent target in a minimal config.

Quoted 1 line

-Andi (who sees double faults more often)

You will *not* see them on a platform with no console and no printk, hence CONFIG_EMBEDDED. Can we be done with this yet?

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#44 lore raw

Re: [PATCH 7/15] misc: Make x86 doublefault handling optional

In reply to Andi Kleen
Quoted 9 lines · Andi Kleen
Quoted 5 lines · Ingo Molnar

in the past couple of years i saw double-faults at a rate of perhaps once a year - and i frequently hack lowlevel glue code! So the usefulness of this code in the field, and especially on an embedded platforms, is extremely limited.

If it only saves an hour or developer time on some bug report it has already justified its value.

yes, of course. Are you arguing that all debugging options should be made unconditional? Matt's patch simply makes double-fault-debugging optional. More than that, it will still be unconditionally enabled unless CONFIG_EMBEDDED is specified.

Quoted 2 lines

Also to really save memory there are much better areas of attack than this relatively slim code.

the dynamics of memory reduction patches is just like the dynamics of scalability patches: we have to attack on _every front_ and even then progress will appear to be very slow. We almost never reject a scalability micro-optimization just because there might be larger fruits hanging.

Quoted 9 lines
Quoted 4 lines

in fact, i've experienced triple-faults (== spontaneous reboots) to be at least 10 times more frequent than double-faults! I.e. _if_ your kernel (or hardware) is screwed up to the degree that it would double-fault, it will much more likely also triple-fault.

A common case where this doesn't hold is breaking the [er]sp in kernel code.

-Andi (who sees double faults more often)

yeah. Still, i see no problem with making it optional. (as long as it does not result in significant uglification of the code - which clearly is not a problem for this particular patch.)

Ingo

#45 lore raw

Re: [PATCH 6/15] misc: Trim non-IPX builds

In reply to Matt Mackall
Quoted 20 lines · Matt Mackall

trivial: drop unused 802.3 code if we compile without IPX

(originally from http://wohnheim.fh-wedel.de/~joern/software/kernel/je/25/)

Index: tiny/net/802/Makefile
===================================================================

net/802/Makefile +0 -2
@@ -2,8 +2,6 @@
 # Makefile for the Linux 802.x protocol layers.
 #
 
-obj-y			:= p8023.o
-
 # Check the p8022 selections against net/core/Makefile.
 obj-$(CONFIG_SYSCTL)	+= sysctl_net_802.o
 obj-$(CONFIG_LLC)	+= p8022.o psnap.o

net/802/Makefile obj-$(CONFIG_TR) += p8022.o psnap.o tr.o · line 13

Quoted 6 lines
net/802/Makefile +1 -1
@@ -11,5 +9,5 @@ obj-$(CONFIG_TR)	+= p8022.o psnap.o tr.o
 obj-$(CONFIG_NET_FC)	+=                 fc.o
 obj-$(CONFIG_FDDI)	+=                 fddi.o
 obj-$(CONFIG_HIPPI)	+=                 hippi.o
-obj-$(CONFIG_IPX)	+= p8022.o psnap.o
+obj-$(CONFIG_IPX)	+= p8022.o psnap.o p8023.o
 obj-$(CONFIG_ATALK)	+= p8022.o psnap.o

This patch isn't bad, but looking closer we could move the contents of p8023.c as well as the contents of at least p8022.c and pe2.c into af_ipx.c.

Is the contents of any of these three files expected to be used outside IPX (closest candidate would be appletalk)?

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
#46 lore raw

PATCH 1/1 move some code to net/ipx/af_ipx.c

Quoted 32 lines · Adrian Bunk
Quoted 20 lines · Matt Mackall

trivial: drop unused 802.3 code if we compile without IPX

(originally from http://wohnheim.fh-wedel.de/~joern/software/kernel/je/25/)

Index: tiny/net/802/Makefile
===================================================================

net/802/Makefile +0 -2
@@ -2,8 +2,6 @@
 # Makefile for the Linux 802.x protocol layers.
 #
 
-obj-y			:= p8023.o
-
 # Check the p8022 selections against net/core/Makefile.
 obj-$(CONFIG_SYSCTL)	+= sysctl_net_802.o
 obj-$(CONFIG_LLC)	+= p8022.o psnap.o

net/802/Makefile obj-$(CONFIG_TR) += p8022.o psnap.o tr.o · line 13

Quoted 6 lines
net/802/Makefile +1 -1
@@ -11,5 +9,5 @@ obj-$(CONFIG_TR)	+= p8022.o psnap.o tr.o
 obj-$(CONFIG_NET_FC)	+=                 fc.o
 obj-$(CONFIG_FDDI)	+=                 fddi.o
 obj-$(CONFIG_HIPPI)	+=                 hippi.o
-obj-$(CONFIG_IPX)	+= p8022.o psnap.o
+obj-$(CONFIG_IPX)	+= p8022.o psnap.o p8023.o
 obj-$(CONFIG_ATALK)	+= p8022.o psnap.o

This patch isn't bad, but looking closer we could move the contents of p8023.c as well as the contents of at least p8022.c and pe2.c into af_ipx.c.

Quoted 2 lines

Is the contents of any of these three files expected to be used outside IPX (closest candidate would be appletalk)?

Below is a patch implementing what I was thinking of.

cu
Adrian

<-- snip -->

This patch moves some code only used in this file to net/ipx/af_ipx.c .

---

 include/net/p8022.h   |   13 -----
 net/802/Makefile      |   17 ++-----
 net/802/p8022.c       |   66 ---------------------------
 net/802/p8023.c       |   61 -------------------------
 net/8021q/vlan.c      |    1 
 net/8021q/vlan_dev.c  |    1 
 net/ethernet/Makefile |    2 
 net/ethernet/pe2.c    |   39 ----------------
 net/ipx/af_ipx.c      |  102 ++++++++++++++++++++++++++++++++++++++++--
 9 files changed, 106 insertions(+), 196 deletions(-)
net/802/Makefile renamed from net/802/Makefile.old +7 -10
@@ -2,14 +2,11 @@
 # Makefile for the Linux 802.x protocol layers.
 #
 
-obj-y			:= p8023.o
-
-# Check the p8022 selections against net/core/Makefile.
 obj-$(CONFIG_SYSCTL)	+= sysctl_net_802.o
-obj-$(CONFIG_LLC)	+= p8022.o psnap.o
-obj-$(CONFIG_TR)	+= p8022.o psnap.o tr.o sysctl_net_802.o
-obj-$(CONFIG_NET_FC)	+=                 fc.o
-obj-$(CONFIG_FDDI)	+=                 fddi.o
-obj-$(CONFIG_HIPPI)	+=                 hippi.o
-obj-$(CONFIG_IPX)	+= p8022.o psnap.o
-obj-$(CONFIG_ATALK)	+= p8022.o psnap.o
+obj-$(CONFIG_LLC)	+= psnap.o
+obj-$(CONFIG_TR)	+= psnap.o tr.o sysctl_net_802.o
+obj-$(CONFIG_NET_FC)	+=         fc.o
+obj-$(CONFIG_FDDI)	+=         fddi.o
+obj-$(CONFIG_HIPPI)	+=         hippi.o
+obj-$(CONFIG_IPX)	+= psnap.o
+obj-$(CONFIG_ATALK)	+= psnap.o
net/ethernet/Makefile renamed from net/ethernet/Makefile.old +0 -2
@@ -4,5 +4,3 @@
 
 obj-y					+= eth.o
 obj-$(CONFIG_SYSCTL)			+= sysctl_net_ether.o
-obj-$(subst m,y,$(CONFIG_IPX))		+= pe2.o
-obj-$(subst m,y,$(CONFIG_ATALK))	+= pe2.o
net/8021q/vlan.c renamed from net/8021q/vlan.c.old +0 -1
@@ -26,7 +26,6 @@
 #include <linux/mm.h>
 #include <linux/in.h>
 #include <linux/init.h>
-#include <net/p8022.h>
 #include <net/arp.h>
 #include <linux/rtnetlink.h>
 #include <linux/notifier.h>
net/8021q/vlan_dev.c renamed from net/8021q/vlan_dev.c.old +0 -1
@@ -29,7 +29,6 @@
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <net/datalink.h>
-#include <net/p8022.h>
 #include <net/arp.h>
 
 #include "vlan.h"
net/ipx/af_ipx.c renamed from net/ipx/af_ipx.c.old +99 -3

117 lines not on this page · raw message

include/net/p8022.h deleted +0 -13
@@ -1,13 +0,0 @@
-#ifndef _NET_P8022_H
-#define _NET_P8022_H
-extern struct datalink_proto *
-	register_8022_client(unsigned char type,
-			     int (*func)(struct sk_buff *skb,
-					 struct net_device *dev,
-					 struct packet_type *pt,
-					 struct net_device *orig_dev));
-extern void unregister_8022_client(struct datalink_proto *proto);
-
-extern struct datalink_proto *make_8023_client(void);
-extern void destroy_8023_client(struct datalink_proto *dl);
-#endif
net/ethernet/pe2.c deleted +0 -39
@@ -1,39 +0,0 @@
-#include <linux/in.h>
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-
-#include <net/datalink.h>
-
-static int pEII_request(struct datalink_proto *dl,
-			struct sk_buff *skb, unsigned char *dest_node)
-{
-	struct net_device *dev = skb->dev;
-
-	skb->protocol = htons(ETH_P_IPX);
-	if (dev->hard_header)
-		dev->hard_header(skb, dev, ETH_P_IPX,
-				 dest_node, NULL, skb->len);
-	return dev_queue_xmit(skb);
-}
-
-struct datalink_proto *make_EII_client(void)
-{
-	struct datalink_proto *proto = kmalloc(sizeof(*proto), GFP_ATOMIC);
-
-	if (proto) {
-		proto->header_length = 0;
-		proto->request = pEII_request;
-	}
-
-	return proto;
-}
-
-void destroy_EII_client(struct datalink_proto *dl)
-{
-	kfree(dl);
-}
-
-EXPORT_SYMBOL(destroy_EII_client);
-EXPORT_SYMBOL(make_EII_client);
net/802/p8022.c deleted +0 -66

66 lines not on this page · raw message

net/802/p8023.c deleted +0 -61

61 lines not on this page · raw message

#47 lore raw

Re: [2.6 patch] move some code to net/ipx/af_ipx.c

Quoted 9 lines · Adrian Bunk
Quoted 7 lines

This patch isn't bad, but looking closer we could move the contents of p8023.c as well as the contents of at least p8022.c and pe2.c into af_ipx.c.

Is the contents of any of these three files expected to be used outside IPX (closest candidate would be appletalk)?

Below is a patch implementing what I was thinking of.

Looks reasonable.

Signature · 1 line
Mathematics is the supreme nostalgia of our time.
#49 lore raw

Re: [2.6 patch] move some code to net/ipx/af_ipx.c

Quoted 9 lines · Arnaldo Carvalho de Melo
Quoted 5 lines · Adrian Bunk
Quoted 4 lines · Adrian Bunk
Quoted 3 lines · Matt Mackall

trivial: drop unused 802.3 code if we compile without IPX

(originally from http://wohnheim.fh-wedel.de/~joern/software/kernel/je/25/)

Thanks Adrian, from a quick glance looks OK, I'll review it later today to see if everything is fine wrt appletalk, tr, etc.

Any result from your review?

Quoted 1 line

- Arnaldo

cu
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed