2006-05-20 02:53:56

by Chris Wedgwood

[permalink] [raw]
Subject: [PATCH] i386: don't consider regparm EXPERIMENTAL anymore

[This might be a tad premature given recent tail-call fixups?]

---

Drop EXPERIMENTAL status from REGPARM as a lot of people seem to use
it and it seems to be pretty stable these days.


Signed-off-by: Chris Wedgwood <[email protected]>

diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 5b1a7d4..2b8657d 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -660,8 +660,7 @@ config BOOT_IOREMAP
default y

config REGPARM
- bool "Use register arguments (EXPERIMENTAL)"
- depends on EXPERIMENTAL
+ bool "Use register arguments"
default n
help
Compile the kernel with -mregparm=3. This uses a different ABI


2006-05-20 09:06:17

by Christoph Hellwig

[permalink] [raw]
Subject: Re: [PATCH] i386: don't consider regparm EXPERIMENTAL anymore

On Fri, May 19, 2006 at 07:53:53PM -0700, Chris Wedgwood wrote:
> [This might be a tad premature given recent tail-call fixups?]
>
> ---
>
> Drop EXPERIMENTAL status from REGPARM as a lot of people seem to use
> it and it seems to be pretty stable these days.

Just kill the option completely. It works nicely, generates better code
and we've stopped support for the old, broken compilers not handling it.

2006-05-20 20:14:01

by Chris Wedgwood

[permalink] [raw]
Subject: [PATCH] i386: kill CONFIG_REGPARM completely

On Sat, May 20, 2006 at 10:06:14AM +0100, Christoph Hellwig wrote:

> Just kill the option completely. It works nicely, generates better
> code and we've stopped support for the old, broken compilers not
> handling it.

Well, I'm not against that personally but I think more people should
comment given the number of prevent_tail_call(...) presently used.

Anyhow, how does this look for a first pass at this?



diff --git a/Documentation/stable_api_nonsense.txt b/Documentation/stable_api_nonsense.txt
index f39c9d7..ac11b81 100644
--- a/Documentation/stable_api_nonsense.txt
+++ b/Documentation/stable_api_nonsense.txt
@@ -62,9 +62,8 @@ consider the following facts about the L
- different structures can contain different fields
- Some functions may not be implemented at all, (i.e. some locks
compile away to nothing for non-SMP builds.)
- - Parameter passing of variables from function to function can be
- done in different ways (the CONFIG_REGPARM option controls
- this.)
+ - Parameter passing of variables from function to function can
+ be done in different ways.
- Memory within the kernel can be aligned in different ways,
depending on the build options.
- Linux runs on a wide range of different processor architectures.
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 8dfa305..71f1355 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -677,20 +677,6 @@ config BOOT_IOREMAP
depends on (((X86_SUMMIT || X86_GENERICARCH) && NUMA) || (X86 && EFI))
default y

-config REGPARM
- bool "Use register arguments"
- default y
- help
- Compile the kernel with -mregparm=3. This instructs gcc to use
- a more efficient function call ABI which passes the first three
- arguments of a function call via registers, which results in denser
- and faster code.
-
- If this option is disabled, then the default ABI of passing
- arguments via the stack is used.
-
- If unsure, say Y.
-
config SECCOMP
bool "Enable seccomp to safely compute untrusted bytecode"
depends on PROC_FS
diff --git a/arch/i386/Makefile b/arch/i386/Makefile
index 3e4adb1..263a3b8 100644
--- a/arch/i386/Makefile
+++ b/arch/i386/Makefile
@@ -29,7 +29,7 @@ OBJCOPYFLAGS := -O binary -R .note -R .c
LDFLAGS_vmlinux :=
CHECKFLAGS += -D__i386__

-CFLAGS += -pipe -msoft-float
+CFLAGS += -pipe -msoft-float -mregparm-3

