Skip to contentSkip to conversation

csky: Fixup calltrace panic

PATCH Guenter Roeck 3 participants 5 messages May 17, 2020 – May 22, 2020 C-sky architecture

lore
Share & tools
lore
#0 lore raw

Hi,

Quoted 9 lines · Guo Ren

The implementation of show_stack will panic with wrong fp:

addr = *fp++;

because the fp isn't checked properly.

The current implementations of show_stack, wchan and stack_trace haven't been designed properly, so just deprecate them.

Quoted 8 lines

This patch is a reference to riscv's way, all codes are modified from arm's. The patch is passed with:

- cat /proc/<pid>/stack
- cat /proc/<pid>/wchan
- echo c > /proc/sysrq-trigger

This patch results in:

gcc version: csky-linux-gcc (GCC) 9.3.0

Building csky:defconfig ... failed
--------------
Error log:
csky-linux-gcc: error: unrecognized command line option '-mbacktrace'; did you mean '-fbacktrace'?
csky-linux-gcc: error: unrecognized command line option '-mbacktrace'; did you mean '-fbacktrace'? make[2]: *** [scripts/mod/devicetable-offsets.s] Error 1
make[2]: *** Waiting for unfinished jobs....
csky-linux-gcc: error: unrecognized command line option '-mbacktrace'; did you mean '-fbacktrace'? make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [prepare0] Error 2
make: *** [sub-make] Error 2

when trying to build csky images with upstream gcc 9.3.0.

What version of gcc is needed to build csky images ? Also, would it be possible to support the upstream version of gcc ?

Thanks,
Guenter

#1 lore raw

Hi Guenter,

Quoted 39 lines · 在 2020年5月18日,上午1:52,Guenter Roeck <[email protected]> 写道:

Hi,

Quoted 9 lines · Guo Ren

The implementation of show_stack will panic with wrong fp:

addr = *fp++;

because the fp isn't checked properly.

The current implementations of show_stack, wchan and stack_trace haven't been designed properly, so just deprecate them.

Quoted 8 lines

This patch is a reference to riscv's way, all codes are modified from arm's. The patch is passed with:

- cat /proc/<pid>/stack
- cat /proc/<pid>/wchan
- echo c > /proc/sysrq-trigger

This patch results in:

gcc version: csky-linux-gcc (GCC) 9.3.0

Building csky:defconfig ... failed
--------------
Error log:
csky-linux-gcc: error: unrecognized command line option '-mbacktrace'; did you mean '-fbacktrace'?
csky-linux-gcc: error: unrecognized command line option '-mbacktrace'; did you mean '-fbacktrace'? make[2]: *** [scripts/mod/devicetable-offsets.s] Error 1
make[2]: *** Waiting for unfinished jobs....
csky-linux-gcc: error: unrecognized command line option '-mbacktrace'; did you mean '-fbacktrace'? make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [prepare0] Error 2
make: *** [sub-make] Error 2

Quoted 5 lines

when trying to build csky images with upstream gcc 9.3.0.

What version of gcc is needed to build csky images ? Also, would it be possible to support the upstream version of gcc ?

We tested it with https://github.com/c-sky/gcc (gcc-6.3)

You can fast test with:

wget -nc https://gitlab.com/c-sky/buildroot/-/jobs/557072746/artifacts/raw/output/images/toolchain_thead_860_compat_next_glibc_br_defconfig_8f1b5cd7d85509fbafea935ec65c48add73bba07.tar.xz

mkdir -p host
tar -Jxf toolchain_thead_860_compat_next_glibc_br_defconfig_8f1b5cd7d85509fbafea935ec65c48add73bba07.tar.xz -C host

cd linux-xxx

LD_LIBRARY_PATH=../host/lib make ARCH=csky CROSS_COMPILE=../host/bin/csky-linux- Image

We will upstream -mbacktrace to gcc.org

Quoted 2 lines

