Re: Failure to build librseq on ppc

2020-07-09 Thread Mathieu Desnoyers
- On Jul 9, 2020, at 4:46 PM, Segher Boessenkool seg...@kernel.crashing.org wrote: > On Thu, Jul 09, 2020 at 01:56:19PM -0400, Mathieu Desnoyers wrote: >> > Just to make sure I understand your recommendation. So rather than >> > hard coding r17 as the temporary registers, we could explicitly

Re: Failure to build librseq on ppc

2020-07-09 Thread Segher Boessenkool
On Thu, Jul 09, 2020 at 01:56:19PM -0400, Mathieu Desnoyers wrote: > > Just to make sure I understand your recommendation. So rather than > > hard coding r17 as the temporary registers, we could explicitly > > declare the temporary register as a C variable, pass it as an > > input operand to the

Re: Failure to build librseq on ppc

2020-07-09 Thread Segher Boessenkool
On Thu, Jul 09, 2020 at 01:42:56PM -0400, Mathieu Desnoyers wrote: > > That works fine then, for a testcase. Using r17 is not a great idea for > > performance (it increases the active register footprint, and causes more > > registers to be saved in the prologue of the functions, esp. on older > >

Re: Failure to build librseq on ppc

2020-07-09 Thread Mathieu Desnoyers
- On Jul 9, 2020, at 1:42 PM, Mathieu Desnoyers mathieu.desnoy...@efficios.com wrote: > - On Jul 9, 2020, at 1:37 PM, Segher Boessenkool > seg...@kernel.crashing.org > wrote: > >> On Thu, Jul 09, 2020 at 09:43:47AM -0400, Mathieu Desnoyers wrote: >>> > What protects r17 *after* this

Re: Failure to build librseq on ppc

2020-07-09 Thread Mathieu Desnoyers
- On Jul 9, 2020, at 1:37 PM, Segher Boessenkool seg...@kernel.crashing.org wrote: > On Thu, Jul 09, 2020 at 09:43:47AM -0400, Mathieu Desnoyers wrote: >> > What protects r17 *after* this asm statement? >> >> As discussed in the other leg of the thread (with the code example), >> r17 is in

Re: Failure to build librseq on ppc

2020-07-09 Thread Segher Boessenkool
On Thu, Jul 09, 2020 at 09:43:47AM -0400, Mathieu Desnoyers wrote: > > What protects r17 *after* this asm statement? > > As discussed in the other leg of the thread (with the code example), > r17 is in the clobber list of all asm statements using this macro, and > is used as a temporary register

Re: Failure to build librseq on ppc

2020-07-09 Thread Segher Boessenkool
On Thu, Jul 09, 2020 at 09:33:18AM -0400, Mathieu Desnoyers wrote: > > The way this all uses r17 will likely not work reliably. > > r17 is only used as a temporary register within the inline assembler, and it > is > in the clobber list. In which scenario would it not work reliably ? This isn't

Re: Failure to build librseq on ppc

2020-07-09 Thread Mathieu Desnoyers
- On Jul 8, 2020, at 8:18 PM, Segher Boessenkool seg...@kernel.crashing.org wrote: > On Wed, Jul 08, 2020 at 08:01:23PM -0400, Mathieu Desnoyers wrote: >> > > #define RSEQ_ASM_OP_CMPEQ(var, expect, label) >> > > \ >> > > LOAD_WORD "%%r17, %[" __rseq_str(var) "]\n\t"

Re: Failure to build librseq on ppc

2020-07-09 Thread Mathieu Desnoyers
- On Jul 8, 2020, at 8:10 PM, Segher Boessenkool seg...@kernel.crashing.org wrote: > Hi! > > On Wed, Jul 08, 2020 at 10:00:01AM -0400, Mathieu Desnoyers wrote: [...] > >> -#define STORE_WORD "std " >> -#define LOAD_WORD "ld " >> -#define LOADX_WORD "ldx " >> +#define

Re: Failure to build librseq on ppc

2020-07-08 Thread Segher Boessenkool
On Wed, Jul 08, 2020 at 08:01:23PM -0400, Mathieu Desnoyers wrote: > > > #define RSEQ_ASM_OP_CMPEQ(var, expect, label) > > > \ > > > LOAD_WORD "%%r17, %[" __rseq_str(var) "]\n\t" > > > \ > > > > The way this hardcodes r17

Re: Failure to build librseq on ppc

2020-07-08 Thread Segher Boessenkool
On Wed, Jul 08, 2020 at 10:32:20AM -0400, Mathieu Desnoyers wrote: > > As far as I can see, %U is mentioned in > > https://gcc.gnu.org/onlinedocs/gcc/Machine-Constraints.html in the > > powerpc subpart, at the "m" constraint. > > Yep, I did notice it, but mistakenly thought it was only needed for

Re: Failure to build librseq on ppc

2020-07-08 Thread Segher Boessenkool
Hi! On Wed, Jul 08, 2020 at 10:00:01AM -0400, Mathieu Desnoyers wrote: > >> So perhaps you have code like > >> > >> int *p; > >> int x; > >> ... > >> asm ("lwz %0,%1" : "=r"(x) : "m"(*p)); > > > > We indeed have explicit "lwz" and "stw" instructions in there. > > > >> > >> where that last

Re: Failure to build librseq on ppc

2020-07-08 Thread Mathieu Desnoyers
- Segher Boessenkool wrote: > Hi! > > On Wed, Jul 08, 2020 at 10:27:27PM +1000, Michael Ellerman wrote: > > Segher Boessenkool writes: > > > You'll have to show the actual failing machine code, and with enough > > > context that we can relate this to the source code. > > > > > >

Re: Failure to build librseq on ppc

2020-07-08 Thread Segher Boessenkool
Hi! On Wed, Jul 08, 2020 at 10:27:27PM +1000, Michael Ellerman wrote: > Segher Boessenkool writes: > > You'll have to show the actual failing machine code, and with enough > > context that we can relate this to the source code. > > > > -save-temps helps, or use -S instead of -c, etc. > >

Re: Failure to build librseq on ppc

2020-07-08 Thread Christophe Leroy
Le 08/07/2020 à 16:32, Mathieu Desnoyers a écrit : - On Jul 8, 2020, at 10:21 AM, Christophe Leroy christophe.le...@csgroup.eu wrote: Le 08/07/2020 à 16:00, Mathieu Desnoyers a écrit : - On Jul 8, 2020, at 8:33 AM, Mathieu Desnoyers mathieu.desnoy...@efficios.com wrote: - On

Re: Failure to build librseq on ppc

2020-07-08 Thread Mathieu Desnoyers
- On Jul 8, 2020, at 10:21 AM, Christophe Leroy christophe.le...@csgroup.eu wrote: > Le 08/07/2020 à 16:00, Mathieu Desnoyers a écrit : >> - On Jul 8, 2020, at 8:33 AM, Mathieu Desnoyers >> mathieu.desnoy...@efficios.com wrote: >> >>> - On Jul 7, 2020, at 8:59 PM, Segher Boessenkool

Re: Failure to build librseq on ppc

2020-07-08 Thread Christophe Leroy
Le 08/07/2020 à 16:00, Mathieu Desnoyers a écrit : - On Jul 8, 2020, at 8:33 AM, Mathieu Desnoyers mathieu.desnoy...@efficios.com wrote: - On Jul 7, 2020, at 8:59 PM, Segher Boessenkool seg...@kernel.crashing.org wrote: [...] So perhaps you have code like int *p; int x;

Re: Failure to build librseq on ppc

2020-07-08 Thread Mathieu Desnoyers
- On Jul 8, 2020, at 8:33 AM, Mathieu Desnoyers mathieu.desnoy...@efficios.com wrote: > - On Jul 7, 2020, at 8:59 PM, Segher Boessenkool > seg...@kernel.crashing.org > wrote: [...] >> >> So perhaps you have code like >> >> int *p; >> int x; >> ... >> asm ("lwz %0,%1" : "=r"(x) :

Re: Failure to build librseq on ppc

2020-07-08 Thread Mathieu Desnoyers
- On Jul 7, 2020, at 8:59 PM, Segher Boessenkool seg...@kernel.crashing.org wrote: > Hi! > > On Tue, Jul 07, 2020 at 03:17:10PM -0400, Mathieu Desnoyers wrote: >> I'm trying to build librseq at: >> >> https://git.kernel.org/pub/scm/libs/librseq/librseq.git >> >> on powerpc, and I get

Re: Failure to build librseq on ppc

2020-07-08 Thread Michael Ellerman
Segher Boessenkool writes: > Hi! > > On Tue, Jul 07, 2020 at 03:17:10PM -0400, Mathieu Desnoyers wrote: >> I'm trying to build librseq at: >> >> https://git.kernel.org/pub/scm/libs/librseq/librseq.git >> >> on powerpc, and I get these errors when building the rseq basic >> test mirrored from

Re: Failure to build librseq on ppc

2020-07-07 Thread Segher Boessenkool
Hi! On Tue, Jul 07, 2020 at 03:17:10PM -0400, Mathieu Desnoyers wrote: > I'm trying to build librseq at: > > https://git.kernel.org/pub/scm/libs/librseq/librseq.git > > on powerpc, and I get these errors when building the rseq basic > test mirrored from the kernel selftests code: > >

Failure to build librseq on ppc

2020-07-07 Thread Mathieu Desnoyers
Hi Boqun, I'm trying to build librseq at: https://git.kernel.org/pub/scm/libs/librseq/librseq.git on powerpc, and I get these errors when building the rseq basic test mirrored from the kernel selftests code: /tmp/ccieEWxU.s: Assembler messages: /tmp/ccieEWxU.s:118: Error: syntax error; found