Commit Graph

4621 Commits

Author SHA1 Message Date
Rob Bradford
3480e69ff5 vmm: Cache whether io_uring is supported in DeviceManager
Probing for whether the io_uring is supported is time consuming so cache
this value if it is known to reduce the cost for secondary block devices
that are added.

Before:

cloud-hypervisor: 3.988896ms: <vmm> INFO:vmm/src/device_manager.rs:1901 -- Creating virtio-block device: DiskConfig { path: Some("/home/rob/workloads/focal-server-cloudimg-amd64-custom-20210609-0.raw"), readonly: false, direct: false, iommu: false, num_queues: 1, queue_size: 128, vhost_user: false, vhost_socket: None, poll_queue: true, rate_limiter_config: None, id: Some("_disk0"), disable_io_uring: false, pci_segment: 0 }
cloud-hypervisor: 14.129591ms: <vmm> INFO:vmm/src/device_manager.rs:1983 -- Using asynchronous RAW disk file (io_uring)
cloud-hypervisor: 14.159853ms: <vmm> INFO:vmm/src/device_manager.rs:1901 -- Creating virtio-block device: DiskConfig { path: Some("/tmp/disk"), readonly: false, direct: false, iommu: false, num_queues: 1, queue_size: 128, vhost_user: false, vhost_socket: None, poll_queue: true, rate_limiter_config: None, id: Some("_disk1"), disable_io_uring: false, pci_segment: 0 }
cloud-hypervisor: 22.110281ms: <vmm> INFO:vmm/src/device_manager.rs:1983 -- Using asynchronous RAW disk file (io_uring)

After:

cloud-hypervisor: 4.880411ms: <vmm> INFO:vmm/src/device_manager.rs:1916 -- Creating virtio-block device: DiskConfig { path: Some("/home/rob/workloads/focal-server-cloudimg-amd64-custom-20210609-0.raw"), readonly: false, direct: false, iommu: false, num_queues: 1, queue_size: 128, vhost_user: false, vhost_socket: None, poll_queue: true, rate_limiter_config: None, id: Some("_disk0"), disable_io_uring: false, pci_segment: 0 }
cloud-hypervisor: 14.105123ms: <vmm> INFO:vmm/src/device_manager.rs:1998 -- Using asynchronous RAW disk file (io_uring)
cloud-hypervisor: 14.134837ms: <vmm> INFO:vmm/src/device_manager.rs:1916 -- Creating virtio-block device: DiskConfig { path: Some("/tmp/disk"), readonly: false, direct: false, iommu: false, num_queues: 1, queue_size: 128, vhost_user: false, vhost_socket: None, poll_queue: true, rate_limiter_config: None, id: Some("_disk1"), disable_io_uring: false, pci_segment: 0 }
cloud-hypervisor: 14.221869ms: <vmm> INFO:vmm/src/device_manager.rs:1998 -- Using asynchronous RAW disk file (io_uring)

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-12 18:09:55 +00:00
Sebastien Boeuf
6a7a588268 tests: Add integration test for CPU affinity
This new integration test validates the vCPUs are running on the
expected set of CPUs on the host.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-11-12 09:40:37 +00:00
Sebastien Boeuf
932c8c9713 vmm: Add CPU affinity support
With the introduction of a new option `affinity` to the `cpus`
parameter, Cloud Hypervisor can now let the user choose the set
of host CPUs where to run each vCPU.

This is useful when trying to achieve CPU pinning, as well as making
sure the VM runs on a specific NUMA node.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-11-12 09:40:37 +00:00
Sebastien Boeuf
a4f5ad6076 option_parser: Fix inner bracket support with list of integers
Give the option parser the ability to handle tuples with inner brackets
containing list of integers. The following example can now be handled
correctly "option=[key@[v1-v2,v3,v4]]" which means the option is
assigned a tuple with a key associated with a list of integers between
the range v1 - v2, as well as v3 and v4.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-11-12 09:40:37 +00:00
Ziye Yang
be79a80361 docs: Update vhost-user-blk-testing.md
The purpose is to add more info while running
spdk vhost tgt. For example, adding more info
(total_size, block_size) to describe the meaning
on creating malloc bdev inside spdk vhost tgt.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
2021-11-12 09:40:29 +00:00
dependabot[bot]
34edb8960f build: bump zerocopy from 0.6.0 to 0.6.1
Bumps zerocopy from 0.6.0 to 0.6.1.

