Thread (3 messages) read the whole thread 3 messages, 2 authors, 2019-12-12

Re: [PATCH] powerpc/irq: don't use current_stack_pointer() in do_IRQ()

From: Christophe Leroy <hidden>
Date: 2019-12-12 16:29:09
Also in: lkml


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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help