All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] x86: Readd asmregparm
@ 2011-06-08  1:09 Andi Kleen
  2011-06-08  1:10 ` [PATCH 2/3] x86: Add missing asmlinkages/asmregparm Andi Kleen
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Andi Kleen @ 2011-06-08  1:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andi Kleen, x86

From: Andi Kleen <ak@linux.intel.com>

For a followon patchkit of mine I need to mark all functions
that can be called from assembler. But on 32bit kernels some
assembler functions are called with register arguments and others
with stack arguments. asmlinkage forces stack arguments.

This patch readds the recently removed asmregparm to be able
to mark assembler functions called with register arguments on 32bit.

Unlike the old code it's x86 only now to prevent it from
leaking.

Cc: x86@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 arch/x86/include/asm/linkage.h |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/linkage.h b/arch/x86/include/asm/linkage.h
index 4814297..fe10d95 100644
--- a/arch/x86/include/asm/linkage.h
+++ b/arch/x86/include/asm/linkage.h
@@ -8,6 +8,7 @@
 
 #ifdef CONFIG_X86_32
 #define asmlinkage CPP_ASMLINKAGE __attribute__((regparm(0)))
+#define asmregparm CPP_ASMLINKAGE __attribute__((regparm(3)))
 
 /*
  * Make sure the compiler doesn't do anything stupid with the
@@ -42,7 +43,9 @@
 	__asmlinkage_protect_n(ret, "g" (arg1), "g" (arg2), "g" (arg3), \
 			      "g" (arg4), "g" (arg5), "g" (arg6))
 
-#endif /* CONFIG_X86_32 */
+#else
+#define asmregparm asmlinkage
+#endif /* !CONFIG_X86_32 */
 
 #ifdef __ASSEMBLY__
 
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] x86: Add missing asmlinkages/asmregparm
  2011-06-08  1:09 [PATCH 1/3] x86: Readd asmregparm Andi Kleen
@ 2011-06-08  1:10 ` Andi Kleen
  2011-06-08  1:10 ` [PATCH 3/3] x86: Change dotraplinkage into asmregparm for 32bit Andi Kleen
  2011-06-08  8:19 ` [PATCH 1/3] x86: Readd asmregparm Ingo Molnar
  2 siblings, 0 replies; 9+ messages in thread
From: Andi Kleen @ 2011-06-08  1:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andi Kleen, x86

From: Andi Kleen <ak@linux.intel.com>

Relies on the earlier patch to readd asmregparm.

This is an arch/x86 sweep to add asmlinkage or asmregparm
to all functions called by assembler code, including interrupt handlers,
syscalls and others.

I need this for a followon project that requires all functions
called by assembler to be marked in a special way.

The unmarked syscalls are marked asmregparm now. That's unusal
for syscalls -- normally they are all asmlinkage aka stack arguments.
I kept it at asmregparm to generate the same binary.

All calls with no argument are asmlinkage

All other functions that were unmarked before are asmregparm
now.

On 64bit it's all a nop currently.

I verified the patch generates the same binary as before.

I kept it all in a single patch for now. Please let me know
if you want it split up.

Cc: x86@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 arch/x86/include/asm/hw_irq.h   |  116 +++++++++++++++++++-------------------
 arch/x86/include/asm/irq.h      |    2 +-
 arch/x86/include/asm/kprobes.h  |    2 +-
 arch/x86/include/asm/paravirt.h |    2 +-
 arch/x86/include/asm/setup.h    |    6 +-
 arch/x86/include/asm/signal.h   |    2 +-
 arch/x86/include/asm/syscalls.h |   22 ++++----
 arch/x86/include/asm/system.h   |    3 +-
 arch/x86/kernel/apic/apic.c     |    6 +-
 arch/x86/kernel/head32.c        |    2 +-
 arch/x86/kernel/head64.c        |    2 +-
 arch/x86/kernel/ioport.c        |    2 +-
 arch/x86/kernel/irq.c           |    4 +-
 arch/x86/kernel/irq_work.c      |    2 +-
 arch/x86/kernel/kprobes.c       |    2 +-
 arch/x86/kernel/process.c       |   10 ++--
 arch/x86/kernel/process_32.c    |    2 +-
 arch/x86/kernel/process_64.c    |    2 +-
 arch/x86/kernel/signal.c        |    8 +-
 arch/x86/kernel/smp.c           |    6 +-
 arch/x86/kernel/syscall_64.c    |    2 +-
 arch/x86/kernel/vm86_32.c       |    3 +-
 arch/x86/mm/tlb.c               |    5 +-
 23 files changed, 106 insertions(+), 107 deletions(-)

diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index bb9efe8..a7121a4 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -26,56 +26,56 @@
 #include <asm/sections.h>
 
 /* Interrupt handlers registered during init_IRQ */
