]> git.baikalelectronics.ru Git - kernel.git/commit
cpuidle: drivers: firmware: psci: Dont instrument suspend code
authorMark Rutland <mark.rutland@arm.com>
Thu, 26 Jan 2023 15:08:30 +0000 (16:08 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:47 +0000 (09:33 +0100)
commitf60ab91b6a38cb96120bac4e89169e37e4798a43
tree19b83ee2af5827952e4066311e3f7d2186cd0b6c
parent481fcf6cca871d80aaeb2df6d87ba0bc0938d7ff
cpuidle: drivers: firmware: psci: Dont instrument suspend code

[ Upstream commit 7f65687c16a03685f3490421151d645d13a60cec ]

The PSCI suspend code is currently instrumentable, which is not safe as
instrumentation (e.g. ftrace) may try to make use of RCU during idle
periods when RCU is not watching.

To fix this we need to ensure that psci_suspend_finisher() and anything
it calls are not instrumented. We can do this fairly simply by marking
psci_suspend_finisher() and the psci*_cpu_suspend() functions as
noinstr, and the underlying helper functions as __always_inline.

When CONFIG_DEBUG_VIRTUAL=y, __pa_symbol() can expand to an out-of-line
instrumented function, so we must use __pa_symbol_nodebug() within
psci_suspend_finisher().

The raw SMCCC invocation functions are written in assembly, and are not
subject to compiler instrumentation.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lore.kernel.org/r/20230126151323.349423061@infradead.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/firmware/psci/psci.c