r/QNX • u/alekafir • 1d ago
Measured message-priority inversion on QNX 8.0: 1605.329 ms with _NTO_CHF_FIXED_PRIORITY, 191.356 ms after
I have been looking at what a Neutrino kernel trace actually shows when a high-priority client is stuck behind message passing, not just a mutex.
Setup: QNX SDP 8.0 in QEMU TCG, wide-mode tracelogger, times from guest cycle timestamps (TRACE_CYCLES_PER_SEC in the committed captures).
A priority-40 client on a _NTO_CHF_FIXED_PRIORITY channel was blocked for 1605.329 ms (SEND-queued 1503.770 + REPLY 101.559). The server stayed at priority 10 while a priority-15 thread ran for 1497.547 ms. After creating the channel without that flag, the same client waited 191.356 ms, and the inversion finding was gone. The remaining wait is honest head-of-line time behind a 100 ms request the server was already handling — I did not try to hide it.
The same tracelogger pipeline also caught:
A MsgSend deadlock: two servers sent to each other, SEND-blocked for 1500.421 ms, until a watchdog killed the process. After switching to a send hierarchy (lower server notifies upward with MsgSendPulse), no cycle, worst client MsgSend() 3.823 ms.
A single-threaded resource manager: worst queued client 197.205 ms → 1.116 ms after receive threads + iofunc_attr_unlock() around the slow work.
A private pulse pool that refused 96 of 129 MsgSendPulse() calls (EAGAIN). Pool sized from the measured peak backlog of 32 up to 64: 0 refused, 129/129 received.
Classic semaphore inversion: 1532.579 ms → 401.660 ms with a pthread mutex and PTHREAD_PRIO_INHERIT. 401.660 ms is the legitimate 400 ms hold, not a leftover inversion.
I wrapped this in a small MIT host tool, qnx-trace-copilot: it captures the .kev, decodes it with traceprinter, flags the fault, patches a copy of the demo, rebuilds with qcc, and recaptures so the before/after is in the same report. Committed traces, timeline.html, and 31 tests are in the repo (tests and `qtc analyze` on a checked-in traceprinter file do not need a live guest).
https://github.com/alexisquirogaconsultor-droid/qnx-trace-copilot Demo (2:54): https://youtu.be/lzYF5ge__6E
I entered it in the QNX Global Hackathon (Developer Tooling & Host Tools): https://devpost.com/software/qnx-trace-copilot
If you have seen SEND/REPLY delays that a mutex-only analysis would miss, I would like to hear how you debug them.
