Skip to content

Don't livelock on the busy flag with the GDB backend - #57

Merged
JohnAmadis merged 1 commit into
masterfrom
ccr-09cd1b4c-fehk7j
Sep 30, 2026
Merged

JohnAmadis merged 1 commit into
masterfrom
ccr-09cd1b4c-fehk7j

Conversation

@JohnAmadis

Copy link
Copy Markdown
Contributor

Problem

In dmod-boot's Renode test, monitor-gdb would randomly stop logging partway through the boot (after dmini, dmfmc or dmhaman). It then read the same ring header forever:

GDB RECV: $4f4c4d44 02000000 200a0000 210a0000 ...   <- flags=0x2 (BUSY), head=2592, tail=2593

With --verbose it happened in 3 of 3 runs.

With the GDB backend every ring read interrupts the target. When the interrupt lands while the firmware holds DMLOG_FLAG_BUSY (in the middle of a dmlog write), monitor_wait_until_not_busy() takes over, and that loop:

  • never resumes the target, so right after connecting (target stopped) it waits forever;
  • polls every 10 ms. Each poll resumes the target for only about that long, and under Renode the firmware executes next to nothing in such a window.

Either way the flag never clears.

Fix

Verification

  • ctest passes 5/5, and tests/test_automated_gdb.sh passes 7/7 (gdbserver backend).
  • Verbose dmlog_monitor --gdb against dmod-boot in Renode (chocotechnologies/dmboot:1.0.0): went from 3/3 stalled to 3/3 reaching DMOD-Boot started and the shell prompt.
  • dmod-boot's run_renode_tests.sh with this monitor passes consistently (see the dmod-boot PR adding the UART step).

🤖 Generated with Claude Code

https://claude.ai/code/session_01JWVYTSBnZLbpDqp7X1sknv


Generated by Claude Code

monitor_wait_until_not_busy() polled every 10 ms and never resumed the
target. With the GDB backend each ring read interrupts the target, so
when an interrupt landed while the firmware held DMLOG_FLAG_BUSY (in the
middle of a dmlog write), the target either stayed stopped for good (if
the monitor had not resumed it yet, as right after connecting) or only
got 10 ms windows, in which Renode lets it execute next to nothing. The
flag never cleared and the log stopped for good - dmod-boot's Renode
test hung that way at random points of the boot (flags=0x2 in every
ring read, head/tail frozen).

Resume the target in that loop too and share the 200 ms GDB poll
interval monitor_wait_for_new_data() already uses.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JWVYTSBnZLbpDqp7X1sknv
@JohnAmadis
JohnAmadis merged commit abd4691 into master Sep 30, 2026
2 checks passed
JohnAmadis pushed a commit to choco-technologies/dmod-boot that referenced this pull request Sep 30, 2026
choco-technologies/dmlog#57 is merged; abd4691 is its merge commit, with
the same tree as the branch commit tested here.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JWVYTSBnZLbpDqp7X1sknv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants