Major U.S. Aerospace Prime

Debugging a Custom QEMU Emulator on LynxOS-178 with SpyKer-TZ

 

hero - air mobility portfolio-2
Flag

Challenge

  • Multi-threaded QEMU on LynxOS-178

  • Elusive real-time timing bugs
  • Balance vcpu vs. I/O threads
solution

Solution

  • SpyKer-TZ live event tracing

  • Scheduler priority tuning

  • Custom in-app event waypoints
value

Value

  • Root-caused starvation + timeout

  • Restored Linux-level performance

  • Successful secure integration 

long arrow

Key Capabilities

GitLab CI/CD

DOORS

VectorCAST

AdaCore

SaFe Agile

Key Capabilities:     SpyKer-TZ     •     LynxOS-178     •     LynxSecure     •     QEMU Internals      •     RTOS Debug

Customer Challenge

A major U.S. aerospace prime was in the final integration and debug push for a custom QEMU system emulator hosted by LynxOS-178 and running within a LynxSecure subject. The emulator is heavily multi-threaded, with separate threads handling emulated code execution, filesystem I/O, and multiple forms of inter-subject communication over virtual network links and LynxSecure FIFOs.

Correct operation depends on tight real-time behavior: the I/O threads must respond promptly while the “vcpu” thread responsible for the emulated code must receive as much execution time as it demands. Balancing these competing demands against LynxOS-178’s priority-preemptive scheduler surfaced several elusive timing and threading issues that were very difficult to observe by conventional means.

Lynx Solution & Capabilities

To tune and balance system behavior, the team used thread priorities to take advantage of the LynxOS-178 priority-preemptive scheduler, and relied on SpyKer-TZ — Lynx’s event-tracing and trace-viewing/analysis utility, built on Percepio Tracealyzer technology — to capture live event traces and visualize how threads were being scheduled. This gave the team rapid, direct insight into complex, simultaneous thread interactions that would otherwise be extremely hard to diagnose.

SpyKer-TZ quickly exposed a LynxOS-178 device driver that implemented a poor spinloop while blocked waiting for I/O. This caused the read thread to consume a large amount of CPU while blocked, starving lower-priority threads. The behavior was easily identified in the SpyKer-TZ trace viewer; after the customer switched to a non-blocking mode of the driver, follow-up trace viewing confirmed the errant behavior was eliminated and lower-priority threads were no longer starved.

A tougher, late-stage hurdle was a timeout on a customer-designed inter-subject communication path, caused by a software heartbeat not arriving when expected — seemingly indicating that the vcpu thread was not getting enough execution time or was not being properly woken by QEMU. SpyKer-TZ analysis instead showed the vcpu thread receiving ample execution with no obvious gaps. By adding user-specified event generation from within the application, the team tightly correlated SpyKer-TZ profile data with specific instrumented waypoints in the code, revealing that the vcpu thread was spending an inordinate amount of time on a task unrelated to running the emulated application.

That insight pinpointed the true cause: QEMU’s code-generation buffer, which holds translated code, was filling and taking an unusually long time to flush before newly translated code could continue executing — and the flush delay was triggering the inter-subject communication timeout.

capabilities

Customer Value & Outcomes

SpyKer-TZ turned an opaque, multi-threaded timing problem into an observable one, letting the team root-cause issues in a fraction of the time. Two key insights emerged. First, the customer had been entirely unaware that QEMU flushes the code-generation buffer whenever it fills. Second, Lynx’s initially ported and simplified memory-management routines behind that buffer made the flush operation roughly an order of magnitude slower on LynxOS-178 than under Linux.

The team resolved both by increasing the size of the code-generation buffer, so it never needs to flush, and by implementing enhanced memory-management capabilities that brought flush performance back in line with Linux. The result was eliminated CPU starvation, resolved inter-subject communication timeouts, and Linux-comparable performance within the secure, partitioned LynxOS-178 / LynxSecure environment — enabling a successful final integration.

Once again, SpyKer-TZ demonstrated the value of being able to easily and rapidly view live event-trace data from a running system to understand complex execution timing and the interaction between many threads running simultaneously on LynxOS-178.

Key Skills & Differentiators

    • SpyKer-TZ event tracing and trace analysis (built on Percepio Tracealyzer)
    • LynxOS-178 priority-preemptive scheduling and thread-priority tuning
    • QEMU internals, including code-generation (translation) buffer behavior
    • Multi-threaded real-time debugging on an RTOS
    • Device-driver I/O analysis (blocking vs. non-blocking modes)
    • Custom in-application event instrumentation and waypoint correlation
    • Memory-management optimization for flush performance
    • Inter-subject communication via virtual network links and LynxSecure FIFOs

System Architecture & Trace Flow

Lynx SpyKer-TZ is Powered by Tracealyzer®  from Percepio
System Software Stack — QEMU Emulator on LynxOS-178 Within LynxSecure

Anonymized: A Customer, multi-threaded system emulator hosted in a secure partition.

Diagram

Figure 1 — Software stack: the multi-threaded QEMU emulator runs on LynxOS-178 inside a LynxSecure subject, communicating with peer subjects via virtual network links and LynxSecure FIFOs.

SpyKer-TZ Event Trace Interception & Analysis

How Spyker-TZ captures live scheduling and application events, then visualizes them on the host.

Diagram2

Figure 2 — SpyKer-TZ interception: kernel scheduling, driver, and QEMU thread events are captured automatically, user-instrumented waypoints add custom events, and the trace is visualized and analyzed on the host.

Learn More About SpyKer-TZ

 

 

Need Real-Time Visibility Into Complex Systems

See how Lynx SpyKer-TZ can help your team identify timing issues, optimize thread behavior, and accelerate debugging on LynxOS-178 and LynxSecure.