https://bugzilla.kernel.org/show_bug.cgi?id=221842

Sander ([email protected]) changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #5 from Sander ([email protected]) ---
The same hang occurs on an HP ZBook Power 15.6-inch G10 (BIOS V97). Its DSDT
has the same GBAP, _Q08 and _Q09 bodies as the Firefly DSDT in attachment
310583. In my logs, and in attachment 310586 of this report, the two members of
the cycle are both kec_query workers: one is inside the Serialized method GBAP
and waits for ECMX, the other holds ECMX and waits to enter GBAP. The
kacpi_notify battery worker is blocked behind them. Perhaps the title could say
"between concurrent EC _Qxx evaluations (GBAP method mutex vs ECMX)".

System
------

- HP ZBook Power 15.6-inch G10 Mobile Workstation PC (i9-13900H, NVIDIA RTX
3000 Ada Laptop, hybrid).
- BIOS: HP V97 Ver. 01.13.01 (2026-06-22), the latest version on HP's site as
of 2026-11-25. EC firmware 58.3A (ec_firmware_release 88.58). DSDT OEM table ID
8BEF.
- Ubuntu 26.04, kernels 7.0.0-42 to 7.0.0-44-generic, no ACPI parameters on the
kernel command line. Taint OE (nvidia open module, evdi); neither appears in
the traces.
- Four occurrences: 2026-11-02, 2026-11-04, 2026-11-16 and 2026-11-25, each 27
to 45 minutes after a morning boot on AC power. On 2026-11-25 the battery was
charging: 95 % at 07:34, 99 % at 07:51, still 99 % and tapering (4.9 W) at
upowerd's last sample at 08:03:55; upowerd blocks after that. I have no charge
history for the earlier dates.

The cycle (hung task report, 2026-11-25)
----------------------------------------

    INFO: task kworker/15:1:34464 blocked for more than 122 seconds.
    Workqueue: kec_query acpi_ec_event_processor
     acpi_os_wait_semaphore+0x74/0x1c0
     acpi_ex_system_wait_mutex+0xdf/0x140
     acpi_ds_begin_method_execution+0xb4/0x450      <- entering a Serialized
method
     acpi_ds_call_control_method+0x9e/0x4a0
     ...
     acpi_ec_event_processor+0xe3/0x130
    INFO: task kworker/15:1:34464 blocked on a semaphore likely last held by
task kworker/15:2:43399

    INFO: task kworker/15:2:43399 blocked for more than 122 seconds.
    Workqueue: kec_query acpi_ec_event_processor
     acpi_os_wait_semaphore+0x74/0x1c0
     acpi_ex_system_wait_mutex+0xdf/0x140
     acpi_ex_acquire_mutex_object+0x68/0x170
     acpi_ex_acquire_mutex+0x8b/0x2d0
     acpi_ex_opcode_2A_0T_1R+0x173/0x1f0            <- AML Acquire()
     ...
     acpi_ec_event_processor+0xe3/0x130
    INFO: task kworker/15:2:43399 blocked on a semaphore likely last held by
task kworker/15:1:34464

    INFO: task kworker/15:3:43400 blocked for more than 122 seconds.
    Workqueue: kacpi_notify acpi_os_execute_deferred
     acpi_ds_begin_method_execution+0xb4/0x450
     ...
     acpi_bus_get_status+0x8f/0x150                  <- BAT0._STA -> EC0.BSTA
-> EC0.GBAP
     acpi_battery_update+0x23/0x240
     acpi_battery_notify+0x4c/0xf0
    INFO: task kworker/15:3:43400 blocked on a semaphore likely last held by
task kworker/15:2:43399

The 2026-11-04 occurrence has the same shape: kworker/6:1:283 (kec_query,
acpi_ds_begin_method_execution) and kworker/14:1:26590 (kec_query, Acquire) are
blocked on each other, the kacpi_notify worker kworker/19:0:99
(acpi_bus_get_status) waits on 14:1, and upowerd waits on 19:0. The 2026-11-02
and 2026-11-16 reports look the same, but one member was cut off by the
hung-task report limit.