-extern void apic_timer_interrupt(void);
-extern void x86_platform_ipi(void);
-extern void error_interrupt(void);
-extern void irq_work_interrupt(void);
-
-extern void spurious_interrupt(void);
-extern void thermal_interrupt(void);
-extern void reschedule_interrupt(void);
-extern void mce_self_interrupt(void);
-
-extern void invalidate_interrupt(void);
-extern void invalidate_interrupt0(void);
-extern void invalidate_interrupt1(void);
-extern void invalidate_interrupt2(void);
-extern void invalidate_interrupt3(void);
-extern void invalidate_interrupt4(void);
-extern void invalidate_interrupt5(void);
-extern void invalidate_interrupt6(void);
-extern void invalidate_interrupt7(void);
-extern void invalidate_interrupt8(void);
-extern void invalidate_interrupt9(void);
-extern void invalidate_interrupt10(void);
-extern void invalidate_interrupt11(void);
-extern void invalidate_interrupt12(void);
-extern void invalidate_interrupt13(void);
-extern void invalidate_interrupt14(void);
-extern void invalidate_interrupt15(void);
-extern void invalidate_interrupt16(void);
-extern void invalidate_interrupt17(void);
-extern void invalidate_interrupt18(void);
-extern void invalidate_interrupt19(void);
-extern void invalidate_interrupt20(void);
-extern void invalidate_interrupt21(void);
-extern void invalidate_interrupt22(void);
-extern void invalidate_interrupt23(void);
-extern void invalidate_interrupt24(void);
-extern void invalidate_interrupt25(void);
-extern void invalidate_interrupt26(void);
-extern void invalidate_interrupt27(void);
-extern void invalidate_interrupt28(void);
-extern void invalidate_interrupt29(void);
-extern void invalidate_interrupt30(void);
-extern void invalidate_interrupt31(void);
-
-extern void irq_move_cleanup_interrupt(void);
-extern void reboot_interrupt(void);
-extern void threshold_interrupt(void);
-
-extern void call_function_interrupt(void);
-extern void call_function_single_interrupt(void);
+asmlinkage extern void apic_timer_interrupt(void);
+asmlinkage extern void x86_platform_ipi(void);
+asmlinkage extern void error_interrupt(void);
+asmlinkage extern void irq_work_interrupt(void);
+
+asmlinkage extern void spurious_interrupt(void);
+asmlinkage extern void thermal_interrupt(void);
+asmlinkage extern void reschedule_interrupt(void);
+asmlinkage extern void mce_self_interrupt(void);
+
+asmlinkage extern void invalidate_interrupt(void);
+asmlinkage extern void invalidate_interrupt0(void);
+asmlinkage extern void invalidate_interrupt1(void);
+asmlinkage extern void invalidate_interrupt2(void);
+asmlinkage extern void invalidate_interrupt3(void);
+asmlinkage extern void invalidate_interrupt4(void);
+asmlinkage extern void invalidate_interrupt5(void);
+asmlinkage extern void invalidate_interrupt6(void);
+asmlinkage extern void invalidate_interrupt7(void);
+asmlinkage extern void invalidate_interrupt8(void);
+asmlinkage extern void invalidate_interrupt9(void);
+asmlinkage extern void invalidate_interrupt10(void);
+asmlinkage extern void invalidate_interrupt11(void);
+asmlinkage extern void invalidate_interrupt12(void);
+asmlinkage extern void invalidate_interrupt13(void);
+asmlinkage extern void invalidate_interrupt14(void);
+asmlinkage extern void invalidate_interrupt15(void);
+asmlinkage extern void invalidate_interrupt16(void);
+asmlinkage extern void invalidate_interrupt17(void);
+asmlinkage extern void invalidate_interrupt18(void);
+asmlinkage extern void invalidate_interrupt19(void);
+asmlinkage extern void invalidate_interrupt20(void);
+asmlinkage extern void invalidate_interrupt21(void);
+asmlinkage extern void invalidate_interrupt22(void);
+asmlinkage extern void invalidate_interrupt23(void);
+asmlinkage extern void invalidate_interrupt24(void);
+asmlinkage extern void invalidate_interrupt25(void);
+asmlinkage extern void invalidate_interrupt26(void);
+asmlinkage extern void invalidate_interrupt27(void);
+asmlinkage extern void invalidate_interrupt28(void);
+asmlinkage extern void invalidate_interrupt29(void);
+asmlinkage extern void invalidate_interrupt30(void);
+asmlinkage extern void invalidate_interrupt31(void);
+
+asmlinkage extern void irq_move_cleanup_interrupt(void);
+asmlinkage extern void reboot_interrupt(void);
+asmlinkage extern void threshold_interrupt(void);
+
+asmlinkage extern void call_function_interrupt(void);
+asmlinkage extern void call_function_single_interrupt(void);
 
 /* IOAPIC */
 #define IO_APIC_IRQ(x) (((x) >= NR_IRQS_LEGACY) || ((1<<(x)) & io_apic_irqs))
@@ -144,19 +144,19 @@ extern atomic_t irq_mis_count;
 extern void eisa_set_level_irq(unsigned int irq);
 
 /* SMP */
