Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 89008cd5 authored by Cody Schuffelen's avatar Cody Schuffelen Committed by Greg Hartman
Browse files

Add native vsock support to ADB.

vsock is a socket address family for communicating into and out of
virtual machines. Addresses have a port and CID. The CID is unique to
each virtual machine on the computer. The VM host always has CID 2.
http://man7.org/linux/man-pages/man7/vsock.7.html

Inside the android guest, the adb daemon hosts a vsock server with
VMADDR_CID_ANY, automatically using the guest CID. The adb server
can now connect to addresses of the form vsock:cid:port, where the CID
must be specified and the port defaults to 5555.

This is a significant speed improvement for ADB connections in
Cuttlefish, with 150-200 MB/s for `adb push` and 100-150 MB/s for
`adb pull`. It also allows removing some proxying steps from Cuttlefish,
simplifying the full connection path, and removes a dependency on the
unstable ivshmem protocol.

Commands tested against a Cuttlefish VM with CID 3:
adb connect vsock:3:5555
adb -s vsock:3:5555 shell
adb disconnect vsock:3:5555

Supporting "adb disconnect" and "adb -s" required modifying some of the
parts that parse addresses / serials.

push/pull trials with native adb vsock support in cuttlefish:

100m: 1 file pushed. 167.9 MB/s (104857600 bytes in 0.596s)
100m: 1 file pushed. 171.1 MB/s (104857600 bytes in 0.584s)
100m: 1 file pushed. 175.2 MB/s (104857600 bytes in 0.571s)
100m: 1 file pushed. 168.7 MB/s (104857600 bytes in 0.593s)
100m: 1 file pushed. 172.9 MB/s (104857600 bytes in 0.578s)
100m: 1 file pushed. 168.8 MB/s (104857600 bytes in 0.592s)
100m: 1 file pushed. 197.5 MB/s (104857600 bytes in 0.506s)
100m: 1 file pushed. 201.0 MB/s (104857600 bytes in 0.497s)
100m: 1 file pushed. 199.0 MB/s (104857600 bytes in 0.503s)
100m: 1 file pushed. 215.5 MB/s (104857600 bytes in 0.464s)

/data/local/tmp/100m: 1 file pulled. 143.8 MB/s (104857600 bytes in 0.696s)
/data/local/tmp/100m: 1 file pulled. 137.5 MB/s (104857600 bytes in 0.727s)
/data/local/tmp/100m: 1 file pulled. 135.5 MB/s (104857600 bytes in 0.738s)
/data/local/tmp/100m: 1 file pulled. 139.6 MB/s (104857600 bytes in 0.716s)
/data/local/tmp/100m: 1 file pulled. 158.3 MB/s (104857600 bytes in 0.632s)
/data/local/tmp/100m: 1 file pulled. 126.7 MB/s (104857600 bytes in 0.789s)
/data/local/tmp/100m: 1 file pulled. 129.8 MB/s (104857600 bytes in 0.771s)
/data/local/tmp/100m: 1 file pulled. 154.8 MB/s (104857600 bytes in 0.646s)
/data/local/tmp/100m: 1 file pulled. 156.9 MB/s (104857600 bytes in 0.637s)
/data/local/tmp/100m: 1 file pulled. 152.2 MB/s (104857600 bytes in 0.657s)

Bug: 121166534
Change-Id: I50f21fb5c9acafb8daa789df4e28c9e1bbbbf2ef
Test: adb connect/shell/disconnect
parent c8a78b58
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment