Skip to contentSkip to conversation

i386: don't consider regparm EXPERIMENTAL anymore

PATCH In review Chris Wedgwood 7 participants 11 messages May 20, 2006 – May 29, 2006

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

PATCH 1/1 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.

arch/i386/Kconfig +1 -2
index 5b1a7d4..2b8657d 100644
@@ -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
#1 lore raw
Quoted 6 lines · Chris Wedgwood

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

#2 lore raw

PATCH 1/1 i386: kill CONFIG_REGPARM completely

Quoted 3 lines · Christoph Hellwig

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?

Documentation/stable_api_nonsense.txt +2 -3
index f39c9d7..ac11b81 100644
@@ -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.
arch/i386/Kconfig +0 -14
index 8dfa305..71f1355 100644
@@ -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
arch/i386/Makefile +1 -3
index 3e4adb1..263a3b8 100644
@@ -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
 
arch/i386/defconfig +1 -2
index 1629c3a..ca00ff0 100644
@@ -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
arch/i386/kernel/ptrace.c +0 -1
index fd7eaf7..9ab9eb6 100644
@@ -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);
arch/i386/kernel/signal.c +0 -1
index 5c352c3..9176407 100644
@@ -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)
 {
fs/open.c +4 -4
index 317b7c7..e61bfce 100644
@@ -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;
 }
include/asm-i386/linkage.h +4 -2
index f4a6eba..7362dfa 100644
@@ -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))
 
include/asm-i386/module.h +1 -7
index 424661d..968a690 100644
@@ -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 */
kernel/exit.c +2 -2
index e95b932..ed5e704 100644
@@ -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;
 }
kernel/uid16.c +11 -11
index 187e2a4..8ba4535 100644
@@ -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;
 }
#3 lore raw

Re: [PATCH] i386: kill CONFIG_REGPARM completely

Quoted 1 line · Chris Wedgwood

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

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

#4 lore raw

RFC PATCH 1/1 i386: kill CONFIG_REGPARM completely

In reply to Chris Wedgwood

Take #2.

Kill of CONFIG_REGPARM completely.

Documentation/stable_api_nonsense.txt +2 -3
index f39c9d7..ac11b81 100644
@@ -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.
arch/i386/Kconfig +0 -14
index 8dfa305..71f1355 100644
@@ -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
arch/i386/Makefile +1 -3
index 3e4adb1..b8bb541 100644
@@ -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
 
arch/i386/defconfig +1 -2
index 1629c3a..ca00ff0 100644
@@ -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
arch/i386/kernel/ptrace.c +0 -1
index fd7eaf7..9ab9eb6 100644
@@ -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);
arch/i386/kernel/signal.c +0 -1
index 5c352c3..9176407 100644
@@ -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)
 {
fs/open.c +4 -4
index 317b7c7..e61bfce 100644
@@ -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;
 }
include/asm-i386/linkage.h +4 -2
index f4a6eba..7362dfa 100644
@@ -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))
 
include/asm-i386/module.h +1 -7
index 424661d..968a690 100644
@@ -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 */
kernel/exit.c +2 -2
index e95b932..ed5e704 100644
@@ -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;
 }
kernel/uid16.c +11 -11
index 187e2a4..8ba4535 100644
@@ -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;
 }
#5 lore raw

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

Quoted 10 lines · Chris Wedgwood

Take #2.

Kill of CONFIG_REGPARM completely.

Documentation/stable_api_nonsense.txt +0 -0
index f39c9d7..ac11b81 100644

Documentation/stable_api_nonsense.txt consider the following facts about the L · line 66

Quoted 8 lines
Documentation/stable_api_nonsense.txt +2 -3
@@ -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?

Quoted 1 line
#6 lore raw

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

Quoted 3 lines · Matheus Izvekov

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

#7 lore raw

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

In reply to Matheus Izvekov
Quoted 15 lines · Matheus Izvekov
Quoted 14 lines · Chris Wedgwood

Take #2.

Kill of CONFIG_REGPARM completely.

Documentation/stable_api_nonsense.txt +0 -1
index f39c9d7..ac11b81 100644
@@ -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
Quoted 9 lines

Documentation/stable_api_nonsense.txt consider the following facts about the L · line 66

Quoted 4 lines
Documentation/stable_api_nonsense.txt +2 -2
-       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.

#8 lore raw

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

Quoted 9 lines · linux-os (Dick Johnson)

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

#9 lore raw

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

In reply to linux-os (Dick Johnson)
Followup to:  <[email protected]>
By author:    "linux-os \(Dick Johnson\)" <[email protected]>
In newsgroup: linux.dev.kernel
Quoted 9 lines

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.

Quoted 3 lines

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

#10 lore raw
In reply to Chris Wedgwood
Quoted 15 lines · Chris Wedgwood

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

arch/i386/Kconfig +0 -0
index 5b1a7d4..2b8657d 100644

arch/i386/Kconfig config BOOT_IOREMAP · line 666

Quoted 9 lines
arch/i386/Kconfig +1 -2
@@ -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

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