* FAILED: patch "[PATCH] platform/x86: ideapad-laptop: Evaluate ACPI methods exclusively" failed to apply to 6.18-stable tree
@ 2026-11-07 10:13 Sasha Levin
2026-11-11 22:24 ` [PATCH 6.18.y 1/2] ACPI: utils: Add exclusive AML evaluation helpers Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2026-11-07 10:13 UTC (permalink / raw)
To: aliamemis, i, rafael.j.wysocki; +Cc: stable
The patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x f91c2cd6dbcedf52e227b2eea8d7b99ecbac7552
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '20261107051336-failed-6.18-f91c2cd6dbce@kernel.org' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From f91c2cd6dbcedf52e227b2eea8d7b99ecbac7552 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ali=20Ahmet=20Memi=C5=9F?= <aliamemis@disroot.org>
Date: Sun, 18 Oct 2026 15:23:48 +0300
Subject: [PATCH] platform/x86: ideapad-laptop: Evaluate ACPI methods
exclusively
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
On some Lenovo IdeaPad and Yoga models, the battery _BIX takes the EC
AML mutex and then calls the serialized RDER through RDIF, while GBMD
calls RDER first and then takes the EC mutex. When the two run
interleaved they deadlock until the mutex acquisition in RDER times
out, and GBMD returns garbage that is reported as both charge types
being enabled.
Evaluate all methods with the exclusive helpers, so that GBMD never runs
interleaved with the battery methods.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=221065
Link: https://lore.kernel.org/all/58586fa666f09c209f9d7fe8c692a8bdda6d4410.camel@rong.moe/
Signed-off-by: Ali Ahmet Memiş <aliamemis@disroot.org>
Reviewed-by: Rong Zhang <i@rong.moe>
Cc: All applicable <stable@vger.kernel.org> # 80892972ff23 ACPI: utils: Add exclusive AML evaluation helpers
Link: https://patch.msgid.link/20261018122348.679126-1-aliamemis@disroot.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
drivers/platform/x86/lenovo/ideapad-laptop.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/platform/x86/lenovo/ideapad-laptop.c b/drivers/platform/x86/lenovo/ideapad-laptop.c
index 8213524504eeb..1335f4e488702 100644
--- a/drivers/platform/x86/lenovo/ideapad-laptop.c
+++ b/drivers/platform/x86/lenovo/ideapad-laptop.c
@@ -297,12 +297,16 @@ static void ideapad_shared_exit(struct ideapad_private *priv)
#define IDEAPAD_EC_POLL_MIN_US 150
#define IDEAPAD_EC_POLL_MAX_US 300
+/*
+ * On some models GBMD and the battery _BIX take the EC mutex and a
+ * serialized method in opposite order, so evaluate all methods exclusively.
+ */
static int eval_int(acpi_handle handle, const char *name, unsigned long *res)
{
unsigned long long result;
acpi_status status;
- status = acpi_evaluate_integer(handle, (char *)name, NULL, &result);
+ status = acpi_evaluate_integer_exclusive(handle, (char *)name, NULL, &result);
if (ACPI_FAILURE(status))
return -EIO;
@@ -324,7 +328,7 @@ static int eval_int_with_arg(acpi_handle handle, const char *name, unsigned long
in_obj.type = ACPI_TYPE_INTEGER;
in_obj.integer.value = arg;
- status = acpi_evaluate_integer(handle, (char *)name, ¶ms, &result);
+ status = acpi_evaluate_integer_exclusive(handle, (char *)name, ¶ms, &result);
if (ACPI_FAILURE(status))
return -EIO;
@@ -336,7 +340,7 @@ static int eval_int_with_arg(acpi_handle handle, const char *name, unsigned long
static int exec_simple_method(acpi_handle handle, const char *name, unsigned long arg)
{
- acpi_status status = acpi_execute_simple_method(handle, (char *)name, arg);
+ acpi_status status = acpi_execute_simple_method_exclusive(handle, (char *)name, arg);
return ACPI_FAILURE(status) ? -EIO : 0;
}
@@ -394,7 +398,7 @@ static int eval_vpcw(acpi_handle handle, unsigned long cmd, unsigned long data)
in_obj[1].type = ACPI_TYPE_INTEGER;
in_obj[1].integer.value = data;
- status = acpi_evaluate_object(handle, "VPCW", ¶ms, NULL);
+ status = acpi_evaluate_object_exclusive(handle, "VPCW", ¶ms, NULL);
if (ACPI_FAILURE(status))
return -EIO;
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 6.18.y 1/2] ACPI: utils: Add exclusive AML evaluation helpers
2026-11-07 10:13 FAILED: patch "[PATCH] platform/x86: ideapad-laptop: Evaluate ACPI methods exclusively" failed to apply to 6.18-stable tree Sasha Levin
@ 2026-11-11 22:24 ` Sasha Levin
2026-11-11 22:24 ` [PATCH 6.18.y 2/2] platform/x86: ideapad-laptop: Evaluate ACPI methods exclusively Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2026-11-11 22:24 UTC (permalink / raw)
To: stable
Cc: Ali Ahmet Memiş, Rafael J. Wysocki, Rong Zhang,
Rafael J. Wysocki, Sasha Levin
From: Ali Ahmet Memiş <aliamemis@disroot.org>
[ Upstream commit 80892972ff23bf0b9049230ef0931b34163aaed3 ]
ACPICA drops the interpreter lock while AML waits, for example around EC
accesses, so two methods can run interleaved.
Some firmware relies on methods not interleaving, for instance by
switching an EC page selector without taking the AML mutex that the
other users of that page hold.
Add acpi_evaluate_object_exclusive(), acpi_evaluate_integer_exclusive()
and acpi_execute_simple_method_exclusive() which serialize the
evaluation under a global mutex, for callers that are known to be
affected.
Suggested-by: Rafael J. Wysocki <rafael@kernel.org>
Link: https://lore.kernel.org/all/CAJZ5v0gS4agVUkCO6M=VW4Wi2y1-s+k23bpzmX9aAZ0Rsv4z9Q@mail.gmail.com/
Signed-off-by: Ali Ahmet Memiş <aliamemis@disroot.org>
Reviewed-by: Rong Zhang <i@rong.moe>
Link: https://patch.msgid.link/20261018122220.678822-2-aliamemis@disroot.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Stable-dep-of: f91c2cd6dbce ("platform/x86: ideapad-laptop: Evaluate ACPI methods exclusively")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/acpi/utils.c | 41 +++++++++++++++++++++++++++++++++++++++++
include/acpi/acpi_bus.h | 7 +++++++
2 files changed, 48 insertions(+)
diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c
index 526563a0d1886..92e977fb56570 100644
--- a/drivers/acpi/utils.c
+++ b/drivers/acpi/utils.c
@@ -10,6 +10,7 @@
#include <linux/kernel.h>
#include <linux/module.h>
+#include <linux/mutex.h>
#include <linux/slab.h>
#include <linux/init.h>
#include <linux/types.h>
@@ -243,6 +244,28 @@ acpi_extract_package(union acpi_object *package,
EXPORT_SYMBOL(acpi_extract_package);
+static DEFINE_MUTEX(acpi_exclusive_eval_lock);
+
+/**
+ * acpi_evaluate_object_exclusive - Evaluate an object without interleaving
+ * @handle: ACPI handle of the object or its scope.
+ * @pathname: Path of the object relative to @handle.
+ * @arguments: Arguments to pass, or NULL.
+ * @buffer: Buffer for the return value, or NULL.
+ *
+ * Same as acpi_evaluate_object(), but serialized with other exclusive
+ * evaluations. Use it only for methods known to break when interleaved.
+ */
+acpi_status acpi_evaluate_object_exclusive(acpi_handle handle, acpi_string pathname,
+ struct acpi_object_list *arguments,
+ struct acpi_buffer *buffer)
+{
+ guard(mutex)(&acpi_exclusive_eval_lock);
+
+ return acpi_evaluate_object(handle, pathname, arguments, buffer);
+}
+EXPORT_SYMBOL_GPL(acpi_evaluate_object_exclusive);
+
acpi_status
acpi_evaluate_integer(acpi_handle handle,
acpi_string pathname,
@@ -277,6 +300,16 @@ acpi_evaluate_integer(acpi_handle handle,
EXPORT_SYMBOL(acpi_evaluate_integer);
+acpi_status acpi_evaluate_integer_exclusive(acpi_handle handle, acpi_string pathname,
+ struct acpi_object_list *arguments,
+ unsigned long long *data)
+{
+ guard(mutex)(&acpi_exclusive_eval_lock);
+
+ return acpi_evaluate_integer(handle, pathname, arguments, data);
+}
+EXPORT_SYMBOL_GPL(acpi_evaluate_integer_exclusive);
+
int acpi_get_local_u64_address(acpi_handle handle, u64 *addr)
{
acpi_status status;
@@ -685,6 +718,14 @@ acpi_status acpi_execute_simple_method(acpi_handle handle, char *method,
}
EXPORT_SYMBOL(acpi_execute_simple_method);
+acpi_status acpi_execute_simple_method_exclusive(acpi_handle handle, char *method, u64 arg)
+{
+ guard(mutex)(&acpi_exclusive_eval_lock);
+
+ return acpi_execute_simple_method(handle, method, arg);
+}
+EXPORT_SYMBOL_GPL(acpi_execute_simple_method_exclusive);
+
/**
* acpi_evaluate_ej0: Evaluate _EJ0 method for hotplug operations
* @handle: ACPI device handle
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 66fc14f869cb9..53aad501458f8 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -30,6 +30,12 @@ acpi_status
acpi_evaluate_integer(acpi_handle handle,
acpi_string pathname,
struct acpi_object_list *arguments, unsigned long long *data);
+acpi_status acpi_evaluate_object_exclusive(acpi_handle handle, acpi_string pathname,
+ struct acpi_object_list *arguments,
+ struct acpi_buffer *buffer);
+acpi_status acpi_evaluate_integer_exclusive(acpi_handle handle, acpi_string pathname,
+ struct acpi_object_list *arguments,
+ unsigned long long *data);
bool acpi_evaluate_reference(acpi_handle handle, acpi_string pathname,
struct acpi_object_list *arguments,
struct acpi_handle_list *list);
@@ -46,6 +52,7 @@ acpi_evaluate_ost(acpi_handle handle, u32 source_event, u32 status_code,
bool acpi_has_method(acpi_handle handle, char *name);
acpi_status acpi_execute_simple_method(acpi_handle handle, char *method,
u64 arg);
+acpi_status acpi_execute_simple_method_exclusive(acpi_handle handle, char *method, u64 arg);
acpi_status acpi_evaluate_ej0(acpi_handle handle);
acpi_status acpi_evaluate_lck(acpi_handle handle, int lock);
acpi_status acpi_evaluate_reg(acpi_handle handle, u8 space_id, u32 function);
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 6.18.y 2/2] platform/x86: ideapad-laptop: Evaluate ACPI methods exclusively
2026-11-11 22:24 ` [PATCH 6.18.y 1/2] ACPI: utils: Add exclusive AML evaluation helpers Sasha Levin
@ 2026-11-11 22:24 ` Sasha Levin
0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2026-11-11 22:24 UTC (permalink / raw)
To: stable; +Cc: Ali Ahmet Memiş, Rong Zhang, Rafael J. Wysocki, Sasha Levin
From: Ali Ahmet Memiş <aliamemis@disroot.org>
[ Upstream commit f91c2cd6dbcedf52e227b2eea8d7b99ecbac7552 ]
On some Lenovo IdeaPad and Yoga models, the battery _BIX takes the EC
AML mutex and then calls the serialized RDER through RDIF, while GBMD
calls RDER first and then takes the EC mutex. When the two run
interleaved they deadlock until the mutex acquisition in RDER times
out, and GBMD returns garbage that is reported as both charge types
being enabled.
Evaluate all methods with the exclusive helpers, so that GBMD never runs
interleaved with the battery methods.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=221065
Link: https://lore.kernel.org/all/58586fa666f09c209f9d7fe8c692a8bdda6d4410.camel@rong.moe/
Signed-off-by: Ali Ahmet Memiş <aliamemis@disroot.org>
Reviewed-by: Rong Zhang <i@rong.moe>
Cc: All applicable <stable@vger.kernel.org> # 80892972ff23 ACPI: utils: Add exclusive AML evaluation helpers
Link: https://patch.msgid.link/20261018122348.679126-1-aliamemis@disroot.org
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/platform/x86/lenovo/ideapad-laptop.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/platform/x86/lenovo/ideapad-laptop.c b/drivers/platform/x86/lenovo/ideapad-laptop.c
index fcebfbaf04605..690311eb930d1 100644
--- a/drivers/platform/x86/lenovo/ideapad-laptop.c
+++ b/drivers/platform/x86/lenovo/ideapad-laptop.c
@@ -285,12 +285,16 @@ static void ideapad_shared_exit(struct ideapad_private *priv)
#define IDEAPAD_EC_POLL_MIN_US 150
#define IDEAPAD_EC_POLL_MAX_US 300
+/*
+ * On some models GBMD and the battery _BIX take the EC mutex and a
+ * serialized method in opposite order, so evaluate all methods exclusively.
+ */
static int eval_int(acpi_handle handle, const char *name, unsigned long *res)
{
unsigned long long result;
acpi_status status;
- status = acpi_evaluate_integer(handle, (char *)name, NULL, &result);
+ status = acpi_evaluate_integer_exclusive(handle, (char *)name, NULL, &result);
if (ACPI_FAILURE(status))
return -EIO;
@@ -312,7 +316,7 @@ static int eval_int_with_arg(acpi_handle handle, const char *name, unsigned long
in_obj.type = ACPI_TYPE_INTEGER;
in_obj.integer.value = arg;
- status = acpi_evaluate_integer(handle, (char *)name, ¶ms, &result);
+ status = acpi_evaluate_integer_exclusive(handle, (char *)name, ¶ms, &result);
if (ACPI_FAILURE(status))
return -EIO;
@@ -324,7 +328,7 @@ static int eval_int_with_arg(acpi_handle handle, const char *name, unsigned long
static int exec_simple_method(acpi_handle handle, const char *name, unsigned long arg)
{
- acpi_status status = acpi_execute_simple_method(handle, (char *)name, arg);
+ acpi_status status = acpi_execute_simple_method_exclusive(handle, (char *)name, arg);
return ACPI_FAILURE(status) ? -EIO : 0;
}
@@ -382,7 +386,7 @@ static int eval_vpcw(acpi_handle handle, unsigned long cmd, unsigned long data)
in_obj[1].type = ACPI_TYPE_INTEGER;
in_obj[1].integer.value = data;
- status = acpi_evaluate_object(handle, "VPCW", ¶ms, NULL);
+ status = acpi_evaluate_object_exclusive(handle, "VPCW", ¶ms, NULL);
if (ACPI_FAILURE(status))
return -EIO;
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-11 22:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-07 10:13 FAILED: patch "[PATCH] platform/x86: ideapad-laptop: Evaluate ACPI methods exclusively" failed to apply to 6.18-stable tree Sasha Levin
2026-11-11 22:24 ` [PATCH 6.18.y 1/2] ACPI: utils: Add exclusive AML evaluation helpers Sasha Levin
2026-11-11 22:24 ` [PATCH 6.18.y 2/2] platform/x86: ideapad-laptop: Evaluate ACPI methods exclusively Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox