Commit Graph

3627 Commits

Author SHA1 Message Date
Rob Bradford
fb4fe17b52 .github: Add issue template for bug report
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-27 16:43:10 +02:00
Rob Bradford
5d1abec565 resources, scripts: Update aarch64 kernel to 5.12
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-27 11:31:17 +02:00
Muminul Islam
dbd8629fad docs: Fix cpu parameter in networking doc
Signed-off-by: Muminul Islam <muislam@microsoft.com>
2021-04-27 08:47:45 +02:00
Muminul Islam
884d528b31 docs: Auto format networking doc
Signed-off-by: Muminul Islam <muislam@microsoft.com>
2021-04-27 08:47:45 +02:00
William Douglas
767b4f0e59 main: Enable the api-socket to be passed as an fd
To avoid race issues where the api-socket may not be created by the
time a cloud-hypervisor caller is ready to look for it, enable the
caller to pass the api-socket fd directly.

Avoid breaking current callers by allowing the --api-socket path to be
passed as it is now in addition to through the path argument.

Signed-off-by: William Douglas <william.r.douglas@gmail.com>
2021-04-26 14:40:49 -07:00
Rob Bradford
375382cb08 virtio-devices: net: Advertise full set of offload features
This is based on the offload features that can be configured on the tap.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-26 18:40:05 +02:00
Rob Bradford
b945a341b3 net_util: Don't always set the tap offload
Setting the tap offload should only be done based on the features that
are acked by the guest. Therefore it is incorrect to set these upon
opening the tap.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-26 18:40:05 +02:00
Rob Bradford
70e926372a vhost_user_net: Don't advertise offload features
In the reference vhost_user_net backend don't advertise the offload
features. For correctness we should only advertise them if we can set
them when they are acked by the guest.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-26 18:40:05 +02:00
Rob Bradford
f213083386 virtio-devices: net: Set tap offload features based on those negotiated
Configure the tap offload features to match those that the guest has
acknowledged. The function for converting virtio to tap features came
from crosvm:
4786cee521/devices/src/virtio/net.rs (115)

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-26 18:40:05 +02:00
dependabot-preview[bot]
f8803e4639 build(deps): bump dirs from 3.0.1 to 3.0.2
Bumps [dirs](https://github.com/soc/dirs-rs) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/soc/dirs-rs/releases)
- [Commits](https://github.com/soc/dirs-rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-25 19:56:09 +00:00
Anatol Belski
87a4f4ae32 tests: Disable test_windows_* for mshv
It appears that mshv is not yet there to succeed with these tests. It is
suggested to ignore them and enable later one by one as the
functionality gets fixed.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-04-23 17:57:28 +02:00
Rob Bradford
01f0c1e313 vmm: Simplify memory state to support Versionize
In order to support using Versionize for state structures it is necessary
to use simpler, primitive, data types in the state definitions used for
snapshot restore.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-23 14:24:16 +01:00
Rob Bradford
dab1cab4a7 virtio-devices: Simplify device state to support Versionize
In order to support using Versionize for state structures it is necessary
to use simpler, primitive, data types in the state definitions used for
snapshot restore.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-23 14:24:16 +01:00
Rob Bradford
f643ba6111 devices: Simplify device state to support Versionize
In order to support using Versionize for state structures it is necessary
to use simpler, primitive, data types in the state definitions used for
snapshot restore.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-23 14:24:16 +01:00
Anatol Belski
8614a0ab2f doc: Add note on net dev hotplug to windows.md
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-04-23 14:24:04 +01:00
dependabot-preview[bot]
459892e07f build(deps): bump regex from 1.4.5 to 1.4.6
Bumps [regex](https://github.com/rust-lang/regex) from 1.4.5 to 1.4.6.
- [Release notes](https://github.com/rust-lang/regex/releases)
- [Changelog](https://github.com/rust-lang/regex/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/regex/compare/1.4.5...1.4.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-23 07:40:51 +00:00
Anatol Belski
ac3414503c tests: Implement test for net dev hotplug for Windows guest
Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-04-22 11:42:43 -07:00
Rob Bradford
5784285894 net_util: queue_pair: Handle tap write returning EAGAIN/EWOULDBLOCK
If the tap file descriptor is not writable then try again later. Update
the RX side to match the test on std::io::ErrorKind::WouldBlock

Fixes: #2517

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-22 15:58:27 +01:00
Rob Bradford
fd72612e91 tests: Extend test_tap_from_fd to reboot
Check that the VM comes back with the correct network setup after a
reboot.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-22 12:19:01 +02:00
Rob Bradford
da58b65997 virtio-devices: net: Support rebooting when tap fd specfied
Duplicate the fd that is specified in the config so that be used again
after a reboot. When rebooting we destroy all VM state and restore from
the config.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-22 12:19:01 +02:00
dependabot-preview[bot]
55e6dbdb06 build(deps): bump syn from 1.0.69 to 1.0.70 in /fuzz
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.69 to 1.0.70.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.69...1.0.70)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-22 08:26:00 +00:00
dependabot-preview[bot]
dfd109b1c6 build(deps): bump backtrace from 0.3.56 to 0.3.57
Bumps [backtrace](https://github.com/rust-lang/backtrace-rs) from 0.3.56 to 0.3.57.
- [Release notes](https://github.com/rust-lang/backtrace-rs/releases)
- [Commits](https://github.com/rust-lang/backtrace-rs/compare/0.3.56...0.3.57)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-22 06:37:47 +00:00
dependabot-preview[bot]
079a2685dd build(deps): bump micro_http from 49240ce to 9b605a8
Bumps [micro_http](https://github.com/firecracker-microvm/micro-http) from `49240ce` to `9b605a8`.
- [Release notes](https://github.com/firecracker-microvm/micro-http/releases)
- [Commits](49240ce1d5...9b605a8b61)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-22 06:37:37 +00:00
dependabot-preview[bot]
d9bc216870 build(deps): bump syn from 1.0.69 to 1.0.70
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.69 to 1.0.70.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.69...1.0.70)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-22 06:37:25 +00:00
Rob Bradford
c82226fdae pci: vfio: Naturally align the PCI BAR allocation
The PCI bar should be naturally aligned i.e. aligned to the size of the
bar itself.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-21 16:11:54 +01:00
Rob Bradford
bfc65bff2a virtio-devices: transport: Naturally align capability PCI bar
The PCI bar should be naturally aligned i.e. aligned to the size of the
bar itself.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-21 16:11:54 +01:00
Sebastien Boeuf
0b00442022 vmm: acpi: Allow reading from B0EJ field
Windows guests read this field upon PCI device ejection. Let's make sure
we don't return an error as this is valid. We simply return an empty u32
since the ejection is done right away upon write access, which means
there's no pending ejection that might be reported to the guest.

Here is the error that was shown during PCI device removal:

ERROR:vmm/src/device_manager.rs:3960 -- Accessing unknown location at
base 0x7ffffee000, offset 0x8

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-04-21 16:11:54 +01:00
Sebastien Boeuf
7c457378e5 pci: Fix BAR reprogramming detection logic
The logic wasn't quite right, as it wasn't detecting BAR reprogramming
when the upper part of the address was identical. For instance, a BAR
moved from 0x7fc0000000 to 0x7fd0000000 wasn't detected properly.

The logic has been updated and cleaned up to fix this issue, which was
observed when running Windows guests. This fixes the network hotplug
support as well.

Fixes #1797
Fixes #1798

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-04-21 16:11:54 +01:00
Sebastien Boeuf
3d06657f06 resources: Update Dockerfile to Ubuntu Focal Fossa
In order to avoid possible issues with Bionic Beaver (18.04) as it's
getting old, we move the CI container to Focal Fossa (20.04).

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-04-21 14:51:23 +02:00
Rob Bradford
a7c4483b8b vmm: Directly (de)serialise CpuManager, DeviceManager and MemoryManager state
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-20 18:58:37 +02:00
Rob Bradford
85f7913bb3 virtio-devices: pci_device: Deserialise section directly to state
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-20 18:58:37 +02:00
Rob Bradford
08c4e5031f vm-migration: Support (de)serialising SnapshotDataSection directly
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-20 18:58:37 +02:00
Bo Chen
78796f96b7 vmm: Refine the granularity of dirty memory tracking
Instead of tracking on a block level of 64 pages, we are now collecting
dirty pages one by one. It improves the efficiency of dirty memory
tracking while live migration.

Signed-off-by: Bo Chen <chen.bo@intel.com>
2021-04-19 17:17:14 +02:00
Michael Zhao
4c299c6c00 vmm: Update 'micro_http' crate branch to 'main'
The master branch of 'micro_http' crate was renamed to 'main'.

Signed-off-by: Michael Zhao <michael.zhao@arm.com>
2021-04-19 15:47:54 +01:00
dependabot-preview[bot]
5b75c57cc4 build(deps): bump vcpkg from 0.2.11 to 0.2.12
Bumps [vcpkg](https://github.com/mcgoo/vcpkg-rs) from 0.2.11 to 0.2.12.
- [Release notes](https://github.com/mcgoo/vcpkg-rs/releases)
- [Changelog](https://github.com/mcgoo/vcpkg-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mcgoo/vcpkg-rs/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-16 21:42:09 +00:00
Rob Bradford
0c1c8881ef virtio-devices, block_util: Automatically serialized packed structs
With current serde_derive it is possible to #[derive(Serialize)] on
packed structures if they implement Copy. This allows the removal of the
manual equivalent code.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-16 13:27:03 +01:00
dependabot-preview[bot]
40035a6067 build(deps): bump iced-x86 from 1.11.0 to 1.11.1 in /fuzz
Bumps [iced-x86](https://github.com/icedland/iced) from 1.11.0 to 1.11.1.
- [Release notes](https://github.com/icedland/iced/releases)
- [Commits](https://github.com/icedland/iced/compare/v1.11.0...v1.11.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-16 09:16:15 +00:00
dependabot-preview[bot]
126e37e3c8 build(deps): bump zerocopy-derive from 0.2.0 to 0.2.1
Bumps zerocopy-derive from 0.2.0 to 0.2.1.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-16 09:16:05 +00:00
dependabot-preview[bot]
b0da4f3a5e build(deps): bump micro_http from 59ab644 to 49240ce
Bumps [micro_http](https://github.com/firecracker-microvm/micro-http) from `59ab644` to `49240ce`.
- [Release notes](https://github.com/firecracker-microvm/micro-http/releases)
- [Commits](59ab64440a...49240ce1d5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-16 07:00:27 +00:00
dependabot-preview[bot]
156653ff1c build(deps): bump iced-x86 from 1.11.0 to 1.11.1
Bumps [iced-x86](https://github.com/icedland/iced) from 1.11.0 to 1.11.1.
- [Release notes](https://github.com/icedland/iced/releases)
- [Commits](https://github.com/icedland/iced/compare/v1.11.0...v1.11.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2021-04-15 16:36:38 +00:00
Sebastien Boeuf
b92fe648e9 vmm: cpu: Disable KVM_FEATURE_ASYNC_PF_INT in CPUID
By disabling this KVM feature, we prevent the guest from using APF
(Asynchronous Page Fault) mechanism. The kernel has recently switched to
using interrupts to notify about a page being ready, but for some
reasons, this is causing unexpected behavior with Cloud Hypervisor, as
it will make the vcpu thread spin at 100%.

While investigating the issue, it's better to disable the KVM feature to
prevent 100% CPU usage in some cases.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-04-15 10:08:45 +01:00
Wei Liu
d4eaf746b5 vm-device: bus: drop the interrupt function
It is not used anywhere.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2021-04-13 14:18:14 +01:00
Wei Liu
810ed7e887 vmm: interrupt: drop unnecessary type from impl
The original code had a generic type E. It was later replaced by a
concrete type. The code should have been simplified when the replacement
happened.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2021-04-13 14:18:14 +01:00
Rob Bradford
86e4067437 vmm: config: Reject reserved fd from network config
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-13 14:29:18 +02:00
Rob Bradford
e0c0d0e142 vmm: config: Validate network configuration
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-13 14:29:18 +02:00
Alyssa Ross
37a2c13a90 docs: use relative links between cloud-hypervisor docs
This way, the links can be navigated locally, not just on GitHub.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
2021-04-13 10:57:44 +01:00
Jianyong Wu
740994542a Update memory layout to accommodate uefi on arm64.
For now, memory layout on arm64 is sparse and is conflict with uefi.
Here, we do some rearrangement to let it compact and compatible with
uefi support.

Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2021-04-13 09:00:36 +02:00
Bo Chen
99694cf5c1 tests: Simplify 'test_memory_mergeable'
We now reply on the value from '/sys/kernel/mm/ksm/shared_pages' to
validate our "--memory mergeable=on|off" option. For `mergeable=on`,
we are expecting to see more 'shared_pages' reported by the kernel when
we start more VMs with this option. For `mergeable=off`, we are
expecting the 'shared_pages' value to be always 0, as we are assuming
the rest of the system (in our CI) is not using mergeable memory.

Fixes: #2138

Signed-off-by: Bo Chen <chen.bo@intel.com>
2021-04-13 09:00:00 +02:00
Rob Bradford
17072e9a6f vmm: seccomp: Add missing SYS_newfstatat
This is used when running on a new libc like Fedora34.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-04-12 18:02:29 +02:00
Anatol Belski
e1cc702327 memory_manager: Fix address range calculation in MemorySlot
The MCRS method returns a 64-bit memory range descriptor. The
calculation is supposed to be done as follows:

max = min + len - 1

However, every operand is represented not as a QWORD but as combination
of two DWORDs for high and low part. Till now, the calculation was done
this way, please see also inline comments:

max.lo = min.lo + len.lo //this may overflow, need to carry over to high
max.hi = min.hi + len.hi
max.hi = max.hi - 1 // subtraction needs to happen on the low part

This calculation has been corrected the following way:

max.lo = min.lo + len.lo
max.hi = min.hi + len.hi + (max.lo < min.lo) // check for overflow
max.lo = max.lo - 1 // subtract from low part

The relevant part from the generated ASL for the MCRS method:
```
Method (MCRS, 1, Serialized)
{
    Acquire (MLCK, 0xFFFF)
    \_SB.MHPC.MSEL = Arg0
    Name (MR64, ResourceTemplate ()
    {
	QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
	    0x0000000000000000, // Granularity
	    0x0000000000000000, // Range Minimum
	    0xFFFFFFFFFFFFFFFE, // Range Maximum
	    0x0000000000000000, // Translation Offset
	    0xFFFFFFFFFFFFFFFF, // Length
	    ,, _Y00, AddressRangeMemory, TypeStatic)
    })
    CreateQWordField (MR64, \_SB.MHPC.MCRS._Y00._MIN, MINL)  // _MIN: Minimum Base Address
    CreateDWordField (MR64, 0x12, MINH)
    CreateQWordField (MR64, \_SB.MHPC.MCRS._Y00._MAX, MAXL)  // _MAX: Maximum Base Address
    CreateDWordField (MR64, 0x1A, MAXH)
    CreateQWordField (MR64, \_SB.MHPC.MCRS._Y00._LEN, LENL)  // _LEN: Length
    CreateDWordField (MR64, 0x2A, LENH)
    MINL = \_SB.MHPC.MHBL
    MINH = \_SB.MHPC.MHBH
    LENL = \_SB.MHPC.MHLL
    LENH = \_SB.MHPC.MHLH
    MAXL = (MINL + LENL) /* \_SB_.MHPC.MCRS.LENL */
    MAXH = (MINH + LENH) /* \_SB_.MHPC.MCRS.LENH */
    If ((MAXL < MINL))
    {
	MAXH += One /* \_SB_.MHPC.MCRS.MAXH */
    }

    MAXL -= One
    Release (MLCK)
    Return (MR64) /* \_SB_.MHPC.MCRS.MR64 */
}
```

Fixes #1800.

Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
2021-04-12 16:20:19 +02:00