aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/entry_64.S
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2008-11-27 08:41:21 -0500
committerIngo Molnar <mingo@elte.hu>2008-11-28 09:01:46 -0500
commit5b3eec0c80038c8739ccd465b897a35c0dff1cc4 (patch)
tree52a4625c34af62dc41233ecdf21e2d5262683e8f /arch/x86/kernel/entry_64.S
parent3bdae4f46445ea7cc9ee031d7ff106fdc6228669 (diff)
x86: ret_from_fork - get rid of jump back
Impact: remove dead code If we take a closer look at the rff_trace/rff_action ret_from_fork code, we have to realize that it does all the wrong things: for example it checks the TIF flag - while later on jumping back to the ret-from-syscall path - duplicating the check needlessly. But checking for _TIF_SYSCALL_TRACE is completely unnecessary here because we clear that flag for every freshly forked task. So the whole "tracing" code here, for which there is a out of line jump optimization that makes it even harder to read, is in reality completely dead code ... Reported-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Ingo Molnar <mingo@elte.hu> Tested-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'arch/x86/kernel/entry_64.S')
-rw-r--r--arch/x86/kernel/entry_64.S31
1 files changed, 16 insertions, 15 deletions
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index e41734a537b..3194636a429 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -361,34 +361,35 @@ ENTRY(save_paranoid)
361END(save_paranoid) 361END(save_paranoid)
362 362
363/* 363/*
364 * A newly forked process directly context switches into this. 364 * A newly forked process directly context switches into this address.
365 *
366 * rdi: prev task we switched from
365 */ 367 */
366/* rdi: prev */
367ENTRY(ret_from_fork) 368ENTRY(ret_from_fork)
368 DEFAULT_FRAME 369 DEFAULT_FRAME
370
369 push kernel_eflags(%rip) 371 push kernel_eflags(%rip)
370 CFI_ADJUST_CFA_OFFSET 8 372 CFI_ADJUST_CFA_OFFSET 8
371 popf # reset kernel eflags 373 popf # reset kernel eflags
372 CFI_ADJUST_CFA_OFFSET -8 374 CFI_ADJUST_CFA_OFFSET -8
373 call schedule_tail 375
376 call schedule_tail # rdi: 'prev' task parameter
377
374 GET_THREAD_INFO(%rcx) 378 GET_THREAD_INFO(%rcx)
375 testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT),TI_flags(%rcx) 379
376 CFI_REMEMBER_STATE 380 CFI_REMEMBER_STATE
377 jnz rff_trace
378rff_action:
379 RESTORE_REST 381 RESTORE_REST
380 testl $3,CS-ARGOFFSET(%rsp) # from kernel_thread? 382
383 testl $3, CS-ARGOFFSET(%rsp) # from kernel_thread?
381 je int_ret_from_sys_call 384 je int_ret_from_sys_call
382 testl $_TIF_IA32,TI_flags(%rcx) 385
386 testl $_TIF_IA32, TI_flags(%rcx) # 32-bit compat task needs IRET
383 jnz int_ret_from_sys_call 387 jnz int_ret_from_sys_call
388
384 RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET 389 RESTORE_TOP_OF_STACK %rdi, -ARGOFFSET
385 jmp ret_from_sys_call 390 jmp ret_from_sys_call # go to the SYSRET fastpath
391
386 CFI_RESTORE_STATE 392 CFI_RESTORE_STATE
387rff_trace:
388 movq %rsp,%rdi
389 call syscall_trace_leave
390 GET_THREAD_INFO(%rcx)
391 jmp rff_action
392 CFI_ENDPROC 393 CFI_ENDPROC
393END(ret_from_fork) 394END(ret_from_fork)
394 395