The hung-task hints name the holders, not the mutexes. The mutexes follow from
the AML below.

Where it comes from in the DSDT
-------------------------------

All under \_SB.PC00.LPCB.EC0 (excerpts, simplified). ECMX and the implicit
method mutex of GBAP both have SyncLevel 0, so ACPICA's sync-level check does
not detect the inversion.

    Name (GACP, 0x07)                    // bit 0x02 set at boot

    Method (GBAP, 0, Serialized)
    {
        Acquire (BTMX, 0xFFFF)
        If ((GACP & 0x02))
        {
            GACP &= 0x05
            Release (BTMX)
            Acquire (ECMX, 0xFFFF)       // order A: GBAP method mutex -> ECMX
            If (ECRG) { NBAP = BATP }
            Release (ECMX)
        }
        Else { Release (BTMX) }
        Return (NBAP)
    }

    Method (_Q08, 0, NotSerialized)      // battery information change
    {
        PWUP (0x06, One)                 // sets GACP bit 0x02
        ...
        Local0 = GBAP ()                 // order A
        ...
        Acquire (ECMX, 0xFFFF)
        If ((GBAP () == One)) { ... }    // order B: ECMX -> GBAP method mutex
        Release (ECMX)
        ...
    }

    Method (_Q09, 0, NotSerialized)      // battery status change
    {
        ...
        Acquire (ECMX, 0xFFFF)
        Local0 = GBAP ()                 // order B
        ...
        Release (ECMX)
        ...
    }

    // SSDT14
    Method (\_SB.IETM.ODVP, 0, Serialized)
    {
        ...
        Acquire (\_SB.PC00.LPCB.EC0.ECMX, 0xFFFF)
        Local0 = \_SB.PC00.LPCB.EC0.GBAP ()   // order B
        ...
        Release (\_SB.PC00.LPCB.EC0.ECMX)
    }

Order A happens whenever GBAP is entered without ECMX held while GACP bit 0x02
is set. The bit is set at boot (Name (GACP, 0x07)) and by PWUP with 0x06, 0x07
or 0x03 (_Q08, _Q18, ECRI, HWAK). Callers without ECMX are _Q08's first GBAP
call, _Q18, and the battery methods _STA, _BST and _BIX via BSTA. Order B is
_Q08's second half, _Q09 and \_SB.IETM.ODVP, which _Q06, _Q08 and _Q09 call,
and which int3400_thermal also evaluates on Notify (IETM, 0x88).

Linux evaluates _Qxx methods concurrently (kec_query is a per-CPU workqueue
with max_active = ec_max_queries), and the interpreter lock is released while
waiting on a mutex, so the two orders can meet. In the traces from the ZBook
Power G10 and from the Firefly, both members are kec_query workers, most likely
_Q08 or _Q18 on the A side and _Q08, _Q09 or ODVP on the B side. Which _Qxx
exactly is not visible in the stacks.

Possible fixes
--------------

1. Firmware (HP): make GBAP NotSerialized (BTMX already protects GACP), or
never call GBAP with ECMX held (_Q08, _Q09, \_SB.IETM.ODVP).
2. Kernel: acpi.ec_max_queries=1 is not a valid test, because the limit applies
per CPU. Commit 645f370c932d ("ACPI: battery: Evaluate battery methods
exclusively") serializes _BIX, _BST and _BTP only and does not cover this
cycle.

The DSDT and SSDTs (acpidump format) and the full hung-task log are available
on request.

Disclosure: I did this analysis with the help of Claude, an AI assistant from
Anthropic. The log lines and AML excerpts come from my ZBook Power G10. The
reading of the AML and of the kernel and ACPICA sources was done with Claude,
and a separate Claude session checked the claims against those sources before
posting.

-- 
You are receiving this mail because:
You are watching the assignee of the bug.

_______________________________________________
acpi-bugzilla mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/acpi-bugzilla

Reply via email to