Skip to content

Commit ea8b1c4

Browse files
kevin-brodsky-armarndb
authored andcommitted
drivers: psci: PSCI checker module
On arm and arm64, PSCI is one of the possible firmware interfaces used for power management. This includes both turning CPUs on and off, and suspending them (entering idle states). This patch adds a PSCI checker module that enables basic testing of PSCI operations during startup. There are two main tests: CPU hotplugging and suspending. In the hotplug tests, the hotplug API is used to turn off and on again all CPUs in the system, and then all CPUs in each cluster, checking the consistency of the return codes. In the suspend tests, a high-priority thread is created on each core and uses low-level cpuidle functionalities to enter suspend, in all the possible states and multiple times. This should allow a maximum number of CPUs to enter the same sleep state at the same or slightly different time. In essence, the suspend tests use a principle similar to that of the intel_powerclamp driver (drivers/thermal/intel_powerclamp.c), but the threads are only kept for the duration of the test (they are already gone when userspace is started) and it does not require to stop/start the tick. While in theory power management PSCI functions (CPU_{ON,OFF,SUSPEND}) could be directly called, this proved too difficult as it would imply the duplication of all the logic used by the kernel to allow for a clean shutdown/bringup/suspend of the CPU (the deepest sleep states implying potentially the shutdown of the CPU). Note that this file cannot be compiled as a loadable module, since it uses a number of non-exported identifiers (essentially for PSCI-specific checks and direct use of cpuidle) and relies on the absence of userspace to avoid races when calling hotplug and cpuidle functions. For now at least, CONFIG_PSCI_CHECKER is mutually exclusive with CONFIG_TORTURE_TEST, because torture tests may also use hotplug and cause false positives in the hotplug tests. Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kevin Hilman <khilman@kernel.org> Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net> Cc: Peter Zijlstra <peterz@infradead.org> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> Cc: James Morse <james.morse@arm.com> Cc: Sudeep Holla <sudeep.holla@arm.com> Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Acked-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> [torture test config] Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com> [lpieralisi: added cpuidle locking, reworded commit log/kconfig entry] Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
1 parent b029ffe commit ea8b1c4

3 files changed

Lines changed: 502 additions & 0 deletions

File tree

‎drivers/firmware/Kconfig‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ menu "Firmware Drivers"
88
config ARM_PSCI_FW
99
bool
1010

11+
config ARM_PSCI_CHECKER
12+
bool "ARM PSCI checker"
13+
depends on ARM_PSCI_FW && HOTPLUG_CPU && !TORTURE_TEST
14+
help
15+
Run the PSCI checker during startup. This checks that hotplug and
16+
suspend operations work correctly when using PSCI.
17+
18+
The torture tests may interfere with the PSCI checker by turning CPUs
19+
on and off through hotplug, so for now torture tests and PSCI checker
20+
are mutually exclusive.
21+
1122
config ARM_SCPI_PROTOCOL
1223
tristate "ARM System Control and Power Interface (SCPI) Message Protocol"
1324
depends on MAILBOX

‎drivers/firmware/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# Makefile for the linux kernel.
33
#
44
obj-$(CONFIG_ARM_PSCI_FW) += psci.o
5+
obj-$(CONFIG_ARM_PSCI_CHECKER) += psci_checker.o
56
obj-$(CONFIG_ARM_SCPI_PROTOCOL) += arm_scpi.o
67
obj-$(CONFIG_ARM_SCPI_POWER_DOMAIN) += scpi_pm_domain.o
78
obj-$(CONFIG_DMI) += dmi_scan.o

0 commit comments

Comments
 (0)