Commit Graph

6820 Commits

Author SHA1 Message Date
Rob Bradford
26974c7625 vm-virtio: Add MMIO transport
Derived from the crosvm code at 5656c124af2bb956dba19e409a269ca588c685e3
and adapted to work within cloud-hypervisor:

Main differences:

* Interrupt handling is done via a VirtioInterrupt turned into a
devices::Interrupt
* GuestMemory -> GuestMemoryMmap
* Differences in read/write for BusDevice
* Different crates for EventFd and GuestAddress

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-13 12:30:13 +01:00
Rob Bradford
c042483953 build: make PCI (virtio and vfio) disableable at build time
Although included by default it is now possible to build without PCI
support.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-13 12:30:13 +01:00
Rob Bradford
6d27ac9dfc vmm: Allow the DeviceManager to inject extra kernel commandline entries
This is useful for virtio-mmio to be able to provide the commandline
entries for the devices.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-13 12:30:13 +01:00
Rob Bradford
3df1680888 devices: Require Interrupt trait implementations to support Sync
This is necesary to be able easily translate an Interrupt to a
VirtioInterrupt which is already Sync.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-13 12:30:13 +01:00
Sebastien Boeuf
f5a44ea1ad docs: Explain how to create a custom Clear Linux cloud image
This is a quick guide on how to create a custom Clear Linux image based
on the official tooling provided by Clear Linux. If for any reason, the
image we are using is missing some interesting bundles that are packaged
by Clear Linux, this documentation will be the guide on how to proceed.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-11 19:13:29 +02:00
Sebastien Boeuf
e950aa6b9a ci: Reduce integration testing time
By relying on a decompressed image, this patch assumes that downloading
the image will always be faster than decompressing it from the worker
VM.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-11 06:41:01 +02:00
Rob Bradford
05b5115e67 vmm: Call DeviceManager's register_devices() on creation
Rather than calling it at the very start of the VM execution (i.e. when
the VCPUs are created) do it as part of the DeviceManager creation.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-10 20:04:00 +02:00
Rob Bradford
7edc46f492 vmm: Make virtio device creation independent of PCI
Create the virtio devices independently of adding them to the PCI bus.
Instead accrue the devices in a vector and add them to the bus en-masse.
This will allow the virtio device creation to be used independently of
PCI based transport.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-10 09:41:53 -07:00
Sebastien Boeuf
7c6ef7fd63 ci: Add integration test for virtio-vsock
This patch extends the current set of integration tests to correctly
validate that virtio-vsock is functional. It establishes a communication
between host and guest relying on the newly integrated vsock device.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-10 17:57:49 +02:00
Sebastien Boeuf
bf37b960ec ci: Rely on custom Clear Linux cloud image
Rely on the newly generated Clear Linux image for the integration
testing of cloud-hypervisor. The image has been generated using the
Clear Linux clr-installer tooling, which means it is in compliance with
the Clear Linux licensing.

This new image contains one more bundle that was not part of the default
cloudguest image. This bundle is basic-sysadmin, and contains both nc
and socat utilities.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-10 17:57:49 +02:00
Sebastien Boeuf
4d86359a09 ci: Install socat on the host VM
In order to interact between host and guest through socket connection,
socat is a useful utility needed for integration testing.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-10 17:57:49 +02:00
Sebastien Boeuf
5e5c2f2c48 ci: Allow tests to print some useful information with println
In order to make the tests more verbose and help identify more quickly
where a test might be failing, this patch adds the ability for the unit
tests to print useful information with println.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-10 16:33:12 +01:00
Sebastien Boeuf
a9b2207bcf ci: Allow threads to send ssh commands
The goal here is to decouple the Guest instance from the ssh connection
to send some commands to the guest. The reason being to allow ssh
commands to be issued from a different thread, which can be useful to
wait for the end of a command with a thread.join().

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-10 17:29:23 +02:00
Samuel Ortiz
40fc6c3f0f README: Update rust-hypervisor-firmware link
We should use the 0.2.0 firmware.