# prevent gcc from keeping the stack 16 byte aligned
CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2)
@@ -37,8 +37,6 @@ CFLAGS += $(call cc-option,-mpreferred-s
# CPU-specific tuning. Anything which can be shared with UML should go here.
include $(srctree)/arch/i386/Makefile.cpu

-cflags-$(CONFIG_REGPARM) += -mregparm=3
-
# temporary until string.h is fixed
cflags-y += -ffreestanding

diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index 1629c3a..ca00ff0 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -1,4 +1,4 @@
-#
+
# Automatically generated make config: don't edit
#
CONFIG_X86_32=y
@@ -180,7 +180,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
# CONFIG_MATH_EMULATION is not set
CONFIG_MTRR=y
# CONFIG_EFI is not set
-CONFIG_REGPARM=y
# CONFIG_SECCOMP is not set
CONFIG_HZ_100=y
# CONFIG_HZ_250 is not set
diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c
index fd7eaf7..9ab9eb6 100644
--- a/arch/i386/kernel/ptrace.c
+++ b/arch/i386/kernel/ptrace.c
@@ -654,7 +654,6 @@ void send_sigtrap(struct task_struct *ts
/* notification of system call entry/exit
* - triggered by current->work.syscall_trace
*/
-__attribute__((regparm(3)))
int do_syscall_trace(struct pt_regs *regs, int entryexit)
{
int is_sysemu = test_thread_flag(TIF_SYSCALL_EMU);
diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c
index 5c352c3..9176407 100644
--- a/arch/i386/kernel/signal.c
+++ b/arch/i386/kernel/signal.c
@@ -641,7 +641,6 @@ static void fastcall do_signal(struct pt
* notification of userspace execution resumption
* - triggered by the TIF_WORK_MASK flags
*/
-__attribute__((regparm(3)))
void do_notify_resume(struct pt_regs *regs, void *_unused,
__u32 thread_info_flags)
{
diff --git a/fs/open.c b/fs/open.c
index 317b7c7..e61bfce 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -332,7 +332,7 @@ out:
asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
{
long ret = do_sys_ftruncate(fd, length, 1);
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -347,7 +347,7 @@ asmlinkage long sys_truncate64(const cha
asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
{
long ret = do_sys_ftruncate(fd, length, 0);
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -1105,7 +1105,7 @@ asmlinkage long sys_open(const char __us
flags |= O_LARGEFILE;

ret = do_sys_open(AT_FDCWD, filename, flags, mode);
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -1120,7 +1120,7 @@ asmlinkage long sys_openat(int dfd, cons
flags |= O_LARGEFILE;

ret = do_sys_open(dfd, filename, flags, mode);
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
diff --git a/include/asm-i386/linkage.h b/include/asm-i386/linkage.h
index f4a6eba..7362dfa 100644
--- a/include/asm-i386/linkage.h
+++ b/include/asm-i386/linkage.h
@@ -2,8 +2,10 @@ #ifndef __ASM_LINKAGE_H
#define __ASM_LINKAGE_H

#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
-#define FASTCALL(x) x __attribute__((regparm(3)))
-#define fastcall __attribute__((regparm(3)))
+/* FASTCALL and fastcall used to be __attribute__((regparm(3))) but
+ * that is now the default for i386 so these become no-ops. */
+#define FASTCALL(x) x
+#define fastcall

#define prevent_tail_call(ret) __asm__ ("" : "=r" (ret) : "0" (ret))

diff --git a/include/asm-i386/module.h b/include/asm-i386/module.h
index 424661d..968a690 100644
--- a/include/asm-i386/module.h
+++ b/include/asm-i386/module.h
@@ -60,18 +60,12 @@ #else
#error unknown processor family
#endif

-#ifdef CONFIG_REGPARM
-#define MODULE_REGPARM "REGPARM "
-#else
-#define MODULE_REGPARM ""
-#endif
-
#ifdef CONFIG_4KSTACKS
#define MODULE_STACKSIZE "4KSTACKS "
#else
#define MODULE_STACKSIZE ""
#endif

-#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_REGPARM MODULE_STACKSIZE
+#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_STACKSIZE

#endif /* _ASM_I386_MODULE_H */
diff --git a/kernel/exit.c b/kernel/exit.c
index e95b932..ed5e704 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1613,7 +1613,7 @@ asmlinkage long sys_waitid(int which, pi

ret = do_wait(pid, options, infop, NULL, ru);

- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -1628,7 +1628,7 @@ asmlinkage long sys_wait4(pid_t pid, int
return -EINVAL;
ret = do_wait(pid, options | WEXITED, NULL, stat_addr, ru);

- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
diff --git a/kernel/uid16.c b/kernel/uid16.c
index 187e2a4..8ba4535 100644
--- a/kernel/uid16.c
+++ b/kernel/uid16.c
@@ -21,7 +21,7 @@ #include <asm/uaccess.h>
asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gid_t group)
{
long ret = sys_chown(filename, low2highuid(user), low2highgid(group));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -29,7 +29,7 @@ asmlinkage long sys_chown16(const char _
asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_gid_t group)
{
long ret = sys_lchown(filename, low2highuid(user), low2highgid(group));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -37,7 +37,7 @@ asmlinkage long sys_lchown16(const char
asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group)
{
long ret = sys_fchown(fd, low2highuid(user), low2highgid(group));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -45,7 +45,7 @@ asmlinkage long sys_fchown16(unsigned in
asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid)
{
long ret = sys_setregid(low2highgid(rgid), low2highgid(egid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -53,7 +53,7 @@ asmlinkage long sys_setregid16(old_gid_t
asmlinkage long sys_setgid16(old_gid_t gid)
{
long ret = sys_setgid(low2highgid(gid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -61,7 +61,7 @@ asmlinkage long sys_setgid16(old_gid_t g
asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid)
{
long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -69,7 +69,7 @@ asmlinkage long sys_setreuid16(old_uid_t
asmlinkage long sys_setuid16(old_uid_t uid)
{
long ret = sys_setuid(low2highuid(uid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -78,7 +78,7 @@ asmlinkage long sys_setresuid16(old_uid_
{
long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid),
low2highuid(suid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -98,7 +98,7 @@ asmlinkage long sys_setresgid16(old_gid_
{
long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid),
low2highgid(sgid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -117,7 +117,7 @@ asmlinkage long sys_getresgid16(old_gid_
asmlinkage long sys_setfsuid16(old_uid_t uid)
{
long ret = sys_setfsuid(low2highuid(uid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -125,7 +125,7 @@ asmlinkage long sys_setfsuid16(old_uid_t
asmlinkage long sys_setfsgid16(old_gid_t gid)
{
long ret = sys_setfsgid(low2highgid(gid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}

2006-05-20 21:07:27

by Chris Wedgwood

[permalink] [raw]
Subject: Re: [PATCH] i386: kill CONFIG_REGPARM completely

On Sat, May 20, 2006 at 01:13:57PM -0700, Chris Wedgwood wrote:

> +CFLAGS += -pipe -msoft-float -mregparm-3

oops, typo there in my part, i'll resend with this fixed shortly.

2006-05-20 21:20:52

by Chris Wedgwood

[permalink] [raw]
Subject: [RFC PATCH (take #2)] i386: kill CONFIG_REGPARM completely

Take #2.

Kill of CONFIG_REGPARM completely.


diff --git a/Documentation/stable_api_nonsense.txt b/Documentation/stable_api_nonsense.txt
index f39c9d7..ac11b81 100644
--- a/Documentation/stable_api_nonsense.txt
+++ b/Documentation/stable_api_nonsense.txt
@@ -62,9 +62,8 @@ consider the following facts about the L
- different structures can contain different fields
- Some functions may not be implemented at all, (i.e. some locks
compile away to nothing for non-SMP builds.)
- - Parameter passing of variables from function to function can be
- done in different ways (the CONFIG_REGPARM option controls
- this.)
+ - Parameter passing of variables from function to function can
+ be done in different ways.
- Memory within the kernel can be aligned in different ways,
depending on the build options.
- Linux runs on a wide range of different processor architectures.
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 8dfa305..71f1355 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -677,20 +677,6 @@ config BOOT_IOREMAP
depends on (((X86_SUMMIT || X86_GENERICARCH) && NUMA) || (X86 && EFI))
default y

-config REGPARM
- bool "Use register arguments"
- default y
- help
- Compile the kernel with -mregparm=3. This instructs gcc to use
- a more efficient function call ABI which passes the first three
- arguments of a function call via registers, which results in denser
- and faster code.
-
- If this option is disabled, then the default ABI of passing
- arguments via the stack is used.
-
- If unsure, say Y.
-
config SECCOMP
bool "Enable seccomp to safely compute untrusted bytecode"
depends on PROC_FS
diff --git a/arch/i386/Makefile b/arch/i386/Makefile
index 3e4adb1..b8bb541 100644
--- a/arch/i386/Makefile
+++ b/arch/i386/Makefile
@@ -29,7 +29,7 @@ OBJCOPYFLAGS := -O binary -R .note -R .c
LDFLAGS_vmlinux :=
CHECKFLAGS += -D__i386__

-CFLAGS += -pipe -msoft-float
+CFLAGS += -pipe -msoft-float -mregparm=3

# prevent gcc from keeping the stack 16 byte aligned
CFLAGS += $(call cc-option,-mpreferred-stack-boundary=2)
@@ -37,8 +37,6 @@ CFLAGS += $(call cc-option,-mpreferred-s
# CPU-specific tuning. Anything which can be shared with UML should go here.
include $(srctree)/arch/i386/Makefile.cpu

-cflags-$(CONFIG_REGPARM) += -mregparm=3
-
# temporary until string.h is fixed
cflags-y += -ffreestanding

diff --git a/arch/i386/defconfig b/arch/i386/defconfig
index 1629c3a..ca00ff0 100644
--- a/arch/i386/defconfig
+++ b/arch/i386/defconfig
@@ -1,4 +1,4 @@
-#
+
# Automatically generated make config: don't edit
#
CONFIG_X86_32=y
@@ -180,7 +180,6 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
# CONFIG_MATH_EMULATION is not set
CONFIG_MTRR=y
# CONFIG_EFI is not set
-CONFIG_REGPARM=y
# CONFIG_SECCOMP is not set
CONFIG_HZ_100=y
# CONFIG_HZ_250 is not set
diff --git a/arch/i386/kernel/ptrace.c b/arch/i386/kernel/ptrace.c
index fd7eaf7..9ab9eb6 100644
--- a/arch/i386/kernel/ptrace.c
+++ b/arch/i386/kernel/ptrace.c
@@ -654,7 +654,6 @@ void send_sigtrap(struct task_struct *ts
/* notification of system call entry/exit
* - triggered by current->work.syscall_trace
*/
-__attribute__((regparm(3)))
int do_syscall_trace(struct pt_regs *regs, int entryexit)
{
int is_sysemu = test_thread_flag(TIF_SYSCALL_EMU);
diff --git a/arch/i386/kernel/signal.c b/arch/i386/kernel/signal.c
index 5c352c3..9176407 100644
--- a/arch/i386/kernel/signal.c
+++ b/arch/i386/kernel/signal.c
@@ -641,7 +641,6 @@ static void fastcall do_signal(struct pt
* notification of userspace execution resumption
* - triggered by the TIF_WORK_MASK flags
*/
-__attribute__((regparm(3)))
void do_notify_resume(struct pt_regs *regs, void *_unused,
__u32 thread_info_flags)
{
diff --git a/fs/open.c b/fs/open.c
index 317b7c7..e61bfce 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -332,7 +332,7 @@ out:
asmlinkage long sys_ftruncate(unsigned int fd, unsigned long length)
{
long ret = do_sys_ftruncate(fd, length, 1);
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -347,7 +347,7 @@ asmlinkage long sys_truncate64(const cha
asmlinkage long sys_ftruncate64(unsigned int fd, loff_t length)
{
long ret = do_sys_ftruncate(fd, length, 0);
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -1105,7 +1105,7 @@ asmlinkage long sys_open(const char __us
flags |= O_LARGEFILE;

ret = do_sys_open(AT_FDCWD, filename, flags, mode);
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -1120,7 +1120,7 @@ asmlinkage long sys_openat(int dfd, cons
flags |= O_LARGEFILE;

ret = do_sys_open(dfd, filename, flags, mode);
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
diff --git a/include/asm-i386/linkage.h b/include/asm-i386/linkage.h
index f4a6eba..7362dfa 100644
--- a/include/asm-i386/linkage.h
+++ b/include/asm-i386/linkage.h
@@ -2,8 +2,10 @@ #ifndef __ASM_LINKAGE_H
#define __ASM_LINKAGE_H

#define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
-#define FASTCALL(x) x __attribute__((regparm(3)))
-#define fastcall __attribute__((regparm(3)))
+/* FASTCALL and fastcall used to be __attribute__((regparm(3))) but
+ * that is now the default for i386 so these become no-ops. */
+#define FASTCALL(x) x
+#define fastcall

#define prevent_tail_call(ret) __asm__ ("" : "=r" (ret) : "0" (ret))

diff --git a/include/asm-i386/module.h b/include/asm-i386/module.h
index 424661d..968a690 100644
--- a/include/asm-i386/module.h
+++ b/include/asm-i386/module.h
@@ -60,18 +60,12 @@ #else
#error unknown processor family
#endif

-#ifdef CONFIG_REGPARM
-#define MODULE_REGPARM "REGPARM "
-#else
-#define MODULE_REGPARM ""
-#endif
-
#ifdef CONFIG_4KSTACKS
#define MODULE_STACKSIZE "4KSTACKS "
#else
#define MODULE_STACKSIZE ""
#endif

-#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_REGPARM MODULE_STACKSIZE
+#define MODULE_ARCH_VERMAGIC MODULE_PROC_FAMILY MODULE_STACKSIZE

#endif /* _ASM_I386_MODULE_H */
diff --git a/kernel/exit.c b/kernel/exit.c
index e95b932..ed5e704 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -1613,7 +1613,7 @@ asmlinkage long sys_waitid(int which, pi

ret = do_wait(pid, options, infop, NULL, ru);

- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -1628,7 +1628,7 @@ asmlinkage long sys_wait4(pid_t pid, int
return -EINVAL;
ret = do_wait(pid, options | WEXITED, NULL, stat_addr, ru);

- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
diff --git a/kernel/uid16.c b/kernel/uid16.c
index 187e2a4..8ba4535 100644
--- a/kernel/uid16.c
+++ b/kernel/uid16.c
@@ -21,7 +21,7 @@ #include <asm/uaccess.h>
asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gid_t group)
{
long ret = sys_chown(filename, low2highuid(user), low2highgid(group));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -29,7 +29,7 @@ asmlinkage long sys_chown16(const char _
asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_gid_t group)
{
long ret = sys_lchown(filename, low2highuid(user), low2highgid(group));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -37,7 +37,7 @@ asmlinkage long sys_lchown16(const char
asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group)
{
long ret = sys_fchown(fd, low2highuid(user), low2highgid(group));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -45,7 +45,7 @@ asmlinkage long sys_fchown16(unsigned in
asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid)
{
long ret = sys_setregid(low2highgid(rgid), low2highgid(egid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -53,7 +53,7 @@ asmlinkage long sys_setregid16(old_gid_t
asmlinkage long sys_setgid16(old_gid_t gid)
{
long ret = sys_setgid(low2highgid(gid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -61,7 +61,7 @@ asmlinkage long sys_setgid16(old_gid_t g
asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid)
{
long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -69,7 +69,7 @@ asmlinkage long sys_setreuid16(old_uid_t
asmlinkage long sys_setuid16(old_uid_t uid)
{
long ret = sys_setuid(low2highuid(uid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -78,7 +78,7 @@ asmlinkage long sys_setresuid16(old_uid_
{
long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid),
low2highuid(suid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -98,7 +98,7 @@ asmlinkage long sys_setresgid16(old_gid_
{
long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid),
low2highgid(sgid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -117,7 +117,7 @@ asmlinkage long sys_getresgid16(old_gid_
asmlinkage long sys_setfsuid16(old_uid_t uid)
{
long ret = sys_setfsuid(low2highuid(uid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}
@@ -125,7 +125,7 @@ asmlinkage long sys_setfsuid16(old_uid_t
asmlinkage long sys_setfsgid16(old_gid_t gid)
{
long ret = sys_setfsgid(low2highgid(gid));
- /* avoid REGPARM breakage on x86: */
+ /* avoid 'regparm' breakage on i386 */
prevent_tail_call(ret);
return ret;
}

2006-05-20 22:00:05

by Matheus Izvekov

[permalink] [raw]
Subject: Re: [RFC PATCH (take #2)] i386: kill CONFIG_REGPARM completely

On 5/20/06, Chris Wedgwood <[email protected]> wrote:
> Take #2.
>
> Kill of CONFIG_REGPARM completely.
>
>
> diff --git a/Documentation/stable_api_nonsense.txt b/Documentation/stable_api_nonsense.txt
> index f39c9d7..ac11b81 100644
> --- a/Documentation/stable_api_nonsense.txt
> +++ b/Documentation/stable_api_nonsense.txt
> @@ -62,9 +62,8 @@ consider the following facts about the L
> - different structures can contain different fields
> - Some functions may not be implemented at all, (i.e. some locks
> compile away to nothing for non-SMP builds.)
> - - Parameter passing of variables from function to function can be
> - done in different ways (the CONFIG_REGPARM option controls
> - this.)
> + - Parameter passing of variables from function to function can
> + be done in different ways.

Why not kill those 2 lines too? Now that non-regparm is gone, it
doesnt make sense to say there are different ways to pass parameters,
there is only regparm now, right?

>

2006-05-20 23:24:49

by Chris Wedgwood

[permalink] [raw]
Subject: Re: [RFC PATCH (take #2)] i386: kill CONFIG_REGPARM completely

On Sat, May 20, 2006 at 07:00:02PM -0300, Matheus Izvekov wrote:

> Why not kill those 2 lines too? Now that non-regparm is gone, it
> doesnt make sense to say there are different ways to pass
> parameters, there is only regparm now, right?

well, i'm not sure that is true everywhere though so i left the
comments

2006-05-22 11:48:26

by linux-os (Dick Johnson)

[permalink] [raw]
Subject: Re: [RFC PATCH (take #2)] i386: kill CONFIG_REGPARM completely


On Sat, 20 May 2006, Matheus Izvekov wrote:

> On 5/20/06, Chris Wedgwood <[email protected]> wrote:
>> Take #2.
>>
>> Kill of CONFIG_REGPARM completely.
>>
>>
>> diff --git a/Documentation/stable_api_nonsense.txt b/Documentation/stable_api_nonsense.txt
>> index f39c9d7..ac11b81 100644
>> --- a/Documentation/stable_api_nonsense.txt
>> +++ b/Documentation/stable_api_nonsense.txt
>> @@ -62,9 +62,8 @@ consider the following facts about the L
>> - different structures can contain different fields
>> - Some functions may not be implemented at all, (i.e. some locks
>> compile away to nothing for non-SMP builds.)
>> - - Parameter passing of variables from function to function can be
>> - done in different ways (the CONFIG_REGPARM option controls
>> - this.)
>> + - Parameter passing of variables from function to function can
>> + be done in different ways.
>
> Why not kill those 2 lines too? Now that non-regparm is gone, it
> doesnt make sense to say there are different ways to pass parameters,
> there is only regparm now, right?
>

On ix86 there are not enough registers to pass a significant parameter
list all in registers! Like when you are printk()ing a dotted-quad IP
address, etc. Registers ESI, EDI, and EBX are precious, that leaves
EAX, ECX, EDX and possibly EBP for only 4 parameters. You need 5
for the dotted quad IP address. If the compiler were to use the
precious registers, the contents need to be saved on the stack.
That negates any advantage to passing parameters in registers.

This means that REGPARM will always remain a "hint" to the compiler,
not some absolute order.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.16.4 on an i686 machine (5592.89 BogoMips).
New book: http://www.AbominableFirebug.com/
_


****************************************************************
The information transmitted in this message is confidential and may be privileged. Any review, retransmission, dissemination, or other use of this information by persons or entities other than the intended recipient is prohibited. If you are not the intended recipient, please notify Analogic Corporation immediately - by replying to this message or by sending an email to [email protected] - and destroy all copies of this information, including any attachments, without reading or disclosing them.

Thank you.

2006-05-23 07:58:23

by Helge Hafting

[permalink] [raw]
Subject: Re: [RFC PATCH (take #2)] i386: kill CONFIG_REGPARM completely

linux-os (Dick Johnson) wrote:

>On ix86 there are not enough registers to pass a significant parameter
>list all in registers! Like when you are printk()ing a dotted-quad IP
>address, etc. Registers ESI, EDI, and EBX are precious, that leaves
>EAX, ECX, EDX and possibly EBP for only 4 parameters. You need 5
>for the dotted quad IP address. If the compiler were to use the
>precious registers, the contents need to be saved on the stack.
>That negates any advantage to passing parameters in registers.
>
>
I had the impression that REGPARM in i386 only passed the
first three arguments in registers, putting any further
paramters on the stack?

Ought to help for all those 3-argument or less functions.

Helge Hafting

2006-05-24 20:36:56

by H. Peter Anvin

[permalink] [raw]
Subject: Re: [RFC PATCH (take #2)] i386: kill CONFIG_REGPARM completely

Followup to: <[email protected]>
By author: "linux-os \(Dick Johnson\)" <[email protected]>
In newsgroup: linux.dev.kernel
>
> On ix86 there are not enough registers to pass a significant parameter
> list all in registers! Like when you are printk()ing a dotted-quad IP
> address, etc. Registers ESI, EDI, and EBX are precious, that leaves
> EAX, ECX, EDX and possibly EBP for only 4 parameters. You need 5
> for the dotted quad IP address. If the compiler were to use the
> precious registers, the contents need to be saved on the stack.
> That negates any advantage to passing parameters in registers.
>
> This means that REGPARM will always remain a "hint" to the compiler,
> not some absolute order.
>

Bullshit.

-mregparm=N is an absolute order. On i386 it has the semantics of
passing the first N dword-sized non-varadic arguments in registers
%eax, %edx, and %ecx (in that order). The rest are passed on the
stack; that is true for any ABI.

printk() is varadic; the only argument which will be put in a register
is the formatting string (which goes into %eax).

-hpa


2006-05-29 19:03:10

by Adrian Bunk

[permalink] [raw]
Subject: Re: [PATCH] i386: don't consider regparm EXPERIMENTAL anymore

On Fri, May 19, 2006 at 07:53:53PM -0700, Chris Wedgwood wrote:
> [This might be a tad premature given recent tail-call fixups?]
>
> ---
>
> Drop EXPERIMENTAL status from REGPARM as a lot of people seem to use
> it and it seems to be pretty stable these days.
>
>
> Signed-off-by: Chris Wedgwood <[email protected]>
>
> diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
> index 5b1a7d4..2b8657d 100644
> --- a/arch/i386/Kconfig
> +++ b/arch/i386/Kconfig
> @@ -660,8 +660,7 @@ config BOOT_IOREMAP
> default y
>
> config REGPARM
> - bool "Use register arguments (EXPERIMENTAL)"
> - depends on EXPERIMENTAL
> + bool "Use register arguments"
> default n
> help
> Compile the kernel with -mregparm=3. This uses a different ABI

You should make such patches against -mm (or at least against a current
Linus' tree).

The dependency on EXPERIMENTAL was removed more than two months ago in
Linus' tree (and at the same time the default was changed to "y").

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