From: Rong Zhang <i@rong.moe>
To: "Ali Ahmet Memi�0�6" <aliamemis@disroot.org>,
"Rafael J . Wysocki" <rafael@kernel.org>
Cc: Len Brown <lenb@kernel.org>,
Daniel Lezcano <daniel.lezcano@kernel.org>,
Zhang Rui <rui.zhang@intel.com>,
Lukasz Luba <lukasz.luba@arm.com>, Armin Wolf <W_Armin@gmx.de>,
Hans de Goede <johannes.goede@oss.qualcomm.com>,
Charis Stratakis <c.stratakis@proton.me>,
linux-acpi@vger.kernel.org, linux-pm@vger.kernel.org,
acpica-devel@lists.linux.dev, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 2/3] ACPI: battery: Evaluate battery methods exclusively
Date: Thu, 15 Oct 2026 19:48:53 +0800 [thread overview]
Message-ID: <5323dea7e1fdc48dff8cc820d5e7c8c2c0e081ac.camel@rong.moe> (raw)
In-Reply-To: <20261014133013.94097-2-aliamemis@disroot.org>
Hi Ali,
On Wed, 2026-10-14 at 16:30 +0300, Ali Ahmet Memiş wrote:
> On ThinkPad P1 Gen2 and P53, INT3403 _TMP switches the EC page selector
> without taking the AML mutex the battery methods use, so _BIX and _BST
> running at the same time can read the wrong page. Since commit d33e89d12295
> ("thermal: core: Suspend thermal zones later and resume them earlier")
> this happens on most resumes.
>
> Evaluate the battery methods with acpi_evaluate_object_exclusive().
>
> Fixes: d33e89d12295 ("thermal: core: Suspend thermal zones later and resume them earlier")
> Reported-by: Charis Stratakis <c.stratakis@proton.me>
> Closes: https://lore.kernel.org/all/37N_jFulf7n-Z55NfKfE71C_wVPxYvZ0xD_iRUg2fXu7TypDiF5PStQ6siSfVBih6fThg5WoPes8U5ZQpfVm_teMFcUGXFxz2DdMbfSWuws=@proton.me/
> Cc: stable@vger.kernel.org
> Signed-off-by: Ali Ahmet Memiş <aliamemis@disroot.org>
> ---
> drivers/acpi/battery.c | 17 ++++++++++-------
> 1 file changed, 10 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
> index 670853ec3a4d..61de3f5be51f 100644
> --- a/drivers/acpi/battery.c
> +++ b/drivers/acpi/battery.c
> @@ -583,9 +583,9 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
> struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
> acpi_status status = AE_ERROR;
>
> - status = acpi_evaluate_object(battery->device->handle,
> - use_bix ? "_BIX":"_BIF",
> - NULL, &buffer);
> + status = acpi_evaluate_object_exclusive(battery->device->handle,
> + use_bix ? "_BIX":"_BIF",
Since you are anyway moving the alignment, let's add spaces around `:' as
well.
> + NULL, &buffer);
Please merge it into the previous line for readability.
>
> if (ACPI_FAILURE(status)) {
> acpi_handle_info(battery->device->handle,
> @@ -624,8 +624,8 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
> msecs_to_jiffies(cache_time)))
> return 0;
>
> - status = acpi_evaluate_object(battery->device->handle, "_BST",
> - NULL, &buffer);
> + status = acpi_evaluate_object_exclusive(battery->device->handle, "_BST",
> + NULL, &buffer);
Ditto.
> if (ACPI_FAILURE(status)) {
> acpi_handle_info(battery->device->handle,
> "_BST evaluation failed: %s",
> @@ -667,6 +667,8 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
>
> static int acpi_battery_set_alarm(struct acpi_battery *battery)
> {
> + union acpi_object arg = { .type = ACPI_TYPE_INTEGER };
> + struct acpi_object_list args = { .count = 1, .pointer = &arg };
You did the same in the ideapad-laptop patch.
Please don't open code when the same pattern is repeatedly used. Add an
acpi_execute_simple_method_exclusive() helper in PATCH 1 and use it here
and there.
With these comments resolved:
Reviewed-by: Rong Zhang <i@rong.moe>
Thanks,
Rong
> acpi_status status = 0;
>
> lockdep_assert_held(&battery->property_lock);
> @@ -675,8 +677,9 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery)
> !test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags))
> return -ENODEV;
>
> - status = acpi_execute_simple_method(battery->device->handle, "_BTP",
> - battery->alarm);
> + arg.integer.value = battery->alarm;
> + status = acpi_evaluate_object_exclusive(battery->device->handle, "_BTP",
> + &args, NULL);
> if (ACPI_FAILURE(status))
> return -ENODEV;
>
next prev parent reply other threads:[~2026-10-15 11:54 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-14 13:26 [PATCH 0/3] ACPI: Serialize battery methods and INT3403 _TMP Ali Ahmet Memiş
2026-10-14 13:30 ` [PATCH 1/3] ACPI: utils: Add exclusive AML evaluation helpers Ali Ahmet Memiş
2026-10-14 13:39 ` Hans de Goede
2026-10-15 11:47 ` Rong Zhang
2026-10-14 13:30 ` [PATCH 2/3] ACPI: battery: Evaluate battery methods exclusively Ali Ahmet Memiş
2026-10-14 13:39 ` Hans de Goede
2026-10-15 11:48 ` Rong Zhang [this message]
2026-10-14 13:30 ` [PATCH 3/3] thermal: intel: int340x: Evaluate _TMP exclusively Ali Ahmet Memiş
2026-10-14 13:39 ` Hans de Goede
2026-10-15 11:49 ` Rong Zhang
2026-10-14 13:45 ` [PATCH 0/3] ACPI: Serialize battery methods and INT3403 _TMP Hans de Goede
2026-10-14 15:05 ` Ali Ahmet Memiş
2026-10-14 15:30 ` Hans de Goede
2026-10-14 15:38 ` Rafael J. Wysocki (Intel)
2026-10-15 11:51 ` Rong Zhang
2026-10-15 12:09 ` Ali Ahmet Memiş
2026-10-15 13:45 ` Rafael J. Wysocki (Intel)
2026-10-15 11:45 ` Rong Zhang
2026-10-15 13:13 ` Hans de Goede
2026-10-15 13:48 ` Rong Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5323dea7e1fdc48dff8cc820d5e7c8c2c0e081ac.camel@rong.moe \
--to=i@rong.moe \
--cc=W_Armin@gmx.de \
--cc=acpica-devel@lists.linux.dev \
--cc=aliamemis@disroot.org \
--cc=c.stratakis@proton.me \
--cc=daniel.lezcano@kernel.org \
--cc=johannes.goede@oss.qualcomm.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®