-extern void smp_apic_timer_interrupt(struct pt_regs *);
-extern void smp_spurious_interrupt(struct pt_regs *);
-extern void smp_x86_platform_ipi(struct pt_regs *);
-extern void smp_error_interrupt(struct pt_regs *);
+extern asmregparm void smp_apic_timer_interrupt(struct pt_regs *);
+extern asmregparm void smp_spurious_interrupt(struct pt_regs *);
+extern asmregparm void smp_x86_platform_ipi(struct pt_regs *);
+extern asmregparm void smp_error_interrupt(struct pt_regs *);
 #ifdef CONFIG_X86_IO_APIC
 extern asmlinkage void smp_irq_move_cleanup_interrupt(void);
 #endif
 #ifdef CONFIG_SMP
-extern void smp_reschedule_interrupt(struct pt_regs *);
-extern void smp_call_function_interrupt(struct pt_regs *);
-extern void smp_call_function_single_interrupt(struct pt_regs *);
+extern asmregparm void smp_reschedule_interrupt(struct pt_regs *);
+extern asmregparm void smp_call_function_interrupt(struct pt_regs *);
+extern asmregparm void smp_call_function_single_interrupt(struct pt_regs *);
 #ifdef CONFIG_X86_32
-extern void smp_invalidate_interrupt(struct pt_regs *);
+extern asmregparm void smp_invalidate_interrupt(struct pt_regs *);
 #else
 extern asmlinkage void smp_invalidate_interrupt(struct pt_regs *);
 #endif
diff --git a/arch/x86/include/asm/irq.h b/arch/x86/include/asm/irq.h
index ba870bb..a027dc5 100644
--- a/arch/x86/include/asm/irq.h
+++ b/arch/x86/include/asm/irq.h
@@ -33,7 +33,7 @@ extern void (*x86_platform_ipi_callback)(void);
 extern void native_init_IRQ(void);
 extern bool handle_irq(unsigned irq, struct pt_regs *regs);
 
-extern unsigned int do_IRQ(struct pt_regs *regs);
+extern asmregparm unsigned int do_IRQ(struct pt_regs *regs);
 
 /* Interrupt vector management */
 extern DECLARE_BITMAP(used_vectors, NR_VECTORS);
diff --git a/arch/x86/include/asm/kprobes.h b/arch/x86/include/asm/kprobes.h
index 2b3ccf7..fa2d12e 100644
--- a/arch/x86/include/asm/kprobes.h
+++ b/arch/x86/include/asm/kprobes.h
@@ -61,7 +61,7 @@ extern __visible kprobe_opcode_t optprobe_template_end;
 extern const int kretprobe_blacklist_size;
 
 void arch_remove_kprobe(struct kprobe *p);
