Skip to content

SCGPU doorbell: the guest sleeps on a virtio-input device instead of polling - #29

Merged
dylanneve1 merged 1 commit into
mainfrom
scgpu/doorbell
Oct 27, 2026
Merged

dylanneve1 merged 1 commit into
mainfrom
scgpu/doorbell

Conversation

@dylanneve1

Copy link
Copy Markdown
Collaborator

The guest half of the SCGPU doorbell (Scion PR, same name): a virtio-input device named scion-scgpu, handed to SCGPU by the input driver (patch 1305), rings both ways. scgpu_ctrl spins 60 us and then sleeps until the app's ring interrupt, with a 5 ms safety timeout. Each side rings only when the other has said it sleeps (host_sleeping/guest_waiting, Dekker with full barriers).

On the Pixel, under YouTube in Safari: 4-10K commands/s, the guest rang 165-263/s and the app 1600-2200/s, and it held up for the whole session.

🤖 Generated with Claude Code

… instead of polling

The mailbox was polled on both sides: the guest spun 300 us and then napped in 20 us steps
(delay_for_interval, which XNU's timer slack stretches), the app's thread spun while commands
came (12% of a core). Now a virtio-input device named "scion-scgpu", the app's, is a doorbell
both ways. The app rings with an input event (an interrupt here). The guest rings with a status
event, which crosvm writes into the app's socket. Each side spins briefly, then says it sleeps
(host_sleeping, guest_waiting) and looks once more after a full barrier, and a side rings only
when the other has said so: no ring is lost, and none is sent during a burst.

- hakios.scgpu.h: host_sleeping, guest_waiting, SCGPU_BELL_NAME.
- hakios.vgpu3d_xnu.c: hakios_scgpu_bell_attach (event and status queues, the service thread
  wakes the waiter), bell_ring, and scgpu_ctrl spins 60 us, then sleeps on the doorbell (5 ms
  safety). Without the device it waits as before.
- 1305: the virtio-input driver hands the device named scion-scgpu to SCGPU instead of making it
  a touch screen.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dylanneve1
dylanneve1 merged commit 2e50816 into main Oct 27, 2026
1 check passed
@dylanneve1
dylanneve1 deleted the scgpu/doorbell branch October 27, 2026 14:46
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.

1 participant