lkml.org 
[lkml]   [2019]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] powerpc/irq: don't use current_stack_pointer() in do_IRQ()
From
Date


Le 12/12/2019 à 13:51, Christoph Hellwig a écrit :
> Why can't current_stack_pointer be turned into an inline function using
> inline assembly? That would reduce the overhead for all callers.
>

In the old days, it was a macro, and it was changed into an assembly
function by commit
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=bfe9a2cfe91a

It was later renamed from __get_SP() to current_stack_pointer() by
commit
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=acf620ecf56cfc4edaffaf158250e128539cdd26

But in fact this function is badly named as it doesn't provide the
current stack pointer but a pointer to the parent's stack frame.

Having it as an extern function forces GCC to set a stack frame in the
calling function. If inline assembly is used instead, there's a risk of
not getting a stack frame in the calling function, in which case the
current_stack_pointer() will return the grandparent's stackframe pointer
instead of the parent's one.

Christophe

\
 
 \ /
  Last update: 2019-12-12 17:30    [W:0.026 / U:4.876 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site