-void kretprobe_trampoline(void);
+asmlinkage void kretprobe_trampoline(void);
 
 /* Architecture specific copy of original instruction*/
 struct arch_specific_insn {
diff --git a/arch/x86/include/asm/paravirt.h b/arch/x86/include/asm/paravirt.h
index ebbc4d8..74c752f 100644
--- a/arch/x86/include/asm/paravirt.h
+++ b/arch/x86/include/asm/paravirt.h
@@ -829,7 +829,7 @@ static __always_inline void arch_spin_unlock(struct arch_spinlock *lock)
  * functions.
  */
 #define PV_CALLEE_SAVE_REGS_THUNK(func)					\
-	extern typeof(func) __raw_callee_save_##func;			\
+	extern asmregparm typeof(func) __raw_callee_save_##func;			\
 	static void *__##func##__ __used = func;			\
 									\
 	asm(".pushsection .text;"					\
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index 9756551..c4daddc 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -107,11 +107,11 @@ void *extend_brk(size_t size, size_t align);
 extern void probe_roms(void);
 #ifdef __i386__
 
-void __init i386_start_kernel(void);
+asmlinkage void __init i386_start_kernel(void);
 
 #else
-void __init x86_64_start_kernel(char *real_mode);
-void __init x86_64_start_reservations(char *real_mode_data);
+asmlinkage void __init x86_64_start_kernel(char *real_mode);
+asmlinkage void __init x86_64_start_reservations(char *real_mode_data);
 
 #endif /* __i386__ */
 #endif /* _SETUP */
diff --git a/arch/x86/include/asm/signal.h b/arch/x86/include/asm/signal.h
index 598457c..a687c37 100644
--- a/arch/x86/include/asm/signal.h
+++ b/arch/x86/include/asm/signal.h
@@ -122,7 +122,7 @@ typedef unsigned long sigset_t;
 #ifndef __ASSEMBLY__
 
 # ifdef __KERNEL__
-extern void do_notify_resume(struct pt_regs *, void *, __u32);
+extern asmregparm void do_notify_resume(struct pt_regs *, void *, __u32);
 # endif /* __KERNEL__ */
 
 #ifdef __i386__
diff --git a/arch/x86/include/asm/syscalls.h b/arch/x86/include/asm/syscalls.h
index f1d8b44..d3c9ebe 100644
--- a/arch/x86/include/asm/syscalls.h
+++ b/arch/x86/include/asm/syscalls.h
@@ -18,23 +18,23 @@
 /* Common in X86_32 and X86_64 */
 /* kernel/ioport.c */
 asmlinkage long sys_ioperm(unsigned long, unsigned long, int);
-long sys_iopl(unsigned int, struct pt_regs *);
+asmregparm long sys_iopl(unsigned int, struct pt_regs *);
 
 /* kernel/process.c */
-int sys_fork(struct pt_regs *);
-int sys_vfork(struct pt_regs *);
-long sys_execve(const char __user *,
+asmregparm int sys_fork(struct pt_regs *);
+asmregparm int sys_vfork(struct pt_regs *);
+asmregparm long sys_execve(const char __user *,
 		const char __user *const __user *,
 		const char __user *const __user *, struct pt_regs *);
-long sys_clone(unsigned long, unsigned long, void __user *,
+asmregparm long sys_clone(unsigned long, unsigned long, void __user *,
 	       void __user *, struct pt_regs *);
 
 /* kernel/ldt.c */
 asmlinkage int sys_modify_ldt(int, void __user *, unsigned long);
 
 /* kernel/signal.c */
-long sys_rt_sigreturn(struct pt_regs *);
-long sys_sigaltstack(const stack_t __user *, stack_t __user *,
+asmregparm long sys_rt_sigreturn(struct pt_regs *);
+asmregparm long sys_sigaltstack(const stack_t __user *, stack_t __user *,
 		     struct pt_regs *);
 
 
@@ -49,17 +49,17 @@ asmlinkage int sys_get_thread_area(struct user_desc __user *);
 asmlinkage int sys_sigsuspend(int, int, old_sigset_t);
 asmlinkage int sys_sigaction(int, const struct old_sigaction __user *,
 			     struct old_sigaction __user *);
-unsigned long sys_sigreturn(struct pt_regs *);
+asmregparm unsigned long sys_sigreturn(struct pt_regs *);
 
 /* kernel/vm86_32.c */
-int sys_vm86old(struct vm86_struct __user *, struct pt_regs *);
-int sys_vm86(unsigned long, unsigned long, struct pt_regs *);
+asmregparm int sys_vm86old(struct vm86_struct __user *, struct pt_regs *);
+asmregparm int sys_vm86(unsigned long, unsigned long, struct pt_regs *);
 
 #else /* CONFIG_X86_32 */
 
 /* X86_64 only */
 /* kernel/process_64.c */
-long sys_arch_prctl(int, unsigned long);
+asmlinkage long sys_arch_prctl(int, unsigned long);
 
 /* kernel/sys_x86_64.c */
 asmlinkage long sys_mmap(unsigned long, unsigned long, unsigned long,
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h
index c2ff2a1..8358217 100644
--- a/arch/x86/include/asm/system.h
+++ b/arch/x86/include/asm/system.h
@@ -18,6 +18,7 @@
 #endif
 
 struct task_struct; /* one of the stranger aspects of C forward declarations */
+asmregparm
 struct task_struct *__switch_to(struct task_struct *prev,
 				struct task_struct *next);
 struct tss_struct;
@@ -148,7 +149,7 @@ do {									\
 
 #ifdef __KERNEL__
 
-extern void native_load_gs_index(unsigned);
+extern asmlinkage void native_load_gs_index(unsigned);
 
 /*
  * Load a segment. Fall back on loading the zero
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index b961af8..6a8f8aa 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -841,7 +841,7 @@ static void local_apic_timer_interrupt(void)
  * [ if a single-CPU system runs an SMP kernel then we call the local
  *   interrupt as well. Thus we cannot inline the local irq ... ]
  */
-void __irq_entry smp_apic_timer_interrupt(struct pt_regs *regs)
+asmregparm void __irq_entry smp_apic_timer_interrupt(struct pt_regs *regs)
 {
 	struct pt_regs *old_regs = set_irq_regs(regs);
 
@@ -1785,7 +1785,7 @@ int __init APIC_init_uniprocessor(void)
 /*
  * This interrupt should _never_ happen with our APIC/SMP architecture
  */
-void smp_spurious_interrupt(struct pt_regs *regs)
+asmregparm void smp_spurious_interrupt(struct pt_regs *regs)
 {
 	u32 v;
 
@@ -1811,7 +1811,7 @@ void smp_spurious_interrupt(struct pt_regs *regs)
 /*
  * This interrupt should never happen with our APIC/SMP architecture
  */
-void smp_error_interrupt(struct pt_regs *regs)
+asmregparm void smp_error_interrupt(struct pt_regs *regs)
 {
 	u32 v0, v1;
 	u32 i = 0;
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index 3bb0850..6647d53 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -29,7 +29,7 @@ static void __init i386_default_early_setup(void)
 	reserve_ebda_region();
 }
 
-void __init i386_start_kernel(void)
+asmlinkage void __init i386_start_kernel(void)
 {
 	memblock_init();
 
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index 5655c22..512dcf3 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -53,7 +53,7 @@ static void __init copy_bootdata(char *real_mode_data)
 	}
 }
 
-void __init x86_64_start_kernel(char * real_mode_data)
+asmlinkage void __init x86_64_start_kernel(char * real_mode_data)
 {
 	int i;
 
diff --git a/arch/x86/kernel/ioport.c b/arch/x86/kernel/ioport.c
index 8c96897..5345f97 100644
--- a/arch/x86/kernel/ioport.c
+++ b/arch/x86/kernel/ioport.c
@@ -93,7 +93,7 @@ asmlinkage long sys_ioperm(unsigned long from, unsigned long num, int turn_on)
  * on system-call entry - see also fork() and the signal handling
  * code.
  */
-long sys_iopl(unsigned int level, struct pt_regs *regs)
+asmregparm long sys_iopl(unsigned int level, struct pt_regs *regs)
 {
 	unsigned int old = (regs->flags >> 12) & 3;
 	struct thread_struct *t = &current->thread;
diff --git a/arch/x86/kernel/irq.c b/arch/x86/kernel/irq.c
index 6c0802e..b46ee95 100644
--- a/arch/x86/kernel/irq.c
+++ b/arch/x86/kernel/irq.c
@@ -172,7 +172,7 @@ u64 arch_irq_stat(void)
  * SMP cross-CPU interrupts have their own specific
  * handlers).
  */
-unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
+asmregparm unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
 {
 	struct pt_regs *old_regs = set_irq_regs(regs);
 
@@ -202,7 +202,7 @@ unsigned int __irq_entry do_IRQ(struct pt_regs *regs)
 /*
  * Handler for X86_PLATFORM_IPI_VECTOR.
  */
-void smp_x86_platform_ipi(struct pt_regs *regs)
+asmregparm void smp_x86_platform_ipi(struct pt_regs *regs)
 {
 	struct pt_regs *old_regs = set_irq_regs(regs);
 
diff --git a/arch/x86/kernel/irq_work.c b/arch/x86/kernel/irq_work.c
index ca8f703..011ef48 100644
--- a/arch/x86/kernel/irq_work.c
+++ b/arch/x86/kernel/irq_work.c
@@ -9,7 +9,7 @@
 #include <linux/hardirq.h>
 #include <asm/apic.h>
 
-void smp_irq_work_interrupt(struct pt_regs *regs)
+asmregparm void smp_irq_work_interrupt(struct pt_regs *regs)
 {
 	irq_enter();
 	ack_APIC_irq();
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index 63de894..f4141cf 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -696,7 +696,7 @@ asm(
 /*
  * Called from kretprobe_trampoline
  */
-static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
+asmregparm __used __kprobes void *trampoline_handler(struct pt_regs *regs)
 {
 	struct kretprobe_instance *ri = NULL;
 	struct hlist_head *head, empty_rp;
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index 2e4928d..b8bb4c3 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -232,7 +232,7 @@ void __switch_to_xtra(struct task_struct *prev_p, struct task_struct *next_p,
 	propagate_user_return_notify(prev_p, next_p);
 }
 
-int sys_fork(struct pt_regs *regs)
+asmregparm int sys_fork(struct pt_regs *regs)
 {
 	return do_fork(SIGCHLD, regs->sp, regs, 0, NULL, NULL);
 }
@@ -247,13 +247,13 @@ int sys_fork(struct pt_regs *regs)
  * do not have enough call-clobbered registers to hold all
  * the information you need.
  */
-int sys_vfork(struct pt_regs *regs)
+asmregparm int sys_vfork(struct pt_regs *regs)
 {
 	return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->sp, regs, 0,
 		       NULL, NULL);
 }
 
-long
+asmregparm long
 sys_clone(unsigned long clone_flags, unsigned long newsp,
 	  void __user *parent_tid, void __user *child_tid, struct pt_regs *regs)
 {
@@ -267,7 +267,7 @@ sys_clone(unsigned long clone_flags, unsigned long newsp,
  * function to call, and %di containing
  * the "args".
  */
-extern void kernel_thread_helper(void);
+asmregparm extern void kernel_thread_helper(void);
 
 /*
  * Create a kernel thread
@@ -303,7 +303,7 @@ EXPORT_SYMBOL(kernel_thread);
 /*
  * sys_execve() executes a new program.
  */
-long sys_execve(const char __user *name,
+asmregparm long sys_execve(const char __user *name,
 		const char __user *const __user *argv,
 		const char __user *const __user *envp, struct pt_regs *regs)
 {
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 8d12878..bdfa8c6 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -287,7 +287,7 @@ EXPORT_SYMBOL_GPL(start_thread);
  * the task-switch, and shows up in ret_from_fork in entry.S,
  * for example.
  */
-__notrace_funcgraph struct task_struct *
+asmregparm __notrace_funcgraph struct task_struct *
 __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 {
 	struct thread_struct *prev = &prev_p->thread,
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index d10b887..7ded2c7 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -370,7 +370,7 @@ void start_thread_ia32(struct pt_regs *regs, u32 new_ip, u32 new_sp)
  * Kprobes not supported here. Set the probe on schedule instead.
  * Function graph tracer not supported too.
  */
-__notrace_funcgraph struct task_struct *
+asmregparm __notrace_funcgraph struct task_struct *
 __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
 {
 	struct thread_struct *prev = &prev_p->thread;
diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
index 40a2493..b304743 100644
--- a/arch/x86/kernel/signal.c
+++ b/arch/x86/kernel/signal.c
@@ -545,7 +545,7 @@ sys_sigaction(int sig, const struct old_sigaction __user *act,
 }
 #endif /* CONFIG_X86_32 */
 
-long
+asmregparm long
 sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
 		struct pt_regs *regs)
 {
@@ -556,7 +556,7 @@ sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
  * Do a signal return; undo the signal stack.
  */
 #ifdef CONFIG_X86_32
-unsigned long sys_sigreturn(struct pt_regs *regs)
+asmregparm unsigned long sys_sigreturn(struct pt_regs *regs)
 {
 	struct sigframe __user *frame;
 	unsigned long ax;
@@ -588,7 +588,7 @@ badframe:
 }
 #endif /* CONFIG_X86_32 */
 
-long sys_rt_sigreturn(struct pt_regs *regs)
+asmregparm long sys_rt_sigreturn(struct pt_regs *regs)
 {
 	struct rt_sigframe __user *frame;
 	unsigned long ax;
@@ -831,7 +831,7 @@ static void do_signal(struct pt_regs *regs)
  * notification of userspace execution resumption
  * - triggered by the TIF_WORK_MASK flags
  */
-void
+asmregparm void
 do_notify_resume(struct pt_regs *regs, void *unused, __u32 thread_info_flags)
 {
 #ifdef CONFIG_X86_MCE
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index 013e7eb..bfcb964 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -196,7 +196,7 @@ static void native_stop_other_cpus(int wait)
 /*
  * Reschedule call back.
  */
-void smp_reschedule_interrupt(struct pt_regs *regs)
+asmregparm void smp_reschedule_interrupt(struct pt_regs *regs)
 {
 	ack_APIC_irq();
 	inc_irq_stat(irq_resched_count);
@@ -206,7 +206,7 @@ void smp_reschedule_interrupt(struct pt_regs *regs)
 	 */
 }
 
-void smp_call_function_interrupt(struct pt_regs *regs)
+asmregparm void smp_call_function_interrupt(struct pt_regs *regs)
 {
 	ack_APIC_irq();
 	irq_enter();
@@ -215,7 +215,7 @@ void smp_call_function_interrupt(struct pt_regs *regs)
 	irq_exit();
 }
 
-void smp_call_function_single_interrupt(struct pt_regs *regs)
+asmregparm void smp_call_function_single_interrupt(struct pt_regs *regs)
 {
 	ack_APIC_irq();
 	irq_enter();
diff --git a/arch/x86/kernel/syscall_64.c b/arch/x86/kernel/syscall_64.c
index de87d60..a576626 100644
--- a/arch/x86/kernel/syscall_64.c
+++ b/arch/x86/kernel/syscall_64.c
@@ -19,7 +19,7 @@ typedef void (*sys_call_ptr_t)(void);
 
 extern void sys_ni_syscall(void);
 
-const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = {
+asmlinkage const sys_call_ptr_t sys_call_table[__NR_syscall_max+1] = {
 	/*
 	*Smells like a like a compiler bug -- it doesn't work
 	*when the & below is removed.
diff --git a/arch/x86/kernel/vm86_32.c b/arch/x86/kernel/vm86_32.c
index 863f875..431060f 100644
--- a/arch/x86/kernel/vm86_32.c
+++ b/arch/x86/kernel/vm86_32.c
@@ -198,7 +198,7 @@ out:
 static int do_vm86_irq_handling(int subfunction, int irqnumber);
 static void do_sys_vm86(struct kernel_vm86_struct *info, struct task_struct *tsk);
 
-int sys_vm86old(struct vm86_struct __user *v86, struct pt_regs *regs)
+asmregparm int sys_vm86old(struct vm86_struct __user *v86, struct pt_regs *regs)
 {
 	struct kernel_vm86_struct info; /* declare this _on top_,
 					 * this avoids wasting of stack space.
@@ -227,6 +227,7 @@ out:
 }
 
 
+asmregparm
 int sys_vm86(unsigned long cmd, unsigned long arg, struct pt_regs *regs)
 {
 	struct kernel_vm86_struct info; /* declare this _on top_,
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index d6c0418..4a9194e 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -124,10 +124,7 @@ EXPORT_SYMBOL_GPL(leave_mm);
  * entry calls in with the first parameter in %eax.  Maybe define
  * intrlinkage?
  */
-#ifdef CONFIG_X86_64
-asmlinkage
-#endif
-void smp_invalidate_interrupt(struct pt_regs *regs)
+asmregparm void smp_invalidate_interrupt(struct pt_regs *regs)
 {
 	unsigned int cpu;
 	unsigned int sender;
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] x86: Change dotraplinkage into asmregparm for 32bit
  2011-06-08  1:09 [PATCH 1/3] x86: Readd asmregparm Andi Kleen
  2011-06-08  1:10 ` [PATCH 2/3] x86: Add missing asmlinkages/asmregparm Andi Kleen
@ 2011-06-08  1:10 ` Andi Kleen
  2011-06-08  8:19 ` [PATCH 1/3] x86: Readd asmregparm Ingo Molnar
  2 siblings, 0 replies; 9+ messages in thread
From: Andi Kleen @ 2011-06-08  1:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andi Kleen, x86

From: Andi Kleen <ak@linux.intel.com>

Now with asmregparm available again it's cleaner to explicitely
mark them as needing register params on 32bit.

Cc: x86@kernel.org
Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 arch/x86/include/asm/traps.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/include/asm/traps.h b/arch/x86/include/asm/traps.h
index 0310da6..2d06195 100644
--- a/arch/x86/include/asm/traps.h
+++ b/arch/x86/include/asm/traps.h
@@ -5,7 +5,7 @@
 #include <asm/siginfo.h>			/* TRAP_TRACE, ... */
 
 #ifdef CONFIG_X86_32
-#define dotraplinkage
+#define dotraplinkage asmregparm
 #else
 #define dotraplinkage asmlinkage
 #endif
-- 
1.7.4.4


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] x86: Readd asmregparm
  2011-06-08  1:09 [PATCH 1/3] x86: Readd asmregparm Andi Kleen
  2011-06-08  1:10 ` [PATCH 2/3] x86: Add missing asmlinkages/asmregparm Andi Kleen
  2011-06-08  1:10 ` [PATCH 3/3] x86: Change dotraplinkage into asmregparm for 32bit Andi Kleen
@ 2011-06-08  8:19 ` Ingo Molnar
  2011-06-08  8:37   ` Andi Kleen
  2 siblings, 1 reply; 9+ messages in thread
From: Ingo Molnar @ 2011-06-08  8:19 UTC (permalink / raw)
  To: Andi Kleen; +Cc: linux-kernel, Andi Kleen, Thomas Gleixner, H. Peter Anvin


* Andi Kleen <andi@firstfloor.org> wrote:

> From: Andi Kleen <ak@linux.intel.com>
> 
> For a followon patchkit of mine I need to mark all functions
> that can be called from assembler. But on 32bit kernels some
> assembler functions are called with register arguments and others
> with stack arguments. asmlinkage forces stack arguments.
> 
> This patch readds the recently removed asmregparm to be able
> to mark assembler functions called with register arguments on 32bit.
> 
> Unlike the old code it's x86 only now to prevent it from
> leaking.
> 
> Cc: x86@kernel.org
> Signed-off-by: Andi Kleen <ak@linux.intel.com>

That's a totally useless changelog (you are deliberately hiding 
information again) so the series is obviously not acceptable.
Please fix and resend.

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] x86: Readd asmregparm
  2011-06-08  8:19 ` [PATCH 1/3] x86: Readd asmregparm Ingo Molnar
@ 2011-06-08  8:37   ` Andi Kleen
  2011-06-08  8:53     ` Ingo Molnar
  2011-06-08 11:57     ` Pekka Enberg
  0 siblings, 2 replies; 9+ messages in thread
From: Andi Kleen @ 2011-06-08  8:37 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Andi Kleen, linux-kernel, Andi Kleen, Thomas Gleixner, H. Peter Anvin

> That's a totally useless changelog (you are deliberately hiding 
> information again) so the series is obviously not acceptable.
> Please fix and resend.

I reread it and it seems complete to me. Please be more specific.

If you refer to the followon patchkit - it's not ready for posting
yet. However I believe these changes are reasonable cleanups that are useful
on their own. That's why I posted them now.

-Andi

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] x86: Readd asmregparm
  2011-06-08  8:37   ` Andi Kleen
@ 2011-06-08  8:53     ` Ingo Molnar
  2011-06-08 11:57     ` Pekka Enberg
  1 sibling, 0 replies; 9+ messages in thread
From: Ingo Molnar @ 2011-06-08  8:53 UTC (permalink / raw)
  To: Andi Kleen, Andi Kleen; +Cc: linux-kernel, Thomas Gleixner, H. Peter Anvin


* Andi Kleen <andi@firstfloor.org> wrote:

> > That's a totally useless changelog (you are deliberately hiding 
> > information again) so the series is obviously not acceptable.
> > Please fix and resend.
> 
> I reread it and it seems complete to me. Please be more specific.
> 
> If you refer to the followon patchkit - it's not ready for posting 
> yet. [...]

You contradict yourself here - why do you claim that it's "complete" 
while you readily admit in the *next* sentence that the "followon 
patchkit" (with no specifics provided whatsoever) is "not ready for 
posting yet"?

You are not a newbie anymore, you know what the rules are for 
*everyone*: if it's not ready for posting yet then don't send a 
half-done series for inclusion, wasting everyone's time.

> [...] However I believe these changes are reasonable cleanups that 
> are useful on their own. That's why I posted them now.

Uhm, that's trivially untrue crazy talk and you should know it: the 
patches add code and typing complexity for no good stated reason 
whatsoever.

If we want the maintenance overhead of that then you better come up 
with your deliberately kept secret "project" and we'll be able to 
weigh whether the benefits overweigh the maintenance costs ...

In any case, i'd like to warn you that you are very close to me 
starting to ignore your mails summarily due to absymal low quality: 
in the past few months 70-80% of the cases your first patch 
submissions were trivially flawed, and in many cases you should have 
been well aware of the fact that they were trivially flawed. And 
that's not from a newbie but from a long-time kernel contributor!

Thanks,

	Ingo

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] x86: Readd asmregparm
  2011-06-08  8:37   ` Andi Kleen
  2011-06-08  8:53     ` Ingo Molnar
@ 2011-06-08 11:57     ` Pekka Enberg
  2011-06-08 12:28       ` Christoph Lameter
  2011-06-08 16:01       ` Andi Kleen
  1 sibling, 2 replies; 9+ messages in thread
From: Pekka Enberg @ 2011-06-08 11:57 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Ingo Molnar, linux-kernel, Andi Kleen, Thomas Gleixner, H. Peter Anvin

Hi Andi,

On Wed, Jun 8, 2011 at 11:37 AM, Andi Kleen <andi@firstfloor.org> wrote:
>> That's a totally useless changelog (you are deliberately hiding
>> information again) so the series is obviously not acceptable.
>> Please fix and resend.
>
> I reread it and it seems complete to me. Please be more specific.
>
> If you refer to the followon patchkit - it's not ready for posting
> yet. However I believe these changes are reasonable cleanups that are useful
> on their own. That's why I posted them now.

So from my point of view, none of the changelogs explain why the
changes needed. Now, I'm not an expert on the x86 code so maybe I'm
missing something obvious but to me the only rationale seems to be
that you need it some unspecified follow-up patchkit. HTH.

                         Pekka

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] x86: Readd asmregparm
  2011-06-08 11:57     ` Pekka Enberg
@ 2011-06-08 12:28       ` Christoph Lameter
  2011-06-08 16:01       ` Andi Kleen
  1 sibling, 0 replies; 9+ messages in thread
From: Christoph Lameter @ 2011-06-08 12:28 UTC (permalink / raw)
  To: Pekka Enberg
  Cc: Andi Kleen, Ingo Molnar, linux-kernel, Andi Kleen,
	Thomas Gleixner, H. Peter Anvin

On Wed, 8 Jun 2011, Pekka Enberg wrote:

> Hi Andi,
>
> On Wed, Jun 8, 2011 at 11:37 AM, Andi Kleen <andi@firstfloor.org> wrote:
> >> That's a totally useless changelog (you are deliberately hiding
> >> information again) so the series is obviously not acceptable.
> >> Please fix and resend.
> >
> > I reread it and it seems complete to me. Please be more specific.
> >
> > If you refer to the followon patchkit - it's not ready for posting
> > yet. However I believe these changes are reasonable cleanups that are useful
> > on their own. That's why I posted them now.
>
> So from my point of view, none of the changelogs explain why the
> changes needed. Now, I'm not an expert on the x86 code so maybe I'm
> missing something obvious but to me the only rationale seems to be
> that you need it some unspecified follow-up patchkit. HTH.

Ok but the changelog is explaining the patch as far as I can tell. Its
just that there is not enough of a justification for inclusion without the
follow on patches and clarity on the ultimate purpose of the whole
endeavor. In general some more specificity and less emotions may be
helpful.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] x86: Readd asmregparm
  2011-06-08 11:57     ` Pekka Enberg
  2011-06-08 12:28       ` Christoph Lameter
@ 2011-06-08 16:01       ` Andi Kleen
  1 sibling, 0 replies; 9+ messages in thread
From: Andi Kleen @ 2011-06-08 16:01 UTC (permalink / raw)
  To: Pekka Enberg
  Cc: Andi Kleen, Ingo Molnar, linux-kernel, Andi Kleen,
	Thomas Gleixner, H. Peter Anvin


> So from my point of view, none of the changelogs explain why the
> changes needed. Now, I'm not an expert on the x86 code so maybe I'm
> that you need it some unspecified follow-up patchkit. HTH.

Proper asmlinkages are imho a cleanliness feature that stands
on its own. They have been used in the past for all kinds of things,
but unfortunately have bitrotted recently on x86.

If nothing else they are useful documentation. For example
if you do grep for *.[ch] only and you hit an asmlinkage it's a good
hint to look into the .S too. In general you need to be much more
careful about any changes to those, because assembler is more fragile.

I have been encouraged by other people to post those early, so I did.
and at least in my traditional Linux development world view posting 
patches early is the right thing to do.

-Andi

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-06-08 16:01 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-08  1:09 [PATCH 1/3] x86: Readd asmregparm Andi Kleen
2011-06-08  1:10 ` [PATCH 2/3] x86: Add missing asmlinkages/asmregparm Andi Kleen
2011-06-08  1:10 ` [PATCH 3/3] x86: Change dotraplinkage into asmregparm for 32bit Andi Kleen
2011-06-08  8:19 ` [PATCH 1/3] x86: Readd asmregparm Ingo Molnar
2011-06-08  8:37   ` Andi Kleen
2011-06-08  8:53     ` Ingo Molnar
2011-06-08 11:57     ` Pekka Enberg
2011-06-08 12:28       ` Christoph Lameter
2011-06-08 16:01       ` Andi Kleen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.