Fixes: #258

Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-09-10 08:39:50 +01:00
Rob Bradford
389f9e3779 tests: Check that the test binary cleanly terminated
As part of the reboot test check that the binary cleanly terminated
after the subsequent shutdown.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-09 08:24:34 -07:00
Rob Bradford
8f37dec498 vmm: "close" the SIGWINCH signal handler
Rather than sending a signal to the signal handler used for handling
SIGWINCH calls instead use the crate provided termination method. This
also unregisters the signal handler which also means that there won't be
a leaked signal handler remaining.

This leaked signal handler is what was causing a failure to cleanup up
the thread on subsequent requests breaking two reboots in a row.

Fixes: #252

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-09 15:42:26 +02:00
dependabot-preview[bot]
c00b58de9b build(deps): bump pkg-config from 0.3.15 to 0.3.16
Bumps [pkg-config](https://github.com/rust-lang/pkg-config-rs) from 0.3.15 to 0.3.16.
- [Release notes](https://github.com/rust-lang/pkg-config-rs/releases)
- [Changelog](https://github.com/rust-lang/pkg-config-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/pkg-config-rs/compare/0.3.15...0.3.16)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-09 12:48:05 +00:00
dependabot-preview[bot]
5f752dade7 build(deps): bump serde from 1.0.99 to 1.0.100
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.99 to 1.0.100.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.99...v1.0.100)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-09 08:17:00 +00:00
dependabot-preview[bot]
8e7d67fcfe build(deps): bump vmm-sys-util from 8703cfd to 07ef2e2
Bumps [vmm-sys-util](https://github.com/rust-vmm/vmm-sys-util) from `8703cfd` to `07ef2e2`.
- [Release notes](https://github.com/rust-vmm/vmm-sys-util/releases)
- [Commits](8703cfd427...07ef2e280e)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-09 08:16:31 +00:00
dependabot-preview[bot]
b515d48eca build(deps): bump cc from 1.0.42 to 1.0.45
Bumps [cc](https://github.com/alexcrichton/cc-rs) from 1.0.42 to 1.0.45.
- [Release notes](https://github.com/alexcrichton/cc-rs/releases)
- [Commits](https://github.com/alexcrichton/cc-rs/compare/1.0.42...1.0.45)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-09 08:15:49 +00:00
Rob Bradford
eb46aa2b22 vmm: If acpi feature is disabled make "reboot" shutdown
With ACPI disabled there is no way to support both reset and shutdown so
make the VMM exit if the VM is rebootet (via i8042 or triple-fault
reset.)

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-06 11:03:44 -07:00
Sebastien Boeuf
7975394901 vm-virtio: vsock: Port unit testing from Firecracker
This unit testing porting effort is based off of Firecracker commit
1e1cb6f8f8003e0bdce11d265f0feb23249a03f6

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-06 10:51:25 -07:00
Sebastien Boeuf
5a3472847d vm-virtio: vsock: Implement VsockEpollHandler
This is the last step connecting the dots between the virtio-vsock
device and the bulk of the logic hosted in the unix and csm modules.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-06 10:51:25 -07:00
Sebastien Boeuf
475e487ac3 vmm: Create vsock backend
This commit relies on the new vsock::unix module to create the backend
that will be used from the virtio-vsock device.

The concept of backend is interesting here as it would allow for a vhost
kernel backend to be plugged if that was needed someday.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-06 10:51:25 -07:00
Sebastien Boeuf
434a5d0edf vm-virtio: vsock: Port submodule unix from Firecracker
This code porting is based off of Firecracker commit
1e1cb6f8f8003e0bdce11d265f0feb23249a03f6

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-06 10:51:25 -07:00
Sebastien Boeuf
df61a8fea2 vm-virtio: vsock: Port submodule csm and packet from Firecracker
This code porting is based off of Firecracker commit
1e1cb6f8f8003e0bdce11d265f0feb23249a03f6

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-06 10:51:25 -07:00
Sebastien Boeuf
22f91ab3a2 vm-virtio: Move vsock to its own module
There is a lot of code related to this virtio-vsock hybrid
implementation, that's why it's better to keep it under its
own module.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-06 10:51:25 -07:00
Sebastien Boeuf
4ccc81fdf9 vmm: Create virtio-vsock device
Based on previous patch introducing the new flag "--vsock", this commit
creates a new virtio-vsock device based on the presence of this flag.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-06 10:51:25 -07:00
Sebastien Boeuf
11e7ece9f5 vmm: Add new flag "--vsock"
The new flag vsock is meant to be used in order to create a VM with a
virtio-vsock device attached to it. Two parameters are needed with this
device, "cid" representing the guest context ID, and "sock" representing
the UNIX socket path which can be accessed from the host.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-06 10:51:25 -07:00
Sebastien Boeuf
c48ca61417 vm-virtio: Add virtio-vsock skeleton
This is the first commit introducing the support for virtio-vsock.

This is based off of Firecracker commit
1e1cb6f8f8003e0bdce11d265f0feb23249a03f6

Fixes #102

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-06 10:51:25 -07:00
Sebastien Boeuf
69e27288a2 vmm: Allocate enough MSI-X vectors for multiqueue virtio devices
The default number of MSI-X vector allocated was 2, which is the minimum
defined by the virtio specification. The reason for this minimum is that
virtio needs at least one interrupt to signal that configuration changed
and at least one to specify something happened regarding the virtqueues.

But this current implementation is not optimal because our VMM supports
as many MSI-X vectors as allowed by the MSI-X specification (2048 max).
For that reason, the current patch relies on the number of virtqueues
needed by the virtio device to determine the right amount of MSI-X
vectors needed. It's important not to forget the dedicated vector for
any configuration change too.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2019-09-06 10:51:25 -07:00
Rob Bradford
d2db34edf2 vmm: Hide underlying console setup from VM
Refactor the underlying console details into the DeviceManager and
abstract away.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-06 09:26:37 -07:00
Rob Bradford
d089ee4e25 vmm: Move ownership of the exit/reset EventFd to Vm structure
It makes more sense there as it is used by more than just the
DeviceManager.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-06 09:26:37 -07:00
Rob Bradford
2f4de81175 vmm: Access ioapic/io_bus/mmio_bus from DeviceManager via accessor
This paves the way for introducing a trait for the DeviceManager.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-06 09:26:37 -07:00
Rob Bradford
9ac967e3d8 vmm: Split DeviceManager into it's own file
Refactor out DeviceManager into it's own file. This is part of a bigger
effort to reduce complexity in the vm.rs file but will also allow future
separation to allow making PCI support optional.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-06 09:26:37 -07:00
dependabot-preview[bot]
f740a3568d build(deps): bump getrandom from 0.1.11 to 0.1.12
Bumps [getrandom](https://github.com/rust-random/getrandom) from 0.1.11 to 0.1.12.
- [Release notes](https://github.com/rust-random/getrandom/releases)
- [Changelog](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-random/getrandom/compare/v0.1.11...v0.1.12)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-06 14:07:55 +00:00
dependabot-preview[bot]
e21bc972b0 build(deps): bump vmm-sys-util from fd4dcd1 to 8703cfd
Bumps [vmm-sys-util](https://github.com/rust-vmm/vmm-sys-util) from `fd4dcd1` to `8703cfd`.
- [Release notes](https://github.com/rust-vmm/vmm-sys-util/releases)
- [Commits](fd4dcd172e...8703cfd427)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-06 06:37:14 +00:00
dependabot-preview[bot]
d446a8217a build(deps): bump blake2b_simd from 0.5.7 to 0.5.8
Bumps [blake2b_simd](https://github.com/oconnor663/blake2_simd) from 0.5.7 to 0.5.8.
- [Release notes](https://github.com/oconnor663/blake2_simd/releases)
- [Commits](https://github.com/oconnor663/blake2_simd/compare/0.5.7...0.5.8)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-05 18:41:53 +00:00
dependabot-preview[bot]
2432ad07ea build(deps): bump cc from 1.0.41 to 1.0.42
Bumps [cc](https://github.com/alexcrichton/cc-rs) from 1.0.41 to 1.0.42.
- [Release notes](https://github.com/alexcrichton/cc-rs/releases)
- [Commits](https://github.com/alexcrichton/cc-rs/compare/1.0.41...1.0.42)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-05 16:41:42 +00:00
Rob Bradford
9661e8da5d build: Really make the acpi feature disableable
The command "cargo build --no-default-features" does not recursively
disable the default features across the workspace. Instead add an acpi
feature at the top-level, making it default, and then make that feature
conditional on all the crate acpi features.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-05 08:58:47 -07:00
Samuel Ortiz
7688e6e231 release-notes: Add table of contents
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-09-05 16:47:12 +02:00
Samuel Ortiz
d784ac2982 release-notes: Add v0.2.0 notes
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
2019-09-05 16:47:12 +02:00
Cathy Zhang
8c2a9a75ec vm-virtio: Update backend feature set for vhost-user-net
Regarding vhost-user-net, there are features in avail_features
and acked_features, like VIRTIO_NET_F_MAC which is required by
driver and device to transfer mac address through config space,
but not needed by backend, like ovs+dpdk, so it's necessary to
adjust backend_features based on acked_features before calling
set_features() API.

This fix is to record backend_features in vhost-user-net to avoid
requesting it twice.

Signed-off-by: Cathy Zhang <cathy.zhang@intel.com>
2019-09-05 07:11:58 -07:00
Cathy Zhang
b8622b5c69 vm-virtio: Address event count error and refactor data setting
New event is added in VhostUserEpollHandler for vhost-user fs,
but the total event count is not update accordingly. Fix the
issue and refactor the event data setting for new event
expansion in the future.

Signed-off-by: Cathy Zhang <cathy.zhang@intel.com>
2019-09-05 07:11:58 -07:00
Rob Bradford
fe9398fe87 scripts: Fix integration tests script
Running the integration test script showed the following error:

+ '[' '!' -f /home/rob/workloads/virtiofsd
scripts/run_integration_tests.sh: line 84: [: missing `]'
+ -f /home/rob/workloads/vubridge ']'
scripts/run_integration_tests.sh: line 84: -f: command not found

This was preventing the test from reusing build QEMU artifacts.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-05 13:13:50 +02:00
Rob Bradford
1f06c5907f Revert "vmm, tests: Disable reboot support"
This reverts commit 8308e1bf25.
2019-09-05 10:38:14 +01:00
Rob Bradford
5dd675710b vmm: Call munmap() on regions that have been mmap()ed
For virtio-fs and virtio-pmem regions of memory are manually mapped into
the address space of the VMM. In order to cleanly reboot we need to
unmap those regions.

Fixes: #223

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-05 10:38:14 +01:00
dependabot-preview[bot]
037807f949 build(deps): bump backtrace from 0.3.36 to 0.3.37
Bumps [backtrace](https://github.com/rust-lang/backtrace-rs) from 0.3.36 to 0.3.37.
- [Release notes](https://github.com/rust-lang/backtrace-rs/releases)
- [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.36...0.3.37)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-04 20:41:39 +00:00
dependabot-preview[bot]
47ca277690 build(deps): bump backtrace from 0.3.35 to 0.3.36
Bumps [backtrace](https://github.com/rust-lang/backtrace-rs) from 0.3.35 to 0.3.36.
- [Release notes](https://github.com/rust-lang/backtrace-rs/releases)
- [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.35...0.3.36)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-09-04 16:53:46 +00:00
Rob Bradford
f59cad15a3 vmm: Cleanup signal_handler thread used for console SIGWINCH handling
Do this by using the same mechanism as the vCPU threads by sending a
signal to the thread. As this is the same mechanism reuse the same code
and rename the "vcpus" member to "threads" to indicate this represents
both the vCPU threads and also the signal handler thread.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2019-09-04 09:21:01 -07:00