Skip to content

[PW_SID:1067824] [v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown#1629

Open
linux-riscv-bot wants to merge 1 commit intoworkflow__riscv__fixesfrom
pw1067824
Open

[PW_SID:1067824] [v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown#1629
linux-riscv-bot wants to merge 1 commit intoworkflow__riscv__fixesfrom
pw1067824

Conversation

@linux-riscv-bot
Copy link

PR for series 1067824 applied to workflow__riscv__fixes

Name: [v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1067824
Version: 2

…tdown

Currently, the RISC-V implementation of machine_restart(), machine_halt(),
and machine_power_off() invokes the kernel teardown chains (e.g.,
do_kernel_restart()) with local interrupts enabled and other CPUs still
running.

This implementation fails to provide a deterministic execution environment
for registered handlers in the restart or power-off notifier chains. These
chains are intended to be executed in a strict atomic and single-threaded
context.

Specifically, under CONFIG_PREEMPT_RCU, rcu_read_lock() does not increment
the preempt_count. If local interrupts remain enabled, the environment
is not guaranteed to be atomic. This can lead to a context misidentification
within generic kernel teardown code, causing it to incorrectly enter
non-atomic paths (such as attempting to acquire sleeping locks), which
results in fatal "scheduling while atomic" splats or system hangs.

Additionally, stopping other CPUs ensures the primary CPU has exclusive
access to the hardware state during the final teardown phase, preventing
unpredictable interference from other active cores.

Align RISC-V with other major architectures by disabling local interrupts
and stopping other CPUs at the beginning of the shutdown sequences. This
guarantees the architectural expectations of the kernel's restart and
power-off handlers are met.

Signed-off-by: Troy Mitchell <troy.mitchell@linux.dev>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 137.18 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1101.32 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1607.76 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 26.82 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 27.94 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 0.72 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 82.70 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown"
kdoc
Desc: Detects for kdoc errors
Duration: 0.87 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown"
module-param
Desc: Detect module_param changes
Duration: 0.24 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.26 seconds
Result: PASS

@linux-riscv-bot
Copy link
Author

Patch 1: "[v2] riscv: disable local interrupts and stop other CPUs before reboot/shutdown"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.29 seconds
Result: PASS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants