diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-10 18:03:41 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-09-30 23:03:03 -0400 |
commit | 37fe5d41f6403b0ea84c1586548bf1b03f834af0 (patch) | |
tree | 37e404af54f246a686dba85099187415591cde9d | |
parent | 65f22a906e154e8086ed561904d09c3586de85f4 (diff) |
s390: fold kernel_thread_helper() into ret_from_fork()
... and don't bother with syscall return path in case of kernel
threads.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | arch/s390/kernel/entry.S | 18 | ||||
-rw-r--r-- | arch/s390/kernel/entry64.S | 16 | ||||
-rw-r--r-- | arch/s390/kernel/process.c | 10 |
3 files changed, 28 insertions, 16 deletions
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S index 6286985a1039..24de1cd3754b 100644 --- a/arch/s390/kernel/entry.S +++ b/arch/s390/kernel/entry.S | |||
@@ -331,14 +331,26 @@ ENTRY(ret_from_fork) | |||
331 | l %r12,__LC_THREAD_INFO | 331 | l %r12,__LC_THREAD_INFO |
332 | l %r13,__LC_SVC_NEW_PSW+4 | 332 | l %r13,__LC_SVC_NEW_PSW+4 |
333 | tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ? | 333 | tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ? |
334 | jo 0f | 334 | je 1f |
335 | st %r15,__PT_R15(%r11) # store stack pointer for new kthread | 335 | l %r1,BASED(.Lschedule_tail) |
336 | 0: l %r1,BASED(.Lschedule_tail) | ||
337 | basr %r14,%r1 # call schedule_tail | 336 | basr %r14,%r1 # call schedule_tail |
338 | TRACE_IRQS_ON | 337 | TRACE_IRQS_ON |
339 | ssm __LC_SVC_NEW_PSW # reenable interrupts | 338 | ssm __LC_SVC_NEW_PSW # reenable interrupts |
340 | j sysc_tracenogo | 339 | j sysc_tracenogo |
341 | 340 | ||
341 | 1: # it's a kernel thread | ||
342 | st %r15,__PT_R15(%r11) # store stack pointer for new kthread | ||
343 | l %r1,BASED(.Lschedule_tail) | ||
344 | basr %r14,%r1 # call schedule_tail | ||
345 | TRACE_IRQS_ON | ||
346 | ssm __LC_SVC_NEW_PSW # reenable interrupts | ||
347 | lm %r9,%r11,__PT_R9(%r11) # load gprs | ||
348 | ENTRY(kernel_thread_starter) | ||
349 | la %r2,0(%r10) | ||
350 | basr %r14,%r9 | ||
351 | la %r2,0 | ||
352 | br %r11 # do_exit | ||
353 | |||
342 | # | 354 | # |
343 | # kernel_execve function needs to deal with pt_regs that is not | 355 | # kernel_execve function needs to deal with pt_regs that is not |
344 | # at the usual place | 356 | # at the usual place |
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S index 1f776f2edda5..39c84e65f74f 100644 --- a/arch/s390/kernel/entry64.S +++ b/arch/s390/kernel/entry64.S | |||
@@ -352,12 +352,22 @@ ENTRY(ret_from_fork) | |||
352 | la %r11,STACK_FRAME_OVERHEAD(%r15) | 352 | la %r11,STACK_FRAME_OVERHEAD(%r15) |
353 | lg %r12,__LC_THREAD_INFO | 353 | lg %r12,__LC_THREAD_INFO |
354 | tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ? | 354 | tm __PT_PSW+1(%r11),0x01 # forking a kernel thread ? |
355 | jo 0f | 355 | je 1f |
356 | stg %r15,__PT_R15(%r11) # store stack pointer for new kthread | 356 | brasl %r14,schedule_tail |
357 | 0: brasl %r14,schedule_tail | ||
358 | TRACE_IRQS_ON | 357 | TRACE_IRQS_ON |
359 | ssm __LC_SVC_NEW_PSW # reenable interrupts | 358 | ssm __LC_SVC_NEW_PSW # reenable interrupts |
360 | j sysc_tracenogo | 359 | j sysc_tracenogo |
360 | 1: # it's a kernel thread | ||
361 | stg %r15,__PT_R15(%r11) # store stack pointer for new kthread | ||
362 | brasl %r14,schedule_tail | ||
363 | TRACE_IRQS_ON | ||
364 | ssm __LC_SVC_NEW_PSW # reenable interrupts | ||
365 | lmg %r9,%r11,__PT_R9(%r11) # load gprs | ||
366 | ENTRY(kernel_thread_starter) | ||
367 | la %r2,0(%r10) | ||
368 | basr %r14,%r9 | ||
369 | la %r2,0 | ||
370 | br %r11 # do_exit | ||
361 | 371 | ||
362 | # | 372 | # |
363 | # kernel_execve function needs to deal with pt_regs that is not | 373 | # kernel_execve function needs to deal with pt_regs that is not |
diff --git a/arch/s390/kernel/process.c b/arch/s390/kernel/process.c index e540251e1dd1..2868a364ff94 100644 --- a/arch/s390/kernel/process.c +++ b/arch/s390/kernel/process.c | |||
@@ -98,16 +98,6 @@ void cpu_idle(void) | |||
98 | 98 | ||
99 | extern void __kprobes kernel_thread_starter(void); | 99 | extern void __kprobes kernel_thread_starter(void); |
100 | 100 | ||
101 | asm( | ||
102 | ".section .kprobes.text, \"ax\"\n" | ||
103 | ".global kernel_thread_starter\n" | ||
104 | "kernel_thread_starter:\n" | ||
105 | " la 2,0(10)\n" | ||
106 | " basr 14,9\n" | ||
107 | " la 2,0\n" | ||
108 | " br 11\n" | ||
109 | ".previous\n"); | ||
110 | |||
111 | int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) | 101 | int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags) |
112 | { | 102 | { |
113 | struct pt_regs regs; | 103 | struct pt_regs regs; |