2005-11-11 08:41:23

by Matt Mackall

[permalink] [raw]
Subject: [PATCH 0/15] 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.


2005-11-11 08:36:05

by Matt Mackall

[permalink] [raw]
Subject: [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

Signed-off-by: Matt Mackall <[email protected]>

Index: 2.6.14-misc/fs/namei.c
===================================================================
--- 2.6.14-misc.orig/fs/namei.c 2005-11-01 10:54:33.000000000 -0800
+++ 2.6.14-misc/fs/namei.c 2005-11-09 11:19:35.000000000 -0800
@@ -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)
{

2005-11-11 08:36:06

by Matt Mackall

[permalink] [raw]
Subject: [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

Signed-off-by: Matt Mackall <[email protected]>

Index: tiny/scripts/bloat-o-meter
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ tiny/scripts/bloat-o-meter 2005-10-07 20:15:39.000000000 -0700
@@ -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)

2005-11-11 08:36:40

by Matt Mackall

[permalink] [raw]
Subject: [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/)

Signed-off-by: Matt Mackall <[email protected]>

Index: tiny/net/802/Makefile
===================================================================
--- tiny.orig/net/802/Makefile 2005-03-15 00:24:59.000000000 -0600
+++ tiny/net/802/Makefile 2005-03-15 00:25:48.000000000 -0600
@@ -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

2005-11-11 08:36:40

by Matt Mackall

[permalink] [raw]
Subject: [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

Signed-off-by: Matt Mackall <[email protected]>

Index: 2.6.14-misc/arch/i386/kernel/Makefile
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/Makefile 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/arch/i386/kernel/Makefile 2005-11-09 11:19:46.000000000 -0800
@@ -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
Index: 2.6.14-misc/arch/i386/kernel/cpu/common.c
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/cpu/common.c 2005-11-01 10:54:31.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/cpu/common.c 2005-11-09 11:19:46.000000000 -0800
@@ -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");
Index: 2.6.14-misc/init/Kconfig
===================================================================
--- 2.6.14-misc.orig/init/Kconfig 2005-11-01 10:54:33.000000000 -0800
+++ 2.6.14-misc/init/Kconfig 2005-11-09 11:19:46.000000000 -0800
@@ -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

2005-11-11 08:37:34

by Matt Mackall

[permalink] [raw]
Subject: [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

Index: 2.6.14-misc/init/Kconfig
===================================================================
--- 2.6.14-misc.orig/init/Kconfig 2005-11-09 16:48:24.000000000 -0800
+++ 2.6.14-misc/init/Kconfig 2005-11-09 16:50:44.000000000 -0800
@@ -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
Index: 2.6.14-misc/init/main.c
===================================================================
--- 2.6.14-misc.orig/init/main.c 2005-11-09 16:48:24.000000000 -0800
+++ 2.6.14-misc/init/main.c 2005-11-09 16:50:44.000000000 -0800
@@ -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;
}
Index: 2.6.14-misc/kernel/panic.c
===================================================================
--- 2.6.14-misc.orig/kernel/panic.c 2005-11-09 16:50:29.000000000 -0800
+++ 2.6.14-misc/kernel/panic.c 2005-11-09 16:50:55.000000000 -0800
@@ -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.
Index: 2.6.14-misc/include/linux/kernel.h
===================================================================
--- 2.6.14-misc.orig/include/linux/kernel.h 2005-11-09 16:48:24.000000000 -0800
+++ 2.6.14-misc/include/linux/kernel.h 2005-11-09 16:50:44.000000000 -0800
@@ -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)

2005-11-11 08:37:11

by Matt Mackall

[permalink] [raw]
Subject: [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

Signed-off-by: Matt Mackall <[email protected]>

Index: 2.6.14-misc/drivers/serial/Makefile
===================================================================
--- 2.6.14-misc.orig/drivers/serial/Makefile 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/drivers/serial/Makefile 2005-11-09 11:27:28.000000000 -0800
@@ -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
Index: 2.6.14-misc/init/Kconfig
===================================================================
--- 2.6.14-misc.orig/init/Kconfig 2005-11-09 11:27:26.000000000 -0800
+++ 2.6.14-misc/init/Kconfig 2005-11-09 11:27:28.000000000 -0800
@@ -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

2005-11-11 08:38:47

by Matt Mackall

[permalink] [raw]
Subject: [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

Signed-off-by: Matt Mackall <[email protected]>

Index: tiny/fs/inode.c
===================================================================
--- tiny.orig/fs/inode.c 2005-09-12 12:02:25.000000000 -0700
+++ tiny/fs/inode.c 2005-09-19 14:26:09.000000000 -0700
@@ -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;

2005-11-11 08:36:40

by Matt Mackall

[permalink] [raw]
Subject: [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

Signed-off-by: Matt Mackall <[email protected]>

Index: 2.6.14-misc/drivers/ide/setup-pci.c
===================================================================
--- 2.6.14-misc.orig/drivers/ide/setup-pci.c 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/drivers/ide/setup-pci.c 2005-11-09 11:27:23.000000000 -0800
@@ -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
===================================================================
--- 2.6.14-misc.orig/include/linux/ide.h 2005-11-01 10:54:33.000000000 -0800
+++ 2.6.14-misc/include/linux/ide.h 2005-11-09 11:27:23.000000000 -0800
@@ -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
===================================================================
--- 2.6.14-misc.orig/init/Kconfig 2005-11-09 11:27:20.000000000 -0800
+++ 2.6.14-misc/init/Kconfig 2005-11-09 11:27:23.000000000 -0800
@@ -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

2005-11-11 08:38:47

by Matt Mackall

[permalink] [raw]
Subject: [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

Signed-off-by: Matt Mackall <[email protected]>

Index: 2.6.14-misc/fs/locks.c
===================================================================
--- 2.6.14-misc.orig/fs/locks.c 2005-11-01 10:54:33.000000000 -0800
+++ 2.6.14-misc/fs/locks.c 2005-11-09 11:19:44.000000000 -0800
@@ -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);

2005-11-11 08:39:22

by Matt Mackall

[permalink] [raw]
Subject: [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

Signed-off-by: Matt Mackall <[email protected]>

Index: 2.6.14-misc/fs/open.c
===================================================================
--- 2.6.14-misc.orig/fs/open.c 2005-11-01 10:54:33.000000000 -0800
+++ 2.6.14-misc/fs/open.c 2005-11-09 11:19:40.000000000 -0800
@@ -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);

2005-11-11 08:39:59

by Matt Mackall

[permalink] [raw]
Subject: [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

Signed-off-by: Matt Mackall <[email protected]>

Index: 2.6.14-misc/init/Kconfig
===================================================================
--- 2.6.14-misc.orig/init/Kconfig 2005-11-09 11:21:02.000000000 -0800
+++ 2.6.14-misc/init/Kconfig 2005-11-09 11:22:06.000000000 -0800
@@ -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
Index: 2.6.14-misc/arch/sparc/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/sparc/Kconfig 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/arch/sparc/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -9,10 +9,6 @@ config MMU
bool
default y

-config UID16
- bool
- default y
-
config HIGHMEM
bool
default y
Index: 2.6.14-misc/arch/arm26/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/arm26/Kconfig 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/arch/arm26/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -34,10 +34,6 @@ config FORCE_MAX_ZONEORDER
int
default 9

-config UID16
- bool
- default y
-
config RWSEM_GENERIC_SPINLOCK
bool
default y
Index: 2.6.14-misc/arch/m68k/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/m68k/Kconfig 2005-11-01 10:54:31.000000000 -0800
+++ 2.6.14-misc/arch/m68k/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -10,10 +10,6 @@ config MMU
bool
default y

-config UID16
- bool
- default y
-
config RWSEM_GENERIC_SPINLOCK
bool
default y
Index: 2.6.14-misc/arch/ppc64/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/ppc64/Kconfig 2005-11-01 10:54:32.000000000 -0800
+++ 2.6.14-misc/arch/ppc64/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -13,9 +13,6 @@ config MMU
config PPC_STD_MMU
def_bool y

-config UID16
- bool
-
config RWSEM_GENERIC_SPINLOCK
bool

Index: 2.6.14-misc/arch/sh/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/sh/Kconfig 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/arch/sh/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -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
Index: 2.6.14-misc/arch/s390/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/s390/Kconfig 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/arch/s390/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -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"
Index: 2.6.14-misc/arch/cris/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/cris/Kconfig 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/arch/cris/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -9,10 +9,6 @@ config MMU
bool
default y

-config UID16
- bool
- default y
-
config RWSEM_GENERIC_SPINLOCK
bool
default y
Index: 2.6.14-misc/arch/x86_64/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/x86_64/Kconfig 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/arch/x86_64/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -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"
Index: 2.6.14-misc/arch/arm/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/arm/Kconfig 2005-11-01 10:54:31.000000000 -0800
+++ 2.6.14-misc/arch/arm/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -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
Index: 2.6.14-misc/arch/um/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/um/Kconfig 2005-11-01 10:54:32.000000000 -0800
+++ 2.6.14-misc/arch/um/Kconfig 2005-11-09 11:22:29.000000000 -0800
@@ -23,10 +23,6 @@ config SBUS
config PCI
bool

-config UID16
- bool
- default y
-
config GENERIC_CALIBRATE_DELAY
bool
default y
Index: 2.6.14-misc/arch/m68knommu/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/m68knommu/Kconfig 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/arch/m68knommu/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -17,10 +17,6 @@ config FPU
bool
default n

-config UID16
- bool
- default y
-
config RWSEM_GENERIC_SPINLOCK
bool
default y
Index: 2.6.14-misc/arch/ppc/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/ppc/Kconfig 2005-11-01 10:54:32.000000000 -0800
+++ 2.6.14-misc/arch/ppc/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -8,9 +8,6 @@ config MMU
bool
default y

-config UID16
- bool
-
config GENERIC_HARDIRQS
bool
default y
Index: 2.6.14-misc/arch/parisc/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/parisc/Kconfig 2005-11-01 10:54:31.000000000 -0800
+++ 2.6.14-misc/arch/parisc/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -19,9 +19,6 @@ config MMU
config STACK_GROWSUP
def_bool y

-config UID16
- bool
-
config RWSEM_GENERIC_SPINLOCK
def_bool y

Index: 2.6.14-misc/arch/sparc64/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/sparc64/Kconfig 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/arch/sparc64/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -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
Index: 2.6.14-misc/arch/v850/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/v850/Kconfig 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/arch/v850/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -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
Index: 2.6.14-misc/arch/h8300/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/h8300/Kconfig 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/arch/h8300/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -21,10 +21,6 @@ config FPU
bool
default n

-config UID16
- bool
- default y
-
config RWSEM_GENERIC_SPINLOCK
bool
default y
Index: 2.6.14-misc/arch/alpha/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/alpha/Kconfig 2005-10-27 17:02:08.000000000 -0700
+++ 2.6.14-misc/arch/alpha/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -18,9 +18,6 @@ config MMU
bool
default y

-config UID16
- bool
-
config RWSEM_GENERIC_SPINLOCK
bool

Index: 2.6.14-misc/arch/i386/Kconfig
===================================================================
--- 2.6.14-misc.orig/arch/i386/Kconfig 2005-11-01 10:54:31.000000000 -0800
+++ 2.6.14-misc/arch/i386/Kconfig 2005-11-09 11:21:09.000000000 -0800
@@ -29,10 +29,6 @@ config MMU
config SBUS
bool

-config UID16
- bool
- default y
-
config GENERIC_ISA_DMA
bool
default y
Index: 2.6.14-misc/kernel/sys_ni.c
===================================================================
--- 2.6.14-misc.orig/kernel/sys_ni.c 2005-11-09 11:20:21.000000000 -0800
+++ 2.6.14-misc/kernel/sys_ni.c 2005-11-09 11:22:56.000000000 -0800
@@ -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);

2005-11-11 08:39:44

by Matt Mackall

[permalink] [raw]
Subject: [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

Signed-off-by: Matt Mackall <[email protected]>

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();

2005-11-11 08:39:59

by Matt Mackall

[permalink] [raw]
Subject: [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

Signed-off-by: Matt Mackall <[email protected]>

Index: 2.6.14-misc/include/linux/kernel.h
===================================================================
--- 2.6.14-misc.orig/include/linux/kernel.h 2005-11-09 11:27:15.000000000 -0800
+++ 2.6.14-misc/include/linux/kernel.h 2005-11-10 23:26:41.000000000 -0800
@@ -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)
Index: 2.6.14-misc/init/Kconfig
===================================================================
--- 2.6.14-misc.orig/init/Kconfig 2005-11-09 11:27:15.000000000 -0800
+++ 2.6.14-misc/init/Kconfig 2005-11-10 23:26:41.000000000 -0800
@@ -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
Index: 2.6.14-misc/kernel/panic.c
===================================================================
--- 2.6.14-misc.orig/kernel/panic.c 2005-11-09 11:27:15.000000000 -0800
+++ 2.6.14-misc/kernel/panic.c 2005-11-10 23:26:41.000000000 -0800
@@ -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.

2005-11-11 08:39:23

by Matt Mackall

[permalink] [raw]
Subject: [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

Signed-off-by: Matt Mackall <[email protected]>

Index: 2.6.14-misc/fs/binfmt_elf.c
===================================================================
--- 2.6.14-misc.orig/fs/binfmt_elf.c 2005-11-09 11:27:14.000000000 -0800
+++ 2.6.14-misc/fs/binfmt_elf.c 2005-11-09 11:27:20.000000000 -0800
@@ -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
Index: 2.6.14-misc/init/Kconfig
===================================================================
--- 2.6.14-misc.orig/init/Kconfig 2005-11-09 11:27:18.000000000 -0800
+++ 2.6.14-misc/init/Kconfig 2005-11-09 11:27:20.000000000 -0800
@@ -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

2005-11-11 08:41:40

by Matt Mackall

[permalink] [raw]
Subject: [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

Signed-off-by: Matt Mackall <[email protected]>

Index: 2.6.14-misc/arch/i386/kernel/entry.S
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/entry.S 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/entry.S 2005-11-09 11:20:21.000000000 -0800
@@ -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
Index: 2.6.14-misc/arch/i386/kernel/process.c
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/process.c 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/process.c 2005-11-09 11:20:21.000000000 -0800
@@ -428,7 +428,9 @@ void release_thread(struct task_struct *
}
}

+#ifdef CONFIG_VM86
release_vm86_irqs(dead_task);
+#endif
}

/*
Index: 2.6.14-misc/arch/i386/kernel/traps.c
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/traps.c 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/traps.c 2005-11-09 11:20:21.000000000 -0800
@@ -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);
Index: 2.6.14-misc/arch/i386/kernel/vm86.c
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/vm86.c 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/vm86.c 2005-11-09 11:20:21.000000000 -0800
@@ -805,4 +805,3 @@ static int do_vm86_irq_handling(int subf
}
return -EINVAL;
}
-
Index: 2.6.14-misc/arch/i386/kernel/Makefile
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/Makefile 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/Makefile 2005-11-09 11:20:21.000000000 -0800
@@ -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
Index: 2.6.14-misc/arch/i386/kernel/sys_i386.c
===================================================================
--- 2.6.14-misc.orig/arch/i386/kernel/sys_i386.c 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/arch/i386/kernel/sys_i386.c 2005-11-09 11:20:21.000000000 -0800
@@ -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
Index: 2.6.14-misc/init/Kconfig
===================================================================
--- 2.6.14-misc.orig/init/Kconfig 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/init/Kconfig 2005-11-09 11:20:39.000000000 -0800
@@ -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
Index: 2.6.14-misc/kernel/sys_ni.c
===================================================================
--- 2.6.14-misc.orig/kernel/sys_ni.c 2005-11-09 11:20:20.000000000 -0800
+++ 2.6.14-misc/kernel/sys_ni.c 2005-11-09 11:20:21.000000000 -0800
@@ -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);

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

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.

On 11/11/05, Matt Mackall <[email protected]> wrote:
> 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
>
> Signed-off-by: Matt Mackall <[email protected]>
>
> Index: 2.6.14-misc/drivers/ide/setup-pci.c
> ===================================================================
> --- 2.6.14-misc.orig/drivers/ide/setup-pci.c 2005-10-27 17:02:08.000000000 -0700
> +++ 2.6.14-misc/drivers/ide/setup-pci.c 2005-11-09 11:27:23.000000000 -0800
> @@ -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
> ===================================================================
> --- 2.6.14-misc.orig/include/linux/ide.h 2005-11-01 10:54:33.000000000 -0800
> +++ 2.6.14-misc/include/linux/ide.h 2005-11-09 11:27:23.000000000 -0800
> @@ -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
> ===================================================================
> --- 2.6.14-misc.orig/init/Kconfig 2005-11-09 11:27:20.000000000 -0800
> +++ 2.6.14-misc/init/Kconfig 2005-11-09 11:27:23.000000000 -0800
> @@ -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

2005-11-11 10:23:20

by Geert Uytterhoeven

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

On Fri, 11 Nov 2005, Matt Mackall wrote:
> 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
>
> Signed-off-by: Matt Mackall <[email protected]>
>
> Index: 2.6.14-misc/init/Kconfig
> ===================================================================
> --- 2.6.14-misc.orig/init/Kconfig 2005-11-09 11:21:02.000000000 -0800
> +++ 2.6.14-misc/init/Kconfig 2005-11-09 11:22:06.000000000 -0800
> @@ -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?

> + 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

2005-11-11 11:03:31

by Geert Uytterhoeven

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

On Fri, 11 Nov 2005, Matt Mackall wrote:
> Index: 2.6.14-misc/kernel/panic.c
> ===================================================================
> --- 2.6.14-misc.orig/kernel/panic.c 2005-11-09 11:27:15.000000000 -0800
> +++ 2.6.14-misc/kernel/panic.c 2005-11-10 23:26:41.000000000 -0800
> @@ -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

2005-11-11 11:03:53

by Geert Uytterhoeven

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

On Fri, 11 Nov 2005, Matt Mackall wrote:
> --- 2.6.14-misc.orig/init/Kconfig 2005-11-09 11:27:26.000000000 -0800
> +++ 2.6.14-misc/init/Kconfig 2005-11-09 11:27:28.000000000 -0800
> @@ -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

2005-11-11 15:33:33

by Nick Warne

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

Bartlomiej Zolnierkiewicz wrote:

> 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.
>
> On 11/11/05, Matt Mackall <[email protected]> wrote:
>> 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:

This is very similar to my unaccepted patch a few months ago:

http://lkml.org/lkml/2005/6/25/69

Nick
--
http://sourceforge.net/projects/quake2plus

"Person who say it cannot be done should not interrupt person doing it."
-Chinese Proverb

2005-11-11 17:12:11

by Matt Mackall

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

On Fri, Nov 11, 2005 at 03:33:13PM +0000, Nick Warne wrote:
> Bartlomiej Zolnierkiewicz wrote:
>
> > 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.
> >
> > On 11/11/05, Matt Mackall <[email protected]> wrote:
> >> 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:
>
> This is very similar to my unaccepted patch a few months ago:
>
> http://lkml.org/lkml/2005/6/25/69

And it's practically identical to the one that's been in my -tiny tree
for two years.

I agree with Alan's complaint that this should in fact be done with
dynamic allocation. However, when I last set out to do that, it
appeared to be an _extremely_ invasive change so I quickly abandoned
it.

Meanwhile, this is currently the largest static allocation in a
typical kernel. Something has to be done.

--
Mathematics is the supreme nostalgia of our time.

2005-11-11 17:19:24

by Matt Mackall

[permalink] [raw]
Subject: 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]
> > 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.

--
Mathematics is the supreme nostalgia of our time.

2005-11-11 17:21:39

by Matt Mackall

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

On Fri, Nov 11, 2005 at 12:03:25PM +0100, Geert Uytterhoeven wrote:
> On Fri, 11 Nov 2005, Matt Mackall wrote:
> > Index: 2.6.14-misc/kernel/panic.c
> > ===================================================================
> > --- 2.6.14-misc.orig/kernel/panic.c 2005-11-09 11:27:15.000000000 -0800
> > +++ 2.6.14-misc/kernel/panic.c 2005-11-10 23:26:41.000000000 -0800
> > @@ -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.

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

--
Mathematics is the supreme nostalgia of our time.

2005-11-11 17:35:45

by Roman Zippel

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

Hi,

On Fri, 11 Nov 2005, Matt Mackall wrote:

> 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

2005-11-11 17:38:03

by Matt Mackall

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

On Fri, Nov 11, 2005 at 06:34:27PM +0100, Roman Zippel wrote:
> Hi,
>
> On Fri, 11 Nov 2005, Matt Mackall wrote:
>
> > 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.

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

> 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.

--
Mathematics is the supreme nostalgia of our time.

2005-11-11 17:48:13

by Matt Mackall

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

On Fri, Nov 11, 2005 at 09:37:37AM -0800, Matt Mackall wrote:
> > 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.

--
Mathematics is the supreme nostalgia of our time.

2005-11-11 17:49:14

by Roman Zippel

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

Hi,

On Fri, 11 Nov 2005, Matt Mackall wrote:

> > > 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.
>
> 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.

> > 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

2005-11-12 05:56:13

by Andrew Morton

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

Matt Mackall <[email protected]> wrote:
>
> 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


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.

2005-11-12 05:58:08

by Andrew Morton

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

Matt Mackall <[email protected]> wrote:
>
> 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
>
> $ 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.

2005-11-12 06:07:04

by Andrew Morton

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

Matt Mackall <[email protected]> wrote:
>
> 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.

2005-11-13 03:30:41

by Andi Kleen

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

Matt Mackall <[email protected]> writes:

> 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

2005-11-14 01:11:17

by Bodo Eggert

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

Andi Kleen <[email protected]> wrote:

> Matt Mackall <[email protected]> writes:
>
>> 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.

depends on EMBEDDED?
--
Ich danke GMX daf?r, die Verwendung meiner Adressen mittels per SPF
verbreiteten L?gen zu sabotieren.

2005-11-14 01:57:10

by Adrian Bunk

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

On Fri, Nov 11, 2005 at 02:35:51AM -0600, Matt Mackall wrote:
> trivial: drop unused 802.3 code if we compile without IPX
>
> (originally from http://wohnheim.fh-wedel.de/~joern/software/kernel/je/25/)
>
> Signed-off-by: Matt Mackall <[email protected]>
>
> Index: tiny/net/802/Makefile
> ===================================================================
> --- tiny.orig/net/802/Makefile 2005-03-15 00:24:59.000000000 -0600
> +++ tiny/net/802/Makefile 2005-03-15 00:25:48.000000000 -0600
> @@ -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

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

--

"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

2005-11-16 13:13:27

by Rob Landley

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

On Friday 11 November 2005 02:35, Matt Mackall wrote:
> This adds configurable support for doublefault reporting on x86
...
> +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

2005-11-16 13:21:48

by Rob Landley

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

On Friday 11 November 2005 02:35, Matt Mackall wrote:
> 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

2005-11-16 18:03:07

by Matt Mackall

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

On Wed, Nov 16, 2005 at 07:21:30AM -0600, Rob Landley wrote:
> On Friday 11 November 2005 02:35, Matt Mackall wrote:
> > 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.

--
Mathematics is the supreme nostalgia of our time.

2005-11-16 18:23:03

by Matt Mackall

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

On Wed, Nov 16, 2005 at 07:13:07AM -0600, Rob Landley wrote:
> On Friday 11 November 2005 02:35, Matt Mackall wrote:
> > This adds configurable support for doublefault reporting on x86
> ...
> > +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.

> 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.

--
Mathematics is the supreme nostalgia of our time.

2005-11-16 19:21:50

by Scott Garfinkle

[permalink] [raw]
Subject: 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.

2005-11-16 19:45:59

by Adrian Bunk

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

On Wed, Nov 16, 2005 at 01:21:48PM -0600, Scott Garfinkle wrote:

> 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.

--

"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

2005-11-18 05:22:55

by Adrian Bunk

[permalink] [raw]
Subject: [2.6 patch] move some code to net/ipx/af_ipx.c

On Mon, Nov 14, 2005 at 02:57:07AM +0100, Adrian Bunk wrote:
> On Fri, Nov 11, 2005 at 02:35:51AM -0600, Matt Mackall wrote:
> > trivial: drop unused 802.3 code if we compile without IPX
> >
> > (originally from http://wohnheim.fh-wedel.de/~joern/software/kernel/je/25/)
> >
> > Signed-off-by: Matt Mackall <[email protected]>
> >
> > Index: tiny/net/802/Makefile
> > ===================================================================
> > --- tiny.orig/net/802/Makefile 2005-03-15 00:24:59.000000000 -0600
> > +++ tiny/net/802/Makefile 2005-03-15 00:25:48.000000000 -0600
> > @@ -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
>
> 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.

cu
Adrian


<-- snip -->


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


Signed-off-by: Adrian Bunk <[email protected]>

---

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(-)

--- linux-2.6.15-rc1-mm1-full/net/802/Makefile.old 2005-11-18 02:14:35.000000000 +0100
+++ linux-2.6.15-rc1-mm1-full/net/802/Makefile 2005-11-18 02:15:06.000000000 +0100
@@ -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
--- linux-2.6.15-rc1-mm1-full/net/ethernet/Makefile.old 2005-11-18 02:15:17.000000000 +0100
+++ linux-2.6.15-rc1-mm1-full/net/ethernet/Makefile 2005-11-18 02:15:22.000000000 +0100
@@ -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
--- linux-2.6.15-rc1-mm1-full/net/8021q/vlan.c.old 2005-11-18 02:19:40.000000000 +0100
+++ linux-2.6.15-rc1-mm1-full/net/8021q/vlan.c 2005-11-18 02:19:46.000000000 +0100
@@ -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>
--- linux-2.6.15-rc1-mm1-full/net/8021q/vlan_dev.c.old 2005-11-18 02:19:55.000000000 +0100
+++ linux-2.6.15-rc1-mm1-full/net/8021q/vlan_dev.c 2005-11-18 02:19:58.000000000 +0100
@@ -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"
--- linux-2.6.15-rc1-mm1-full/net/ipx/af_ipx.c.old 2005-11-18 02:17:00.000000000 +0100
+++ linux-2.6.15-rc1-mm1-full/net/ipx/af_ipx.c 2005-11-18 02:26:01.000000000 +0100
@@ -48,10 +48,10 @@
#include <linux/termios.h>

#include <net/ipx.h>
-#include <net/p8022.h>
#include <net/psnap.h>
#include <net/sock.h>
#include <net/tcp_states.h>
+#include <net/llc.h>

#include <asm/uaccess.h>

@@ -1939,8 +1939,104 @@
.notifier_call = ipxitf_device_event,
};

-extern struct datalink_proto *make_EII_client(void);
-extern void destroy_EII_client(struct datalink_proto *);
+static int p8022_request(struct datalink_proto *dl, struct sk_buff *skb,
+ unsigned char *dest)
+{
+ llc_build_and_send_ui_pkt(dl->sap, skb, dest, dl->sap->laddr.lsap);
+ return 0;
+}
+
+static 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))
+{
+ struct datalink_proto *proto;
+
+ proto = kmalloc(sizeof(*proto), GFP_ATOMIC);
+ if (proto) {
+ proto->type[0] = type;
+ proto->header_length = 3;
+ proto->request = p8022_request;
+ proto->sap = llc_sap_open(type, func);
+ if (!proto->sap) {
+ kfree(proto);
+ proto = NULL;
+ }
+ }
+ return proto;
+}
+
+static void unregister_8022_client(struct datalink_proto *proto)
+{
+ llc_sap_put(proto->sap);
+ kfree(proto);
+}
+
+/*
+ * Place an 802.3 header on a packet. The driver will do the mac
+ * addresses, we just need to give it the buffer length.
+ */
+static int p8023_request(struct datalink_proto *dl,
+ struct sk_buff *skb, unsigned char *dest_node)
+{
+ struct net_device *dev = skb->dev;
+
+ dev->hard_header(skb, dev, ETH_P_802_3, dest_node, NULL, skb->len);
+ return dev_queue_xmit(skb);
+}
+
+/*
+ * Create an 802.3 client. Note there can be only one 802.3 client
+ */
+static struct datalink_proto *make_8023_client(void)
+{
+ struct datalink_proto *proto = kmalloc(sizeof(*proto), GFP_ATOMIC);
+
+ if (proto) {
+ proto->header_length = 0;
+ proto->request = p8023_request;
+ }
+ return proto;
+}
+
+/*
+ * Destroy the 802.3 client.
+ */
+static void destroy_8023_client(struct datalink_proto *dl)
+{
+ kfree(dl);
+}
+
+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);
+}
+
+static 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;
+}
+
+static void destroy_EII_client(struct datalink_proto *dl)
+{
+ kfree(dl);
+}

static unsigned char ipx_8022_type = 0xE0;
static unsigned char ipx_snap_id[5] = { 0x0, 0x0, 0x0, 0x81, 0x37 };
--- linux-2.6.15-rc1-mm1-full/include/net/p8022.h 2005-10-28 02:02:08.000000000 +0200
+++ /dev/null 2005-11-08 19:07:57.000000000 +0100
@@ -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
--- linux-2.6.15-rc1-mm1-full/net/ethernet/pe2.c 2005-11-17 21:30:56.000000000 +0100
+++ /dev/null 2005-11-08 19:07:57.000000000 +0100
@@ -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);
--- linux-2.6.15-rc1-mm1-full/net/802/p8022.c 2005-10-28 02:02:08.000000000 +0200
+++ /dev/null 2005-11-08 19:07:57.000000000 +0100
@@ -1,66 +0,0 @@
-/*
- * NET3: Support for 802.2 demultiplexing off Ethernet (Token ring
- * is kept separate see p8022tr.c)
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
- * Demultiplex 802.2 encoded protocols. We match the entry by the
- * SSAP/DSAP pair and then deliver to the registered datalink that
- * matches. The control byte is ignored and handling of such items
- * is up to the routine passed the frame.
- *
- * Unlike the 802.3 datalink we have a list of 802.2 entries as
- * there are multiple protocols to demux. The list is currently
- * short (3 or 4 entries at most). The current demux assumes this.
- */
-#include <linux/module.h>
-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-#include <net/datalink.h>
-#include <linux/mm.h>
-#include <linux/in.h>
-#include <linux/init.h>
-#include <net/llc.h>
-#include <net/p8022.h>
-
-static int p8022_request(struct datalink_proto *dl, struct sk_buff *skb,
- unsigned char *dest)
-{
- llc_build_and_send_ui_pkt(dl->sap, skb, dest, dl->sap->laddr.lsap);
- return 0;
-}
-
-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))
-{
- struct datalink_proto *proto;
-
- proto = kmalloc(sizeof(*proto), GFP_ATOMIC);
- if (proto) {
- proto->type[0] = type;
- proto->header_length = 3;
- proto->request = p8022_request;
- proto->sap = llc_sap_open(type, func);
- if (!proto->sap) {
- kfree(proto);
- proto = NULL;
- }
- }
- return proto;
-}
-
-void unregister_8022_client(struct datalink_proto *proto)
-{
- llc_sap_put(proto->sap);
- kfree(proto);
-}
-
-EXPORT_SYMBOL(register_8022_client);
-EXPORT_SYMBOL(unregister_8022_client);
-
-MODULE_LICENSE("GPL");
--- linux-2.6.15-rc1-mm1-full/net/802/p8023.c 2005-11-17 21:30:55.000000000 +0100
+++ /dev/null 2005-11-08 19:07:57.000000000 +0100
@@ -1,61 +0,0 @@
-/*
- * NET3: 802.3 data link hooks used for IPX 802.3
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- *
- * 802.3 isn't really a protocol data link layer. Some old IPX stuff
- * uses it however. Note that there is only one 802.3 protocol layer
- * in the system. We don't currently support different protocols
- * running raw 802.3 on different devices. Thankfully nobody else
- * has done anything like the old IPX.
- */
-
-#include <linux/in.h>
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/netdevice.h>
-#include <linux/skbuff.h>
-
-#include <net/datalink.h>
-#include <net/p8022.h>
-
-/*
- * Place an 802.3 header on a packet. The driver will do the mac
- * addresses, we just need to give it the buffer length.
- */
-static int p8023_request(struct datalink_proto *dl,
- struct sk_buff *skb, unsigned char *dest_node)
-{
- struct net_device *dev = skb->dev;
-
- dev->hard_header(skb, dev, ETH_P_802_3, dest_node, NULL, skb->len);
- return dev_queue_xmit(skb);
-}
-
-/*
- * Create an 802.3 client. Note there can be only one 802.3 client
- */
-struct datalink_proto *make_8023_client(void)
-{
- struct datalink_proto *proto = kmalloc(sizeof(*proto), GFP_ATOMIC);
-
- if (proto) {
- proto->header_length = 0;
- proto->request = p8023_request;
- }
- return proto;
-}
-
-/*
- * Destroy the 802.3 client.
- */
-void destroy_8023_client(struct datalink_proto *dl)
-{
- kfree(dl);
-}
-
-EXPORT_SYMBOL(destroy_8023_client);
-EXPORT_SYMBOL(make_8023_client);

