Age | Commit message (Collapse) | Author |
|
OK florian@ dv@
|
|
SIOCAIFADDR_IN6 to configure an IPv6 address does everything SIOCIFAFATTACH
does, i.e. it enables IPv6 on the interface if not done so already.
vm.conf(5) 'local inet6' works as before.
OK mlarkin
|
|
vmm(4) doesn't need this information anymore. vmd(8) is the only
consumer of this information.
ok mlarkin@
|
|
|
|
|
|
- simpler tense
- fix the -width parameter
- add -nosplit to AUTHORS
|
|
Document the shutdown behaviour for vmd(8). Suggested via bugs@
via eric at mulh.net.
ok jmc@, bluhm@
|
|
|
|
|
|
from hshoexer@; OK mlarkin@
|
|
To launch a guest with AMD SEV enabled, vmd needs to do a few things:
- retrieve ASID used by guest on VM creation
- provide ASID to psp(4)
- let psp(4) encrypt memory used intially by guest
- run guest
- release resources held by psp(4) on guest shutdown
To enable SEV for a guest use the parameter "sev" in the guest's vm
section in vm.conf.
from hshoexer@; OK mlarkin@
|
|
mmio.c was moved to x86_mmio.c with dv@'s recent refactoring. The resulting
empty file can be removed now.
|
|
Apparently it never had one. It's rarely touched, so went unnoticed.
|
|
ok dv@
|
|
When we get bumped to userland and the fault is already handled,
don't log anything. It's way too chatty and helps nobody trying to
debug things.
|
|
Forgot `cvs add` and sys/dev/vmm/vmm.h changes.
|
|
Makes as much of the core of vmd mi, pushing x86-isms into separate
compilation units. Adds build logic for arm64, but no emulation
yet. (You can build vmd, but it won't have a vmm device to connect
to.)
Some more cleanup probably needed around interrupt controller
abstraction, but that can come as we implement more than the i8259.
ok mlarkin@
|
|
DHCP request should no leave vmd if its answered internally.
ok dv@
|
|
To prepare for mi/md splitting vmd, need to fixup the dev/vmm/vmm.h
mi header. Move the vm_run_params struct and clean up the includes
in vmd.
"sure", mlarkin@
|
|
page faults.
sure, @mlarkin.
|
|
The vm process uses multiple pthreads to emulate vcpu and also drive
an event loop doing various io emulation. At points, one or the
other needs to read/write global vm state bits and toggle if a vcpu
is halted or "done."
This adds in a another mutex to protected the global state and
untangles areas where the mutex for protecting a condition variable
was being used around modifying some global state.
ok mlarkin@
|
|
|
|
There's no need to distinguish the "first" time running a vcpu from
the subsequent times because vmm(4) uses in-kernel state tracking
the last vm exit reason to optimize the logic for updating vcpu
registers from userland. While here, clean up the DPRINTF's to make
the Intel VMX logic similar to the AMD SVM.
ok mlarkin@
|
|
In order to continue work on mmio and other instruction emulation,
vmd(8) needs the ability to inject exceptions (like page faults)
from userland.
Refactor the way events are injected from userland, cleaning up how
hardware (external) interrupts are injected in the process.
ok mlarkin@
|
|
redundant since we call daemon() earlier.
ok bluhm@
|
|
processes. Synced from relayd.
ok mlarkin@ dv@
|
|
My recent refactor introduced a bug where the vionet device will
add the tap(4) read event on an unpause regardless of driver and
device state, causing the cpu to peg as the read event fires
indefinitely because the guest's virtqueue isn't ready to receive
the data.
Add in a global flag that tracks if the rx-side is enabled or not
to coordinate adding the tap read event.
ok mlarkin@
|
|
This commit adds multithreading to allow both virtqueues to be
processed in parallel along with additional synchronization primitives
to protect device configuration state. Allowing RX and TX to operate
independently reduces overall network latency for guests and helps
alleviate the TX side dominating cpu time.
Tested with help from phessler@, kn@, and mlarkin@. ok mlarkin@.
|
|
The mmio code isn't wired in, but if the ModRM decode fails, byte
may be used with an uninitialized value. Properly return an error,
but initialize the byte variable as well.
Found by smatch, reported by and ok jsg@.
|
|
Before comparing the amount of bytes read to the size of a packet
struct, make sure the fd being read was actually the packet injection
pipe(2). Locked address interfaces force using the same copy-based
approach used for the internal dhcp service for "local" interfaces
but were accidentally being treated as reads from the pipe(2) and
not the tap.
This broke networking for any locked address interfaces in vmd(8).
Reported by and ok kn@
|
|
After the recent vmd(8) commit to clean up file descriptor lifecycles,
virtio disks with multiple file descriptors (QCOW2 images with at
least one base) would fail to initialize when booted with a network
device.
Use the new fd closing routine in the vm process for virtio devices
to close the device fds and set to -1, removing buggy copying and
closing of fds.
Additionally, close the vm/device sync and async channels when
closing a device's fds.
Issue reported by and ok kn@
|
|
No functional change. vmd(8) was being chatty and incorrect.
|
|
It's super chatty and pollutes verbose logging.
|
|
Remove extraneous fcntl(3) usage for setting fd features that can
be set at time of open(2), pipe2(2), or socketpair(2). Also cleans
up pty creation switching to using functions from libutil instead
of direct ioctl(2) calls.
ok mlarkin@, original diff ok claudio@ as well.
|
|
Return early if no vm is found in vmd(8)'s primary vm fork/exec
function, preventing null deref in the 'fail' section. Also remove
inner return from the parent routine to prevent unreachable code.
Found by smatch, reported by and ok jsg@.
|
|
This area of code in vmd(8) is suspect, but the null dereference
is easily avoided.
Found by smatch, reported by and ok jsg@
|
|
In the event the driver kicks the vioblk device, but the guest
doesn't have any available virtqueue space, vmd will return an
uninitialized value. If non-zero, it results in a notification to
the driver and effectively a spurious interrupt.
Found by smatch, reported by and ok jsg@
|
|
Found by smatch "double check that we're allocating correct size"
warning. Reported by and ok jsg@.
|
|
The recent vmd(8) vionet refactor caused cpu spinning when the
device would be activated by a driver but before virtqueues were
provided. (e.g. booting a ramdisk kernel and not running `ifconfig
vio0 up`)
Defer adding the tap and packet injection read events until after
the first RX queue notification from the driver.
ok mlarkin@
|
|
found by "buffer overflow 'vioblk->disk_fd' 4 <= 15" smatch error
ok dv@
|
|
vmd's use of agentx requires the agentx group, but if unavailable,
no details were given to the user.
Zap some whitespace whitespace while here.
"that is better", deraadt@
|
|
Similar to the rewrite of the virtio block device to use zero-copy
semantics, this rewrites how the virtio network device works with
the virtqueue ring buffers to minimize data copying. For guests
that don't use the built-in DNS and mac filtering capabilities,
data can now be transfered to/from the virtqueue and the tap(4)
directly without temporary buffers.
A lot of the virtio semantics are cleaned up as well, including
proper error states.
Tested with help by mbuhl@, friehm@, mlarkin@, and others.
"go for it," mlarkin@
|
|
vmd uses a lot of fd passing and does it sometimes via extra abstraction
so this just tries to convert the code without any optimisations.
ok dv@
|
|
Add the instruction length to the vm exit information to allower
vmd(8) to manipulate the instruction pointer after io emulation.
This is preparation for emulating string-based io instructions.
Removes the instruction pointer update from the kernel (vmm(4)) as
well as the instruction length checks, which were overly restrictive
anyways based on the way prefixes work in x86 instructions.
ok mlarkin@
|
|
The logging and the (lack of) errno don't describe the actual reason
a vm fails to start when there are not enough tap(4) special files
in /dev. Improve the log message to specify the tap file in question
and set ENOENT so vmctl(8) gets something other than an undefined
errno value to report.
ok bluhm@
|
|
num_enq was assigned and incremented, but never used. clang started
pointing out via warnings. No functional change.
|
|
During the multi-process rework, I changed the way disk sizes are
calculated, switching to storing bytes and not 512-byte blocks. The
size calculation from reading an iso did not receive the change in
scaling, resulting in the virtio scsi emulation to think iso's are
larger than reality.
This fixes booting the latest Ubuntu amd64 iso's as apparently
there's some program that tries to arbitrarily read the tail end
of the iso into memory.
ok mlarkin@
|
|
For edge-triggered devices, there's no need to deassert an irq given
how vmd(8) emulates a pic. Deassertion grabs a lock and can trigger
the ioctl for toggling pending interrupts causing a race condition.
This results in a storm of vm-exits and guest vcpu becoming
unresponsive.
The original sign of this issue is guest "pauses" when pasting text
into a serial console connection in something like xterm(1).
Tested by mbuhl@, cheloha@, sashan@, kn@, and mlarkin@.
"go for it", mlarkin@
|
|
The logging output from vmd(8) often specifies the function performing
the logging, but leaves which vm or vm device to guesswork and
reading tea leaves.
Change the logging formatting to prefix with information about the
specific vm and potentially the device subprocess. Most of this
logging is behind the "verbose" mode, but for warnings this will
clarify which vm or device logged the warning.
The format of vm/<name>/<device><index> is chosen to be concise and
less ugly than other approaches. This adjusts the process naming
for devices to match, dropping the use of brackets.
In the process of this change, updating log settings dynamically
via vmctl(8) is fixed by properly broadcasting that information to
the device subprocesses. The "vmm" process also now updates its own
state properly, so settings survive vm reboots.
ok mlarkin@
|
|
When vcpu threads pause, they are holding the run mutex lock. If
the event thread is asked to assert an irq on the pic and interrupts
are pending, it will try to take the run mutex lock on the vcpu.
This deadlocks.
Release the lock in the vcpu thread before waiting on the pause
condition variable.
ok mlarkin@
|