How to sync/mutex with acpi_tz_get_temperature()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 13 Sep 2022 16:03:58 UTC
Hi there, I would like to make sure that some of my code does not run concurrently with acpi_tz_get_temperature() [https://github.com/freebsd/freebsd-src/blob/main/sys/dev/acpica/acpi_thermal.c#L465]. What's the best way to achieve that? I wrote a small driver for one of those SuperIO hardware monitors that measures fan speed, voltage, temperature etc. That works fine. But looking at my board/BIOS's ASL, invoking _TMP is not safe to do concurrently with my driver. [see footnote] Ultimately, acpi_tz_thread() [https://github.com/freebsd/freebsd-src/blob/main/sys/dev/acpica/acpi_thermal.c#L949] is calling acpi_tz_get_temperature() with a few hops in-between. There are a few instances of ACPI_LOCK(thermal) etc but nothing that guards acpi_tz_get_temperature() specifically. Anyone have ideas/pointers? thanks, Johannes footnote: Reading from that chip is stateful, as in you need to do I/O to select which register you want to read/write and then read/write from another location to access the value of that register. Try to do that from 2 threads at the same time, one of them will read/write the wrong register, thus you can glitch ACPI into doing something disruptive/destructive.