2005-11-18 17:30:27

by Matt Mackall

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

On Fri, Nov 18, 2005 at 06:22:52AM +0100, Adrian Bunk wrote:
> >
> > 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.

--
Mathematics is the supreme nostalgia of our time.

2005-11-18 20:24:12

by Arnaldo Carvalho de Melo

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

On 11/18/05, Adrian Bunk <[email protected]> wrote:
> On Mon, Nov 14, 2005 at 02:57:07AM +0100, Adrian Bunk wrote:
> > On Fri, Nov 11, 2005 at 02:35:51AM -0600, Matt Mackall wrote:
> > > 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.

- Arnaldo

2005-12-05 21:35:53

by Adrian Bunk

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

On Fri, Nov 18, 2005 at 06:24:10PM -0200, Arnaldo Carvalho de Melo wrote:
> On 11/18/05, Adrian Bunk <[email protected]> wrote:
> > On Mon, Nov 14, 2005 at 02:57:07AM +0100, Adrian Bunk wrote:
> > > On Fri, Nov 11, 2005 at 02:35:51AM -0600, Matt Mackall wrote:
> > > > 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?

> - Arnaldo

cu
Adrian

--

"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

2005-12-12 10:37:04

by Ingo Molnar

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


* Scott Garfinkle <[email protected]> wrote:

