vhost_user_media: Worker POLLHUP handling and shmem_unmap fix - #3121
Conversation
f947e43 to
0025092
Compare
bridadan
left a comment
There was a problem hiding this comment.
Thanks for the fixes! I think the final commit adding multi-instance support could be its own PR, the commits proceeding it are nice standalone fixes that I'd like to see merged.
0025092 to
1da0933
Compare
|
Thanks @bridadan! I've updated this PR to only contain the 4 standalone driver and vhost-user fixes. I'll open a separate follow-up PR for the multi-instance fleet configuration and validation changes. |
#3136 is created. :) |
1da0933 to
a1fa874
Compare
a1fa874 to
472c349
Compare
|
Please update the PR summary: #3121 (comment) after your changes. |
472c349 to
8677a45
Compare
Missed this comment - summary has been updated. |
Head branch was pushed to by a user without write access
b041ed4 to
dba29ab
Compare
dba29ab to
6b713ed
Compare
|
@ser-io when you have a moment, could you please add this rebased PR to the merge queue again? Thanks! |
6b713ed to
8233a0c
Compare
|
@ser-io I've rebased the branch onto the latest main. Could you please let me know why the previous merge queue attempts failed to merge, and whether there is any action I should take on my end? |
The frontend (crosvm) removes shared memory mappings keyed solely by shm_offset, and `len` is not used. Set len to 0 with an explanatory comment.
When a FIFO writer disconnects and the buffer is drained, Linux poll() reports only POLLHUP (without POLLIN). Handling POLLHUP ensures read() is invoked, which consumes any remaining bytes and returns Ok(0) (EOF). This cleanly transitions the worker to WorkerState::Unopened rather than spinning in a 100% CPU poll busy-loop.
8233a0c to
9b6c65a
Compare
Summary
This PR contains standalone fixes and cleanup for
vhost_user_mediadrivers:Baseline Formatting (Commit 1):
cargo fmton the baselinev4l2_stream_proxycrate so subsequent functional changes remain strictly scoped and free of cosmetic noise.Shmem Unmap Message
len(Commit 2):lento0inVhostUserMMapforshmem_unmapinvhu_media/src/lib.rs, with an explanatory comment noting that the frontend (crosvm) removes mappings keyed solely byshm_offsetand does not readlen.POLLHUP Handling in Worker Loop (Commit 3):
POLLHUPalongsidePOLLINinv4l2_stream_proxy/src/worker.rswhen polling the video stream FIFO. When a FIFO writer disconnects and the buffer is drained, Linuxpoll()reports onlyPOLLHUP(withoutPOLLIN). HandlingPOLLHUPtriggersread(), consuming remaining bytes and receivingOk(0)(EOF) to cleanly transition toWorkerState::Unopenedrather than spinning in a 100% CPU poll busy-loop.Testing
bazel test //cuttlefish/host/commands/vhost_user_media/...(Passed)