---
updated-dependencies:
- dependency-name: zerocopy
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-11 23:35:57 +00:00
dependabot[bot]
83af9965fa build: bump cc from 1.0.71 to 1.0.72
Bumps [cc](https://github.com/alexcrichton/cc-rs) from 1.0.71 to 1.0.72.
- [Release notes](https://github.com/alexcrichton/cc-rs/releases)
- [Commits](https://github.com/alexcrichton/cc-rs/compare/1.0.71...1.0.72)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-11 00:07:19 +00:00
dependabot[bot]
f7e60434fa build: bump cc from 1.0.71 to 1.0.72 in /fuzz
Bumps [cc](https://github.com/alexcrichton/cc-rs) from 1.0.71 to 1.0.72.
- [Release notes](https://github.com/alexcrichton/cc-rs/releases)
- [Commits](https://github.com/alexcrichton/cc-rs/compare/1.0.71...1.0.72)

---
updated-dependencies:
- dependency-name: cc
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-10 23:35:50 +00:00
Wei Liu
a4d8616676 arch: x86_64: tdx: drop one unsafe call in code
Implement Default trait for TdvfDescriptor and drop one unsafe in code.

No functional change.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
2021-11-10 17:46:21 +01:00
dependabot[bot]
38351f0d96 build: bump vfio-ioctls from fa3438f to 3c45864
Bumps [vfio-ioctls](https://github.com/rust-vmm/vfio-ioctls) from `fa3438f` to `3c45864`.
- [Release notes](https://github.com/rust-vmm/vfio-ioctls/releases)
- [Commits](fa3438f8f2...3c45864aa6)

---
updated-dependencies:
- dependency-name: vfio-ioctls
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-10 10:29:03 +00:00
dependabot[bot]
3587adcf5f build: bump vfio-ioctls from 8f7f221 to fa3438f
Bumps [vfio-ioctls](https://github.com/rust-vmm/vfio-ioctls) from `8f7f221` to `fa3438f`.
- [Release notes](https://github.com/rust-vmm/vfio-ioctls/releases)
- [Commits](8f7f2210eb...fa3438f8f2)

---
updated-dependencies:
- dependency-name: vfio-ioctls
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-10 09:43:12 +00:00
Sebastien Boeuf
611e71826d deps: Downgrade anyhow
Because anyhow version 1.0.46 has been yanked, let's move back to the
previous version 1.0.45.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-11-10 09:43:12 +00:00
Sebastien Boeuf
ed52e5c029 clippy: Remove useless code
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-11-10 10:23:43 +01:00
Sebastien Boeuf
c8e3c1eed6 clippy: Make sure to initialize data
Always properly initialize vectors so that we don't run in undefined
behaviors when the vector gets dropped.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-11-10 10:23:43 +01:00
Sebastien Boeuf
ad521fd4e4 option_parser: Create generic type Tuple
Creates a new generic type Tuple so that the same implementation of
FromStr trait can be reused for both parsing a list of two integers and
parsing a list of one integer associated with a list of integers.

This anticipates the need for retrieving sublists, which will be needed
when trying to describe the host CPU affinity for every vCPU.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-11-09 08:59:59 +01:00
Sebastien Boeuf
e4cbafcd01 option_parser: Handle inner brackets
In case we want to implement a type that would hold a list of lists, we
need the option parser to be able to ignore the commas for multiple
layers of brackets.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-11-09 08:59:59 +01:00
Sebastien Boeuf
b81d758c41 option_parser: Expect commas instead of colons for lists
The elements of a list should be using commas as the correct delimiter
now that it is supported. Deprecate use of colons as delimiter.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-11-09 08:59:59 +01:00
Sebastien Boeuf
184a3d1fb5 option_parser: Extend option parsing for lists
While parsing each parameter for getting the list of option/value, we
check if the value is a list separated between brackets. If that's the
case, we reconstruct the list so that it can be parsed afterwards, even
though it uses commas for separating each value.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
2021-11-09 08:59:59 +01:00
dependabot[bot]
d3b2f2a4d9 build: bump libc from 0.2.106 to 0.2.107 in /fuzz
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.106 to 0.2.107.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.106...0.2.107)

---
updated-dependencies:
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-09 00:18:39 +00:00
dependabot[bot]
a362e85539 build: bump anyhow from 1.0.45 to 1.0.46
Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.45 to 1.0.46.
- [Release notes](https://github.com/dtolnay/anyhow/releases)
- [Commits](https://github.com/dtolnay/anyhow/compare/1.0.45...1.0.46)

---
updated-dependencies:
- dependency-name: anyhow
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-08 23:34:03 +00:00
Fabiano Fidêncio
9a583e6e9f rpm: Introduce using_musl_libc definition
While some distros support `musl` libc as a rust target, some others
(such as RHEL) definitely don't (at least not installing distro
packages).

Knowing this, let's have a simple way to not have a hard dependency on
musl on our spec file.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2021-11-08 22:57:08 +00:00
Fabiano Fidêncio
a628854d9c rpm: Introduce using_rustup definition
`using_rustup` is needed as distros (such as Fedora or RHEL) don't
provide the users a way to install`rustup` without conflicting with the
distro provided `rust` package.

In order to minimize the troubles for those who want to build
cloud-hypervisor using the distros packages, let's allow the users to
change that variable and then simply rely on their system packages.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2021-11-08 22:57:08 +00:00
Fabiano Fidêncio
7618cd2c2d rpm: Document basic assumptions
Let's document the most basic assumptions about the RPM spec file we
maintain for cloud-hypervisor, being those:
* You must have access to the internet during build, otherwise pulling
  the vendored code down won't work.
* You must have rustup installed on your system, otherwise basic checks
  performed during the build target will fail.
* You must have both gnu and musl libc targets installed, otherwise
  either the dynamically or the statically link build will fail.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2021-11-08 22:57:08 +00:00
Rob Bradford
eae4b315e4 acpi_tables: aml: Replace use of Vec::append with Vec::extend_from_slice
Avoid removing from the source vector by using Vec::extend_from_slice().
The primitive values (bytes) will be copied from the source in either
case.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
c1a3b63112 acpi_tables: aml: Use Aml::append_aml_bytes()
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
751e76db08 vmm: acpi: Use Aml::append_aml_bytes() to generate DSDT
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
d96d98d88e vmm: Port DeviceManager to Aml::append_aml_bytes()
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
185f0c1bf3 vmm: Port MemoryManager to Aml::append_aml_bytes()
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
e04cbb2ad4 vmm: Port PciSegment to Aml::append_aml_bytes()
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
986e43f899 vmm: cpu: Port CpuManager to Aml::append_aml_bytes()
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
a7786b4e0c devices: acpi: Port GED device to Aml::append_aml_bytes()
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
def371e969 acpi_tables: aml: Implement Aml::append_aml_bytes() for CreateField
For now it still relies on Aml::to_aml_bytes() for the children as not
all structures have been ported.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
72d4d2c6f0 acpi_tables: aml: Implement Aml::append_aml_bytes() for Buffer
For now it still relies on Aml::to_aml_bytes() for the children as not
all structures have been ported.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
99467982aa acpi_tables: aml: Implement Aml::append_aml_bytes() for MethodCall
For now it still relies on Aml::to_aml_bytes() for the children as not
all structures have been ported.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
6172b6aac5 acpi_tables: aml: Implement Aml::append_aml_bytes() for !binary_op macro
For now it still relies on Aml::to_aml_bytes() for the children as not
all structures have been ported.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
9cddcc8766 acpi_tables: aml: Implement Aml::append_aml_bytes() for While
For now it still relies on Aml::to_aml_bytes() for the children as not
all structures have been ported.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
d2319124f5 acpi_tables: aml: Implement Aml::append_aml_bytes() for Notify
For now it still relies on Aml::to_aml_bytes() for the children as not
all structures have been ported.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
24fd54401d acpi_tables: aml: Implement Aml::append_aml_bytes() for Release
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
9256c41173 acpi_tables: aml: Implement Aml::append_aml_bytes() for Acquire
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
b1d4bcf952 acpi_tables: aml: Implement Aml::append_aml_bytes() for Mutex
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
8b7bfca9b0 acpi_tables: aml: Implement Aml::append_aml_bytes() for Store
For now it still relies on Aml::to_aml_bytes() for the children as not
all structures have been ported.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
7da69b59f7 acpi_tables: aml: Implement Aml::append_aml_bytes() for Local
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
50b6ee3947 acpi_tables: aml: Implement Aml::append_aml_bytes() for Arg
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
c0ca6b5377 acpi_tables: aml: Implement Aml::append_aml_bytes() for LessThan
For now it still relies on Aml::to_aml_bytes() for the predicates as not
all structures have been ported.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
8c9f0e407f acpi_tables: aml: Implement Aml::append_aml_bytes() for Equal
For now it still relies on Aml::to_aml_bytes() for the predicates as not
all structures have been ported.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
29f46ee470 acpi_tables: aml: Implement Aml::append_aml_bytes() for If
For now it still relies on Aml::to_aml_bytes() for the children as not
all structures have been ported.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
f3e86bdf26 acpi_tables: aml: Implement Aml::append_aml_bytes() for OpRegion
As it relies on primitive types that have already been ported
Aml::append_aml_bytes can be used for the child values.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
311dd7be50 acpi_tables: aml: Implement Aml::append_aml_bytes() for Field
Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
bfd3deac7c acpi_tables: aml: Implement Aml::append_aml_bytes() for Return
For now it still relies on Aml::to_aml_bytes() for the child as not all
structures have been ported.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00
Rob Bradford
1a35d5a017 acpi_tables: aml: Implement Aml::append_aml_bytes() for Method
For now it still relies on Aml::to_aml_bytes() for the children as not
all structures have been ported.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
2021-11-08 16:46:30 +00:00