> 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

2005-12-12 11:51:28

by Andi Kleen

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

Ingo Molnar <[email protected]> writes:
>
> 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.

> 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)

2005-12-12 15:39:29

by Matt Mackall

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

On Mon, Dec 12, 2005 at 09:22:42AM -0700, Andi Kleen wrote:
> Ingo Molnar <[email protected]> writes:
> >
> > 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.

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.

> -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?

--
Mathematics is the supreme nostalgia of our time.

2005-12-13 08:40:27

by Ingo Molnar

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


* Andi Kleen <[email protected]> wrote:

> Ingo Molnar <[email protected]> writes:
> >
> > 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.

> 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.

> > 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

2005-12-20 15:47:36

by Zdenek Pavlas

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

Matt Mackall wrote:

> On Wed, Nov 16, 2005 at 07:21:30AM -0600, Rob Landley wrote:
>>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.

--- uClibc-0.9.28/libc/sysdeps/linux/common/chown.c
+++ uclibc/libc/sysdeps/linux/common/chown.c
@@ -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));
}

--
Zdenek Pavlas
NEXTRA Czech Republic s.r.o. http://www.nextra.cz

2005-12-20 16:50:24

by Rob Landley

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

On Tuesday 20 December 2005 09:46, Zdenek Pavlas wrote:
> Matt Mackall wrote:
> > On Wed, Nov 16, 2005 at 07:21:30AM -0600, Rob Landley wrote:
> >>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.

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?