Thanks,
Guenter

#2 lore raw
Quoted 41 lines · Guo Ren

Hi Guenter,

Quoted 39 lines · 在 2020年5月18日,上午1:52,Guenter Roeck <[email protected]> 写道:

Hi,

Quoted 9 lines · Guo Ren

The implementation of show_stack will panic with wrong fp:

addr = *fp++;

because the fp isn't checked properly.

The current implementations of show_stack, wchan and stack_trace haven't been designed properly, so just deprecate them.

Quoted 8 lines

This patch is a reference to riscv's way, all codes are modified from arm's. The patch is passed with:

- cat /proc/<pid>/stack
- cat /proc/<pid>/wchan
- echo c > /proc/sysrq-trigger

This patch results in:

gcc version: csky-linux-gcc (GCC) 9.3.0

Building csky:defconfig ... failed
--------------
Error log:
csky-linux-gcc: error: unrecognized command line option '-mbacktrace'; did you mean '-fbacktrace'?
csky-linux-gcc: error: unrecognized command line option '-mbacktrace'; did you mean '-fbacktrace'? make[2]: *** [scripts/mod/devicetable-offsets.s] Error 1
make[2]: *** Waiting for unfinished jobs....
csky-linux-gcc: error: unrecognized command line option '-mbacktrace'; did you mean '-fbacktrace'? make[2]: *** [scripts/mod/empty.o] Error 1
make[1]: *** [prepare0] Error 2
make: *** [sub-make] Error 2

Quoted 8 lines
Quoted 5 lines

when trying to build csky images with upstream gcc 9.3.0.

What version of gcc is needed to build csky images ? Also, would it be possible to support the upstream version of gcc ?

We tested it with https://github.com/c-sky/gcc (gcc-6.3)

That won't work for me. You really might want to consider supporting upstream gcc. I'll try disabling CONFIG_STACKTRACE for csky build tests. If that doesn't work, I may have to disable affected csky build tests for the time being.

Guenter

maintainer
#3 lore raw

Hi,

Quoted 9 lines · Guenter Roeck
Quoted 2 lines

We tested it with https://github.com/c-sky/gcc (gcc-6.3)

That won't work for me. You really might want to consider supporting upstream gcc. I'll try disabling CONFIG_STACKTRACE for csky build tests. If that doesn't work, I may have to disable affected csky build tests for the time being.

Guenter

Not only CONFIG_STACKTRACE,
Disable FRAME_POINTER (Kernel hacking -> Compile the kernel with frame pointers)

because in Makefile:
ifdef CONFIG_FRAME_POINTER
KBUILD_CFLAGS += -mbacktrace
endif

We'll upstream -mbacktrace to gcc 9 soon, sorry for the confusion. Thx for your work on maintaining.

Signature · 4 lines
Best Regards
 Guo Ren

ML: https://lore.kernel.org/linux-csky/
#4 lore raw
Quoted 11 lines · Guo Ren

Hi,

Quoted 8 lines · Guenter Roeck
Quoted 2 lines

We tested it with https://github.com/c-sky/gcc (gcc-6.3)

That won't work for me. You really might want to consider supporting upstream gcc. I'll try disabling CONFIG_STACKTRACE for csky build tests. If that doesn't work, I may have to disable affected csky build tests for the time being.

Quoted 5 lines
Quoted 1 line

Guenter

Not only CONFIG_STACKTRACE,
Disable FRAME_POINTER (Kernel hacking -> Compile the kernel with frame pointers)

You are correct. This is what my test builder now does:

Build reference: v5.7-rc6-37-g115a54162a6c
gcc version: csky-linux-gcc (GCC) 9.3.0

Configuration file workarounds:
"s/CONFIG_FRAME_POINTER=y/# CONFIG_FRAME_POINTER is not set/"

Building csky:defconfig ... passed
Building csky:allnoconfig ... passed
Building csky:tinyconfig ... passed

Guenter