At least on ppc64le, RUST_OPT_LEVEL_0/1 causes some functions to be
generated that use up to 20KB of stack. This leads to stack overflow,
which may exhibit as a panic:
Kernel panic - not syncing: corrupted stack end detected inside scheduler
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.12.0-rc3+ #1
But may also cause other crashes, depending on what is overwritten by
the overflow.
Add a note to the Kconfig for RUST_OPT_LEVEL_0/1 that this can happen.
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
[normalized title]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
directly). Use the corresponding configuration options to control
that instead, orthogonally.
+ Note this level may cause excessive stack usage, which can lead to stack
+ overflow and subsequent crashes.
+
config RUST_OPT_LEVEL_1
bool "Basic optimizations (-Copt-level=1)"
help
Useful for debugging without getting too lost, but without
the overhead and boilerplate of no optimizations at all.
+ Note this level may cause excessive stack usage, which can lead to stack
+ overflow and subsequent crashes.
+
config RUST_OPT_LEVEL_2
bool "Some optimizations (-Copt-level=2)"
help