Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-10 Thread Segher Boessenkool
Hi! On Wed, Mar 10, 2021 at 11:32:20AM +, Mark Rutland wrote: > On Tue, Mar 09, 2021 at 04:05:32PM -0600, Segher Boessenkool wrote: > > On Tue, Mar 09, 2021 at 04:05:23PM +, Mark Rutland wrote: > > > On Thu, Mar 04, 2021 at 03:54:48PM -0600, Segher Boessenkool wrote: > > > > On Thu, Mar

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-10 Thread Mark Rutland
On Tue, Mar 09, 2021 at 04:05:32PM -0600, Segher Boessenkool wrote: > Hi! > > On Tue, Mar 09, 2021 at 04:05:23PM +, Mark Rutland wrote: > > On Thu, Mar 04, 2021 at 03:54:48PM -0600, Segher Boessenkool wrote: > > > On Thu, Mar 04, 2021 at 02:57:30PM +, Mark Rutland wrote: > > > > It looks

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-09 Thread Segher Boessenkool
Hi! On Tue, Mar 09, 2021 at 04:05:23PM +, Mark Rutland wrote: > On Thu, Mar 04, 2021 at 03:54:48PM -0600, Segher Boessenkool wrote: > > On Thu, Mar 04, 2021 at 02:57:30PM +, Mark Rutland wrote: > > > It looks like GCC is happy to give us the function-entry-time FP if we use > > >

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-09 Thread Mark Rutland
On Thu, Mar 04, 2021 at 03:54:48PM -0600, Segher Boessenkool wrote: > Hi! Hi Segher, > On Thu, Mar 04, 2021 at 02:57:30PM +, Mark Rutland wrote: > > It looks like GCC is happy to give us the function-entry-time FP if we use > > __builtin_frame_address(1), > > From the GCC manual: >

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-05 Thread Segher Boessenkool
On Fri, Mar 05, 2021 at 07:38:25AM +0100, Christophe Leroy wrote: > Le 04/03/2021 à 20:24, Segher Boessenkool a écrit : > https://github.com/linuxppc/linux/commit/a9a3ed1eff36 > > > > >That is much heavier than needed (an mb()). You can just put an empty > >inline asm after a call before a

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-05 Thread Mark Rutland
On Thu, Mar 04, 2021 at 08:01:29PM +0100, Marco Elver wrote: > On Thu, 4 Mar 2021 at 19:51, Mark Rutland wrote: > > On Thu, Mar 04, 2021 at 07:22:53PM +0100, Marco Elver wrote: > > > I was having this problem with KCSAN, where the compiler would > > > tail-call-optimize __tsan_X instrumentation.

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Christophe Leroy
Le 04/03/2021 à 20:24, Segher Boessenkool a écrit : On Thu, Mar 04, 2021 at 09:54:44AM -0800, Nick Desaulniers wrote: On Thu, Mar 4, 2021 at 9:42 AM Marco Elver wrote: include/linux/compiler.h:246: prevent_tail_call_optimization commit a9a3ed1eff36 ("x86: Fix early boot crash on gcc-10,

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Marco Elver
On Thu, 4 Mar 2021 at 19:51, Mark Rutland wrote: > On Thu, Mar 04, 2021 at 07:22:53PM +0100, Marco Elver wrote: > > On Thu, 4 Mar 2021 at 19:02, Mark Rutland wrote: > > > On Thu, Mar 04, 2021 at 06:25:33PM +0100, Marco Elver wrote: > > > > On Thu, Mar 04, 2021 at 04:59PM +, Mark Rutland

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Marco Elver
On Thu, 4 Mar 2021 at 19:02, Mark Rutland wrote: > On Thu, Mar 04, 2021 at 06:25:33PM +0100, Marco Elver wrote: > > On Thu, Mar 04, 2021 at 04:59PM +, Mark Rutland wrote: > > > On Thu, Mar 04, 2021 at 04:30:34PM +0100, Marco Elver wrote: > > > > On Thu, 4 Mar 2021 at 15:57, Mark Rutland

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Segher Boessenkool
Hi! On Thu, Mar 04, 2021 at 02:57:30PM +, Mark Rutland wrote: > It looks like GCC is happy to give us the function-entry-time FP if we use > __builtin_frame_address(1), >From the GCC manual: Calling this function with a nonzero argument can have unpredictable effects, including

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Nick Desaulniers
On Thu, Mar 4, 2021 at 9:42 AM Marco Elver wrote: > > On Thu, Mar 04, 2021 at 04:59PM +, Mark Rutland wrote: > > On Thu, Mar 04, 2021 at 04:30:34PM +0100, Marco Elver wrote: > > > On Thu, 4 Mar 2021 at 15:57, Mark Rutland wrote: > > > > [adding Mark Brown] > > > > > > > > The bigger problem

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Marco Elver
On Thu, Mar 04, 2021 at 04:59PM +, Mark Rutland wrote: > On Thu, Mar 04, 2021 at 04:30:34PM +0100, Marco Elver wrote: > > On Thu, 4 Mar 2021 at 15:57, Mark Rutland wrote: > > > [adding Mark Brown] > > > > > > The bigger problem here is that skipping is dodgy to begin with, and > > > this is

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Marco Elver
On Thu, 4 Mar 2021 at 15:57, Mark Rutland wrote: > [adding Mark Brown] > > On Wed, Mar 03, 2021 at 04:20:43PM +0100, Marco Elver wrote: > > On Wed, Mar 03, 2021 at 03:52PM +0100, Christophe Leroy wrote: > > > Le 03/03/2021 � 15:38, Marco Elver a �crit�: > > > > On Wed, 3 Mar 2021 at 15:09,

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Segher Boessenkool
On Thu, Mar 04, 2021 at 09:54:44AM -0800, Nick Desaulniers wrote: > On Thu, Mar 4, 2021 at 9:42 AM Marco Elver wrote: > include/linux/compiler.h:246: > prevent_tail_call_optimization > > commit a9a3ed1eff36 ("x86: Fix early boot crash on gcc-10, third try") That is much heavier than needed (an

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Mark Rutland
On Thu, Mar 04, 2021 at 07:22:53PM +0100, Marco Elver wrote: > On Thu, 4 Mar 2021 at 19:02, Mark Rutland wrote: > > On Thu, Mar 04, 2021 at 06:25:33PM +0100, Marco Elver wrote: > > > On Thu, Mar 04, 2021 at 04:59PM +, Mark Rutland wrote: > > > > On Thu, Mar 04, 2021 at 04:30:34PM +0100, Marco

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Mark Rutland
On Thu, Mar 04, 2021 at 06:25:33PM +0100, Marco Elver wrote: > On Thu, Mar 04, 2021 at 04:59PM +, Mark Rutland wrote: > > On Thu, Mar 04, 2021 at 04:30:34PM +0100, Marco Elver wrote: > > > On Thu, 4 Mar 2021 at 15:57, Mark Rutland wrote: > > > > [adding Mark Brown] > > > > > > > > The bigger

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Mark Rutland
On Thu, Mar 04, 2021 at 04:30:34PM +0100, Marco Elver wrote: > On Thu, 4 Mar 2021 at 15:57, Mark Rutland wrote: > > [adding Mark Brown] > > > > The bigger problem here is that skipping is dodgy to begin with, and > > this is still liable to break in some cases. One big concern is that > >

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-04 Thread Mark Rutland
[adding Mark Brown] On Wed, Mar 03, 2021 at 04:20:43PM +0100, Marco Elver wrote: > On Wed, Mar 03, 2021 at 03:52PM +0100, Christophe Leroy wrote: > > Le 03/03/2021 � 15:38, Marco Elver a �crit�: > > > On Wed, 3 Mar 2021 at 15:09, Christophe Leroy > > > wrote: > > > > > > > > It seems like

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-03 Thread Marco Elver
On Wed, Mar 03, 2021 at 03:52PM +0100, Christophe Leroy wrote: > Le 03/03/2021 à 15:38, Marco Elver a écrit : > > On Wed, 3 Mar 2021 at 15:09, Christophe Leroy > > wrote: > > > > > > It seems like all other sane architectures, namely x86 and arm64 > > > at least, include the running function as

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-03 Thread Marco Elver
On Wed, 3 Mar 2021 at 15:09, Christophe Leroy wrote: > > It seems like all other sane architectures, namely x86 and arm64 > at least, include the running function as top entry when saving > stack trace. > > Functionnalities like KFENCE expect it. > > Do the same on powerpc, it allows KFENCE to

Re: [PATCH v1] powerpc: Include running function as first entry in save_stack_trace() and friends

2021-03-03 Thread Christophe Leroy
Le 03/03/2021 à 15:38, Marco Elver a écrit : On Wed, 3 Mar 2021 at 15:09, Christophe Leroy wrote: It seems like all other sane architectures, namely x86 and arm64 at least, include the running function as top entry when saving stack trace. Functionnalities like KFENCE expect it. Do the