mbox series

[RFC,v3,0/2] um: synchronized time-travel

Message ID 20190917132943.20102-1-johannes@sipsolutions.net
Headers show
Series um: synchronized time-travel | expand

Message

Johannes Berg Sept. 17, 2019, 1:29 p.m. UTC
This seems to work now. On top of qemu, I have the following patches:
https://lore.kernel.org/qemu-devel/20190903192505.10686-1-johannes@sipsolutions.net/
https://lore.kernel.org/qemu-devel/20190827124909.16824-1-johannes@sipsolutions.net/
https://lore.kernel.org/qemu-devel/20190917122512.15320-1-johannes@sipsolutions.net/
https://lore.kernel.org/qemu-devel/20190917122559.15555-1-johannes@sipsolutions.net/
https://lore.kernel.org/qemu-devel/20190917122625.15614-1-johannes@sipsolutions.net/
https://lore.kernel.org/qemu-devel/20190917122625.15614-2-johannes@sipsolutions.net/
https://lore.kernel.org/qemu-devel/20190917122644.15736-1-johannes@sipsolutions.net/

And 'make vhost-user-sim' builds a program there that speaks the UML
simulation time protocol and implements a virtual ethernet network.

With all the patches I sent to UML, I have a start script like this:

-------------
#!/bin/sh

~/hwsim/qemu/vhost-user-sim -s /tmp/clock -n /tmp/net 2>&1 | tee /tmp/sim.log &
(sleep 0.5 ; /path/to/linux mem=128M init=$(pwd)/test.sh root=none \
                            hostfs=/ rootfstype=hostfs rootflags=/ \
                            time-travel=ext:/tmp/clock \
                            virtio_uml.device=/tmp/net:1 >/tmp/log1) &
(sleep 1.5 ; /path/to/linux mem=128M init=$(pwd)/test2.sh root=none \
                            hostfs=/ rootfstype=hostfs rootflags=/ \
                            time-travel=ext:/tmp/clock \
                            virtio_uml.device=/tmp/net:1 >/tmp/log1) &
wait
wait
wait
-------------


where test.sh contains
-------------
#!/bin/bash

start=$(date +%s)
ip link set eth0 up
ip addr add 10.0.0.1/24 dev eth0
ping -D -n -i 10 -c 61 10.0.0.2
end=$(date +%s)
duration=$(($end - $start))
min=$(($duration / 60))
sec=$(($duration % 60))
echo "================= runtime observed inside VM ${min}m ${sec}s ================="
poweroff -f
-------------

and test2.sh contains
-------------
#!/bin/sh

ip link set eth0 up
ip addr add 10.0.0.2/24 dev eth0
tcpdump -n -e -i eth0 &
sleep 660
poweroff -f
-------------

This then results in a network of two machines where one pings the other,
and the virtual network currently implements exactly 50ms delay.


There are some bugs in the userspace side, it doesn't handle nested requests
correctly and can lock up, that's why I have the different sleeps in there.
However, I'll need to pivot a bit and write integration to the simulation
that I really need this to work with, so I still wanted to get this out. I
may not fix those userspace bugs, but it's still a sample program for this.

johannes