linux-brain/arch/mips/lib
Tiezhu Yang a450b5b6c0 MIPS: Fix kernel hang under FUNCTION_GRAPH_TRACER and PREEMPT_TRACER
[ Upstream commit 78cf0eb926cb1abeff2106bae67752e032fe5f3e ]

When update the latest mainline kernel with the following three configs,
the kernel hangs during startup:

(1) CONFIG_FUNCTION_GRAPH_TRACER=y
(2) CONFIG_PREEMPT_TRACER=y
(3) CONFIG_FTRACE_STARTUP_TEST=y

When update the latest mainline kernel with the above two configs (1)
and (2), the kernel starts normally, but it still hangs when execute
the following command:

echo "function_graph" > /sys/kernel/debug/tracing/current_tracer

Without CONFIG_PREEMPT_TRACER=y, the above two kinds of kernel hangs
disappeared, so it seems that CONFIG_PREEMPT_TRACER has some influences
with function_graph tracer at the first glance.

I use ejtag to find out the epc address is related with preempt_enable()
in the file arch/mips/lib/mips-atomic.c, because function tracing can
trace the preempt_{enable,disable} calls that are traced, replace them
with preempt_{enable,disable}_notrace to prevent function tracing from
going into an infinite loop, and then it can fix the kernel hang issue.

By the way, it seems that this commit is a complement and improvement of
commit f93a1a00f2 ("MIPS: Fix crash that occurs when function tracing
is enabled").

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-06-16 11:59:37 +02:00
..
Makefile MIPS: Use GENERIC_IOMAP 2018-08-30 09:41:16 -07:00
bitops.c MIPS: Remove unneeded volatile from arch/mips/lib/bitops.c 2013-05-08 01:19:06 +02:00
bswapdi.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
bswapsi.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
csum_partial.S MIPS: Export csum functions alongside their definitions 2017-01-03 16:34:50 +01:00
delay.c MIPS: Include asm/delay.h for __{,n,u}delay() 2017-08-29 15:21:54 +02:00
dump_tlb.c MIPS: MemoryMapID (MMID) Support 2019-02-04 10:56:41 -08:00
iomap-pci.c MIPS: Use GENERIC_IOMAP 2018-08-30 09:41:16 -07:00
iomap_copy.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 504 2019-06-19 17:09:56 +02:00
libgcc.h MIPS: Implement __multi3 for GCC7 MIPS64r6 builds 2018-01-11 14:40:31 +01:00
memcpy.S MIPS: lib: Use kernel_pref & user_pref in memcpy() 2018-10-15 23:11:14 -07:00
memset.S MIPS: memset: Limit excessive `noreorder' assembly mode use 2018-10-09 10:31:03 -07:00
mips-atomic.c MIPS: Fix kernel hang under FUNCTION_GRAPH_TRACER and PREEMPT_TRACER 2021-06-16 11:59:37 +02:00
multi3.c MIPS: lib: Provide MIPS64r6 __multi3() for GCC < 7 2018-08-21 12:14:11 -07:00
r3k_dump_tlb.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
strncpy_user.S get rid of unused __strncpy_from_user() instances 2017-05-15 23:40:28 -04:00
strnlen_user.S mips: get rid of unused __strnlen_user() 2017-05-15 23:40:32 -04:00
uncached.c mips: lib: uncached: fix non-standard usage of variable 'sp' 2021-01-19 18:26:12 +01:00