aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/acpica/hwxfsleep.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-09-29 18:31:25 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-10-05 15:53:32 +0200
commitd3c4b6f64ad356c0d9ddbcf73fa471e6a841cc5c (patch)
tree0a6ef21bfd5e208522ac14078776744fb53e4206 /drivers/acpi/acpica/hwxfsleep.c
parentLinux 5.15-rc4 (diff)
downloadlinux-dev-d3c4b6f64ad356c0d9ddbcf73fa471e6a841cc5c.tar.xz
linux-dev-d3c4b6f64ad356c0d9ddbcf73fa471e6a841cc5c.zip
ACPICA: Avoid evaluating methods too early during system resume
ACPICA commit 0762982923f95eb652cf7ded27356b247c9774de During wakeup from system-wide sleep states, acpi_get_sleep_type_data() is called and it tries to get memory from the slab allocator in order to evaluate a control method, but if KFENCE is enabled in the kernel, the memory allocation attempt causes an IRQ work to be queued and a self-IPI to be sent to the CPU running the code which requires the memory controller to be ready, so if that happens too early in the wakeup path, it doesn't work. Prevent that from taking place by calling acpi_get_sleep_type_data() for S0 upfront, when preparing to enter a given sleep state, and saving the data obtained by it for later use during system wakeup. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=214271 Reported-by: Reik Keutterling <spielkind@gmail.com> Tested-by: Reik Keutterling <spielkind@gmail.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/acpica/hwxfsleep.c')
-rw-r--r--drivers/acpi/acpica/hwxfsleep.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/acpi/acpica/hwxfsleep.c b/drivers/acpi/acpica/hwxfsleep.c
index 89b12afed564..e4cde23a2906 100644
--- a/drivers/acpi/acpica/hwxfsleep.c
+++ b/drivers/acpi/acpica/hwxfsleep.c
@@ -217,6 +217,13 @@ acpi_status acpi_enter_sleep_state_prep(u8 sleep_state)
return_ACPI_STATUS(status);
}
+ status = acpi_get_sleep_type_data(ACPI_STATE_S0,
+ &acpi_gbl_sleep_type_a_s0,
+ &acpi_gbl_sleep_type_b_s0);
+ if (ACPI_FAILURE(status)) {
+ acpi_gbl_sleep_type_a_s0 = ACPI_SLEEP_TYPE_INVALID;
+ }
+
/* Execute the _PTS method (Prepare To Sleep) */
arg_list.count = 1;