[prev in list] [next in list] [prev in thread] [next in thread]
List: freebsd-hackers
Subject: How to sync/mutex with acpi_tz_get_temperature()
From: Johannes Totz <jo () bruelltuete ! com>
Date: 2022-09-13 15:59:10
Message-ID: 9b87dd66-de57-f363-279e-dc33134c0fa6 () bruelltuete ! com
[Download RAW message or body]
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.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic