Thread (7 messages) flat view 7 messages, 3 authors, 2021-05-10

Re: Kernel crosscompilers

From: Michael Ellerman <mpe@ellerman.id.au>
Date: 2021-05-10 06:07:45

Christophe Leroy [off-list ref] writes:
Le 08/05/2021 à 08:46, Christophe Leroy a écrit :
quoted
Le 06/05/2021 à 16:17, Arnd Bergmann a écrit :
quoted
On Thu, May 6, 2021 at 2:42 PM Christophe Leroy
[off-list ref] wrote:
quoted
Hello Arnd,

May I ask you whether you plan to build cross compilers based on GCC 11.1 at
https://mirrors.edge.kernel.org/pub/tools/crosstool/ ?
Hi Christophe,

I've built a snapshot a few days before the release, that one is
identical to 11.1
except for the reported version number. I've tried to ask around for
help testing
this, but so far I have not heard from anyone.

Building a new set of compilers takes around a day on my build box, so I want
to make sure I don't have to do it more often than necessary. If you are able
to give the binaries a spin, preferably on a ppc64le or arm64 host, please let
me know how it goes and I'll rebuilt them on the release tag.
Hi Arnd,

I don't have any ppc or arm host I can build on.
I'm building on x86 for powerpc embedded boards.

I have tried your GCC 11 snapshot, I get something booting but it crashes when launching init.

[    7.368410] init[1]: bad frame in sys_sigreturn: 7fb2fd60 nip 001083cc lr 001083c4
[    7.376283] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    7.383680] CPU: 0 PID: 1 Comm: init Not tainted 5.12.0-s3k-dev-16316-g9e799d5df185 #5054
[    7.391767] Call Trace:
[    7.394174] [c9023db0] [c00211e8] panic+0x130/0x304 (unreliable)
[    7.400112] [c9023e10] [c0024e68] do_exit+0x874/0x910
[    7.405104] [c9023e50] [c0024f80] do_group_exit+0x40/0xc4
[    7.410440] [c9023e60] [c0033334] get_signal+0x1d8/0x93c
[    7.415689] [c9023ec0] [c0007f34] do_notify_resume+0x6c/0x314
[    7.421369] [c9023f20] [c000d580] syscall_exit_prepare+0x120/0x184
[    7.427479] [c9023f30] [c001101c] ret_from_syscall+0xc/0x28

Something is going wrong with asm goto output. I implemented get_user() helpers with asm goto this 
cycle (commit 5cd29b1fd3e8). I tested it with CLANG before submitting, it was working.

Seems like there is something wrong with it with GCC11. When forcing CONFIG_CC_HAS_ASM_GOTO_OUTPUT 
to 'n', the kernel boots ok.
I found the problem, that's due to r10 register being reused by GCC in the copy loop below:

   10:	7d 09 03 a6 	mtctr   r8
   14:	80 ca 00 00 	lwz     r6,0(r10)
   18:	80 ea 00 04 	lwz     r7,4(r10)
   1c:	90 c9 00 08 	stw     r6,8(r9)
   20:	90 e9 00 0c 	stw     r7,12(r9)
   24:	39 0a 00 08 	addi    r8,r10,8
   28:	39 29 00 08 	addi    r9,r9,8
=>2c:	81 4a 00 08 	lwz     r10,8(r10)
   30:	81 6a 00 0c 	lwz     r11,12(r10)
   34:	91 49 00 08 	stw     r10,8(r9)
   38:	91 69 00 0c 	stw     r11,12(r9)
   3c:	39 48 00 08 	addi    r10,r8,8
   40:	39 29 00 08 	addi    r9,r9,8
   44:	42 00 ff d0 	bdnz    14 <__unsafe_restore_general_regs+0x14>

earlyclobber modifier is missing in the CONFIG_CC_HAS_ASM_GOTO_OUTPUT version of __get_user_asm2_goto().
Thanks for tracking that down. I hit it last week when testing Arnd's
compilers but hadn't had time to find the root cause.

cheers
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help