openwrt's vmm waits for cvdalloc.#1646
Merged
3405691582 merged 1 commit intogoogle:mainfrom Sep 19, 2025
Merged
Conversation
c7e705f to
0351b6f
Compare
jemoreira
reviewed
Sep 17, 2025
0351b6f to
6dfecc7
Compare
jemoreira
approved these changes
Sep 17, 2025
6dfecc7 to
b709079
Compare
openwrt uses a vmm to run a Wi-Fi access point, using a 802.11 hardware simulator connected to a tap device. Without cvdalloc, it assumes this device was already created by cuttlefish-host-resources. With cvdalloc, openwrt's vmm will need to wait for cvdalloc to complete in order to use the tap device it creates. The obvious way to do this is to use WaitForAvailability on cvdalloc's launcher. However, cvdalloc's launcher is already a VmmDependencyCommand for the instance's vmm, and if both openwrt's and cvdalloc's launcher are executing at the same time, we have two contending reads on cvdalloc's socketpair, which complicates matters. We could Wait and Post twice on the socket for notification, but that is rather ugly since that means we couple the number of socket Wait'ers to the cvdalloc binary unnecessarily. Instead, we guard WaitForAvailability by a mutex, so that there is always only one Wait'er at a time, and make WaitForAvailability idempotent, so that the second Wait need not actually attempt to read on the underlying socket.
b709079 to
79a1949
Compare
Databean
approved these changes
Sep 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
openwrt uses a vmm to run a Wi-Fi access point, using a 802.11 hardware simulator connected to a tap device. Without cvdalloc, it assumes this device was already created by cuttlefish-host-resources. With cvdalloc, openwrt's vmm will need to wait for cvdalloc to complete in order to use the tap device it creates.
The obvious way to do this is to use WaitForAvailability on cvdalloc's launcher. However, cvdalloc's launcher is already a VmmDependencyCommand for the instance's vmm, and if both openwrt's and cvdalloc's launcher are executing at the same time, we have two contending reads on cvdalloc's socketpair, which complicates matters.
We could Wait and Post twice on the socket for notification, but that is rather ugly since that means we couple the number of socket Wait'ers to the cvdalloc binary unnecessarily. Instead, we guard WaitForAvailability by a mutex, so that there is always only one Wait'er at a time, and make WaitForAvailability idempotent, so that the second Wait need not actually attempt to read on the underlying socket.