> --- uClibc-0.9.28/libc/sysdeps/linux/common/chown.c
> +++ uclibc/libc/sysdeps/linux/common/chown.c
> @@ -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));
> }

Rob
--
Steve Ballmer: Innovation! Inigo Montoya: You keep using that word.
I do not think it means what you think it means.

2005-12-21 17:31:23

by Zdenek Pavlas

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

--- uClibc-0.9.28/libc/sysdeps/linux/common/chown.c
+++ uclibc/libc/sysdeps/linux/common/chown.c
@@ -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));
}
--- uClibc-0.9.28/libc/sysdeps/linux/common/fchown.c
+++ uclibc/libc/sysdeps/linux/common/fchown.c
@@ -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));
}
--- uClibc-0.9.28/libc/sysdeps/linux/common/getegid.c
+++ uclibc/libc/sysdeps/linux/common/getegid.c
@@ -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)
{
--- uClibc-0.9.28/libc/sysdeps/linux/common/geteuid.c
+++ uclibc/libc/sysdeps/linux/common/geteuid.c
@@ -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)
{
--- uClibc-0.9.28/libc/sysdeps/linux/common/getgid.c
+++ uclibc/libc/sysdeps/linux/common/getgid.c
@@ -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
--- uClibc-0.9.28/libc/sysdeps/linux/common/getuid.c
+++ uclibc/libc/sysdeps/linux/common/getuid.c
@@ -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);

