diff options
| author | Kevin Bowling <kbowling@FreeBSD.org> | 2026-08-27 12:46:19 +0000 |
|---|---|---|
| committer | Kevin Bowling <kbowling@FreeBSD.org> | 2026-09-03 04:00:09 +0000 |
| commit | add771d5e62ae12f2494fb30a93cd5f1067ac34d (patch) | |
| tree | 131b42641d669e947a1f5e89b1e9793873a4b445 /lib/CodeGen/CodeGenPrepare.cpp | |
| parent | a3daa1e8f5988045e8042fb3fe376384a43b85ee (diff) | |
The TIS interrupt handler can acknowledge and signal an event after
the waiter checks the device status but before it enters tsleep().
Since the handler is MPSAFE, the command lock does not close this
window. A lost wakeup can delay a completed command for its full
timeout, up to 40 seconds for long TPM 2.0 operations.
Publish the expected event under an interrupt mutex and use a generation
counter to record matching interrupts. Recheck the device predicate
without the mutex because register access may sleep on a SPI transport,
then compare the generation before atomically waiting on a condition
variable. This closes the check-to-sleep race without placing sleeping
bus operations under a mutex.
Use an absolute deadline while retrying the predicate after wakeups.
Apply the same scheme to locality acquisition, which had an equivalent
race. Leave the expected event published while polling so the
attach-time test can still prove that an advertised interrupt arrived.
Regression-tested the polling fallback on two TPM 2.0 FIFO systems with
200 concurrent PCR reads per system and repeated device suspend/resume.
Neither ACPI device exposes an IRQ, so the interrupt-mode path remains
hardware unvalidated.
Reviewed by: kevans
MFC after: 2 weeks
Sponsored by: BBOX.io
Differential Revision: https://reviews.freebsd.org/D59241
Diffstat (limited to 'lib/CodeGen/CodeGenPrepare.cpp')
0 files changed, 0 insertions, 0 deletions
