Repository navigation
Fix two freezes in the socket CharIo backend (rcv_char_available throttle, blocking rcv_char) - #249
BuilderGuy1 wants to merge 2 commits into
Conversation
…s the select() truth The A04-22 wedge root-caused: CharIoSocket::rcv_char_available() returned 'no character available' for ~785 of every 800 polls whenever the peer's reply traffic was dense (consecutivechars >= 15), while the guest's NubDriver_WaitForByte spins with MSR[EE]=0 waiting for RR0_RX_CHARACTER_ AVAILABLE (the contradictory flag=44/busy=00 state the wait-clock study measured). The nub's debug transaction never sees its reply, the machine parks, the uncollected ADB packets are the visible wedge (the Cuda starvation flood, the dead cursor, the roll-15 'post-exit wedge', boot 8's repro at emu 250.4 s). The socket buffer already prevents overrun (the kernel holds unread bytes; select() reports them when the guest is ready); the throttle protected nothing. The wedge's instrument-facing consequences die with it: no Cuda flood, no NubDriver_WaitForByte park, no dead cursor.
…IT in rcv_char A blocking recv(acceptfd) froze the whole emulated machine whenever guest code read the ESCC data register while the peer-side debugger had sent nothing (the silent-peer boots froze at the splash logo, CPU pegged). EAGAIN now means 'no byte pending' and the rx-available bit stays the sole truth the guest polls.
|
Thank you for interest in contributing to DingusPPC. Unfortunately, this commit appears to heavily use AI, which I cannot accept. If you would like to commit this, please do a version that does not use AI. |
|
Regarding AI, I don't mind that it's used to fix problems. It's just the AI-speak that bothers me.
This is intended. It's a workaround for a problem in Open Firmware where it can only accept 15 out of ~800 serial port receive polls at a time. I have commits in my fork to change this so it can be disabled:
Something strange though: With
Not sure about this one. Certainly, using
I'll add a fix to reset I don't see a problem with these commits for the main fork (unless you care about pasting text into Open Firmware without the I can rebase my fork with changes to restore the text_pacing feature. Serial port DMA requires additional changes in my fork since I removed polling from the DBDMA emulation. I need to add a thread for reading from serial. Hopefully after that I'll be able to connect two instances of DingusPPC where one is running Copland and the other is running the PowerPC debugger. |
|
I would like to start by apologizing for submitting AI output in your project. I wasn't sure how well it would be accepted and thought posting it was a bit risky. I decided to post it because I had done 2 days of testing with the AI, the conclusions seemed reasonable and, hopefully, useful to the project. |
|
Found the Discord and the E-Maculation subforum; I'll ask questions there rather than opening PRs. Thanks again. |
In Open Firmware,
The assumption may be true for real hardware but is currently not true for DingusPPC. The current text pacing workaround in DingusPPC allows for 14 consecutive characters. This probably should be changed to 4 characters to match the above problem description. In the Open Firmware dictionary, there are 8 bytes between the start of the I tried pasting more than 16 characters with |
Fixes #248 — see that issue for the full bug report, repro recipe, and validation matrix.
Two minimal fixes to
devices/serial/chario.cpp(CharIoSocket):rcv_char_available()reported "no character available" for ~785 of every 800 polls duringdense RX. Any guest polling
RR0_RX_CHARACTER_AVAILABLEwith interrupts masked (the Coplandkernel's
LLNubDriver_WaitForBytedoes exactly this) parks forever and the machine wedges.The kernel socket buffer already prevents overrun; availability is now the
select()truth.rcv_char()called a blockingrecv()with no availability check. Any guest read of theESCC data register while the peer-side had sent nothing blocked the emulator's CPU thread
forever — the whole machine froze. Now
MSG_DONTWAIT: EAGAIN = no byte pending; therx-available bit stays the sole truth the guest polls.
Both fixes validated on the Copland D11E4 guest: the workload that wedged every prior boot now runs
to completion with the machine interactive throughout; silent-peer boots that froze at the splash now
proceed normally.
Note for reviewers: the
consecutivecharsreset branch was dead code becausewritefds = readfdsputs the listen socket in the write set, so
select()always returned > 0. Left as-is in thisminimal fix; a follow-up cleanup (readfds-only select, don't recv the listen socket, small real RX
FIFO) could be a separate PR.