mbox series

[00/11] runqemu: use QMP for slirp host port allocation

Message ID 20261011195949.2118607-1-adrian.freihofer@siemens.com
Headers show
Series runqemu: use QMP for slirp host port allocation | expand

Message

AdrianF Oct. 11, 2026, 7:59 p.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

Instead of using flocks to manage slirp host ports, let QEMU be the
authoritative source for the ports. runqemu starts QEMU without the
forwards and adds them through the QMP interface (hostfwd_add).
If a host port is taken, QEMU rejects the forward and runqemu retries
with the next free one.

Why:
- Atomic: Taking the port either succeeds or fails in one step in QEMU.
  A lock and probe is racy, because the lock only coordinates runqemu
  instances and any other process can still bind the port before QEMU does.
- Readable: The effective host ports can be queried from QEMU. Reading them
  back from the command line only works for the first forward, which is the
  ssh port.

Since a forward can now end up on a different host port, devtool ide-sdk and
its selftests use the effective host ports. New selftests run against a native
-machine none QEMU and need no image.

The last patch keeps the old locking for the wrynose and blacksail autobuilder
branches, so a newer runqemu doesn't take ports away from the older locking
scheme. It is to be reverted once those branches are EOL or have the QMP
allocation backported.