--- uClibc-0.9.28/libc/sysdeps/linux/common/lchown.c
+++ uclibc/libc/sysdeps/linux/common/lchown.c
@@ -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);
}
--- uClibc-0.9.28/libc/sysdeps/linux/common/setegid.c
+++ uclibc/libc/sysdeps/linux/common/setegid.c
@@ -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)
--- uClibc-0.9.28/libc/sysdeps/linux/common/seteuid.c
+++ uclibc/libc/sysdeps/linux/common/seteuid.c
@@ -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)
--- uClibc-0.9.28/libc/sysdeps/linux/common/setgid.c
+++ uclibc/libc/sysdeps/linux/common/setgid.c
@@ -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));
}
--- uClibc-0.9.28/libc/sysdeps/linux/common/setgroups.c
+++ uclibc/libc/sysdeps/linux/common/setgroups.c
@@ -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);

--- uClibc-0.9.28/libc/sysdeps/linux/common/setuid.c
+++ uclibc/libc/sysdeps/linux/common/setuid.c
@@ -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));
}


Attachments:
uClibc-no-ugid16.patch (5.08 kB)

2006-01-07 16:50:36

by Russell King

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

On Fri, Nov 11, 2005 at 02:35:57AM -0600, Matt Mackall wrote:
> 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 ?

> --- 2.6.14-misc.orig/init/Kconfig 2005-11-09 11:27:26.000000000 -0800
> +++ 2.6.14-misc/init/Kconfig 2005-11-09 11:27:28.000000000 -0800
> @@ -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

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core

2006-01-08 02:33:23

by Matt Mackall

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

On Sat, Jan 07, 2006 at 04:50:28PM +0000, Russell King wrote:
> On Fri, Nov 11, 2005 at 02:35:57AM -0600, Matt Mackall wrote:
> > 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.

--
Mathematics is the supreme nostalgia of our time.