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

--- Comment #6 from [email protected] ---
Thanks, Sander. Your analysis matches mine: two kec_query workers, one inside
the Serialized GBAP waiting for ECMX, the other holding ECMX and waiting to
enter GBAP, with the battery notify worker stuck behind them. My original title
blamed kacpi_notify, which was wrong. I've changed it to:

  ACPI EC: deadlock between concurrent _Qxx evaluations (GBAP method mutex vs
ECMX) on HP ZBook G10 (Firefly 14, Power 15.6)

Your fix 1, making GBAP NotSerialized, works on the Firefly. I've been running
a patched DSDT through the initrd ACPI table upgrade for close to two months
with no hung tasks and no freezes. Before the patch, the hang came back every
few days to every few weeks. The one recurrence since I started patching was on
a boot where I had left the patch out.

Approach
--------

- Patch the binary instead of recompiling. On this DSDT, iasl's
disassemble/recompile round trip doesn't work: nested Switch blocks come out
mangled and the recompile fails. So I changed only the MethodFlags byte of GBAP
from Serialized to NotSerialized, raised the OEM revision so that the kernel
accepts the table, and fixed the checksum. A disassembly diff of patched vs
original shows only the GBAP Method line.
- Leave _Q08, _Q09 and ODVP unchanged. Once GBAP has no method mutex, calling
it with ECMX held is just a nested Acquire, and the two lock orders can no
longer collide. BTMX still protects GACP.
- One side effect: two GBAP calls can now run at the same time and both write
NBAP. In the normal path, each stores a value it has just read, so the last
write wins and holds a current value.

Caveats
-------

- With Secure Boot on, kernel lockdown silently ignores initrd table overrides.
The only trace is a notice in dmesg.
- HP doesn't raise the DSDT OEM revision between BIOS versions. An override
built from one BIOS will therefore keep replacing the DSDT of a newer BIOS. It
needs to be rebuilt after every BIOS update, and loading it should depend on
the BIOS version.
- To confirm it is active, dmesg should show "Table Upgrade: override" for the
DSDT along with the raised OEM revision.

Now that the bug shows up on two G10 models running the latest BIOS for each, I
agree the real fix belongs in HP's firmware.

Disclosure: I also did this analysis with help from Claude. The traces, the
patch and the test results come from my own machine.

-- 
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