Commit Graph

8297 Commits

Author SHA1 Message Date
Ruoqing He
ebfc8df9f0 misc: Allow shared reference to mutable static
We know what we are doing within `tracer` crate, disable lint on these
shared reference to mutable static.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2024-10-20 10:34:49 +00:00
dependabot[bot]
0e209edb1d build: Bump futures-sink from 0.3.30 to 0.3.31
Bumps [futures-sink](https://github.com/rust-lang/futures-rs) from 0.3.30 to 0.3.31.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/futures-rs/compare/0.3.30...0.3.31)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-19 00:29:40 +00:00
Ruoqing He
b708db393d misc: Remove redundant pub keyword of helper functions
Functions marked as `pub` in test module need to be documented. Since
these are literally helper functions and there is no need to be `pub`,
remove these `pub` keywords.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2024-10-18 17:46:39 +00:00
Ruoqing He
416fe5eaac misc: Remove redundant return statement
As clippy of rust-toolchain version 1.83.0-beta.1 suggests, remove
redundant `return` statement to keep code clean.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2024-10-18 17:46:39 +00:00
Ruoqing He
0aab960bf1 misc: Elide needless lifetimes
As clippy of rust-toolchain version 1.83.0-beta.1 suggests, elide
needless lifetimes to `'_`.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2024-10-18 17:46:39 +00:00
Ruoqing He
86315adb23 misc: Use c"" to construct nul-terminated string
As clippy of rust-toolchain version 1.83.0-beta.1 suggests, use `c""` to
construct nul-terminated `CStr`.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2024-10-18 17:46:39 +00:00
Ruoqing He
b41daddce1 misc: Remove manual implementation of is_power_of_two
As clippy of rust-toolchain version 1.83.0-beta.1 suggests, remove
manual implementation of `is_power_of_two` to improve readability.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2024-10-18 17:46:39 +00:00
Ruoqing He
6164aa0885 misc: Replace div_round_up operation with div_ceil
As clippy of rust-toolchain version 1.83.0-beta.1 suggests, replace
manually implemented `div_round_up!` and the like with `div_ceil` from
std.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2024-10-18 17:46:39 +00:00
dependabot[bot]
67fb786c54 build: Bump fastrand from 2.1.0 to 2.1.1
Bumps [fastrand](https://github.com/smol-rs/fastrand) from 2.1.0 to 2.1.1.
- [Release notes](https://github.com/smol-rs/fastrand/releases)
- [Changelog](https://github.com/smol-rs/fastrand/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/fastrand/compare/v2.1.0...v2.1.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-18 16:53:43 +00:00
Rob Bradford
2fa4dc6338 tests: Limit number of test thread on aarch64
This system has a lot of cores (80) resulting in all the tests being
spawned simultaneously and leading to exhaustion of the available
memory. Instead limit the number of threads.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-10-17 19:51:05 +00:00
Rob Bradford
fc0d808205 tests: Adjust test_tpm memory usage
After updating the OS image to the latest jammy version this test now
requires more memory to run

Fixes: #6782

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-10-17 19:51:05 +00:00
Rob Bradford
caf15f0acb tests: Give test_vfio_user more RAM
When running with the newer jammy OS image error messages from Rust
Hypervisor Firmware about lack of ram when rebooting where observed.
Increase the RAM allocation to allow it to boot after a reboot.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-10-17 19:51:05 +00:00
Rob Bradford
b1547c4ccb tests: Update version of Jammy image in use
This version is generated with the new script and adds kexec-tools.

Fixes: #6726

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-10-17 19:51:05 +00:00
Rob Bradford
d2d3ba4ebf docs: Point at custom image build script in documentation
Remove manual steps and replace with a script.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-10-17 19:51:05 +00:00
Rob Bradford
c162494867 scripts: Add a script to automate the custom image construction
Only for x86-64 right now but does include support for custom VFIO
image.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-10-17 19:51:05 +00:00
Rob Bradford
92e48f7cf6 build: Enable new VFIO worker
Based on revert of commit 78ea83d753.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-10-12 19:11:12 +00:00
Rob Bradford
81db2f0233 tests: Update for new VFIO worker
Adjust the VFIO device path and the disk image based on the new VFIO CI
worker.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-10-12 19:11:12 +00:00
Ruoqing He
79ccb25f78 arch: Enable build with kvm feature
Currently `arch` crate cannot be built, by specifying `hypervisor/kvm`
to turn on the features required for its dependency - `hypervisor` crate
to build. Thus enabling `arch` crate to be built with command:

```sh
cargo build -p arch --features kvm
```

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2024-10-12 17:33:12 +00:00
dependabot[bot]
ac97690848 build: Bump once_cell from 1.19.0 to 1.20.2
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.19.0 to 1.20.2.
- [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md)
- [Commits](https://github.com/matklad/once_cell/compare/v1.19.0...v1.20.2)

---
updated-dependencies:
- dependency-name: once_cell
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 14:07:19 +00:00
Rob Bradford
78ea83d753 build: Temporarily remove vfio workflow
This worker is no longer available.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-10-07 14:12:54 +01:00
Alexandru Matei
c891dcb947 vmm: drop device_tree mutex before acquiring pci_bus mutex
AddressManager::move_bar() acquires the device_tree mutex.
The function is called from PciConfigIo::config_space_write()/
PciConfigMmio::config_space_write() while the pci_bus mutex
is acquired.
The functions DeviceManager::pci_resources()/eject_device()
acquire these mutexes in reverse order, which leads to a deadlock.

Fixes: #6775

Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
2024-10-03 12:04:00 +00:00
Ruoqing He
0dc3634b7b ci: Enable clippy::assertions_on_result_states
This lint disallows asserttions on is_ok()/is_err() in favor of either
using unwrap (so that at least if the test fails, we the failure message
will contain the actual failure reason instead of just "was not
ok/err"), or actually matching the specific variant.

Inspired by and quoted from @roypat.

Enable this lint for `build.yaml` and `quality.yaml`.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2024-10-03 12:03:49 +00:00
Ruoqing He
297236a7c0 misc: Eliminate use of assert!((...).is_ok())
Asserting on .is_ok()/.is_err() leads to hard to debug failures (as if
the test fails, it will only say "assertion failed: false". We replace
these with `.unwrap()`, which also prints the exact error variant that
was unexpectedly encountered (we can to this these days thanks to
efforts to implement Display and Debug for our error types). If the
assert!((...).is_ok()) was followed by an .unwrap() anyway, we just drop
the assert.

Inspired by and quoted from @roypat.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2024-10-03 12:03:49 +00:00
dependabot[bot]
83bcf2a1ff build: Bump lazy_static from 1.4.0 to 1.5.0
Bumps [lazy_static](https://github.com/rust-lang-nursery/lazy-static.rs) from 1.4.0 to 1.5.0.
- [Release notes](https://github.com/rust-lang-nursery/lazy-static.rs/releases)
- [Commits](https://github.com/rust-lang-nursery/lazy-static.rs/compare/1.4.0...1.5.0)

---
updated-dependencies:
- dependency-name: lazy_static
  dependency-type: indirect
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-02 23:59:29 +00:00
Rob Bradford
c4baae079c build: Enable ARM64 worker
This is based on a revert of commit
ce49a6f4b8 with some modifications for a
different worker configuration.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-10-02 14:50:39 +00:00
Rob Bradford
19d36c765f scripts: Only download kernel binaries if changed
Only download the kernel binaries from the github release if the remote
file is newer (avoids multiple copies accumulating in the download
directory.)

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-10-02 14:50:39 +00:00
Rob Bradford
8036a2c3de hypervisor: kvm: Expose create_standard_regs() for all architectures
The aarch64 unit tests make use of this.

Fixes commit 3645654c39

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-10-02 14:50:39 +00:00
Rob Bradford
d1c9002c48 vmm: cpu: Fix aarch64 unit test
This fixes commit 2668dbbd8b which changed
the error message.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-10-02 14:50:39 +00:00
dependabot[bot]
fbb21038cb build: Bump zbus from 4.1.2 to 4.4.0
Bumps [zbus](https://github.com/dbus2/zbus) from 4.1.2 to 4.4.0.
- [Release notes](https://github.com/dbus2/zbus/releases)
- [Commits](https://github.com/dbus2/zbus/compare/zbus-4.1.2...zbus-4.4.0)

---
updated-dependencies:
- dependency-name: zbus
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-02 09:36:21 +00:00
Wei Liu
d242ec6879 build: disable vfio-ioctls default features on workspace level
Cargo's features are additive. Disabling default features in individual
packages but not on the workspace level makes no sense.

This fixes the several build warnings.

Fixes: 5a70d7ec69 (build: Centralize rust-vmm crates to workspace)
Signed-off-by: Wei Liu <liuwe@microsoft.com>
2024-10-01 15:59:14 +00:00
dependabot[bot]
966db37f63 build: Bump openssl-src from 300.3.1+3.3.1 to 300.3.2+3.3.2
Bumps [openssl-src](https://github.com/alexcrichton/openssl-src-rs) from 300.3.1+3.3.1 to 300.3.2+3.3.2.
- [Release notes](https://github.com/alexcrichton/openssl-src-rs/releases)
- [Commits](https://github.com/alexcrichton/openssl-src-rs/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-30 23:51:19 +00:00
Songqian Li
ab12e7c294 vmm: fix cargo clippy error for rust 1.77
Since cloning Option<Arc<T>> will clone for Arc<T>, this patch fixes the
follow warning:

warning: this call to `as_ref.map(...)` does nothing
   --> vmm/src/lib.rs:872:13
    |
872 |             self.console_resize_pipe.as_ref().map(Arc::clone),
    |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try: `self.console_resize_pipe.clone()`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_asref
    = note: `#[warn(clippy::useless_asref)]` on by default

Signed-off-by: Songqian Li <sionli@tencent.com>
2024-09-30 08:18:02 +00:00
Songqian Li
33c15ca273 vmm: remove pub use vm_config in config
This patch removes pub import vm_config in config.rs to eliminate
the ambiguity of vm_comfig reference.

Signed-off-by: Songqian Li <sionli@tencent.com>
2024-09-30 08:18:02 +00:00
Ruoqing He
61e57e1cb1 misc: Further improve imports styling
By introducing `imports_granularity="Module"` format strategy,
effectively groups imports from the same module into one line or block,
improving maintainability and readability.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2024-09-29 16:13:48 +00:00
Rob Bradford
9013d8b4ca build: Move cargo fmt check to nightly toolchain via new workflow
Enforcing group_imports="StdExternalCrate" requires using cargo fmt from
the nightly toolchain. Create a new workflow that runs on nightly to run
cargo fmt.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-09-29 13:08:12 +01:00
Rob Bradford
f041c940a7 build: Apply cargo fmt check to fuzz workspace
Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-09-29 13:08:12 +01:00
Rob Bradford
13cf7a1315 build: Make cargo fmt check apply to all packages
Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-09-29 13:08:12 +01:00
Rob Bradford
88a9f79944 misc: Adapt consistent import style formatting
Historically the Cloud Hypervisor coding style has been to ensure that
all imports are ordered and placed in a single group. Unfortunately
cargo fmt has no support for ensuring that all imports are in a single
group so if whitespace lines were added as part of the import statements
then they would only be odered correctly in the group.

By adopting "group_imports="StdExternalCrate" we can enforce a style
where imports are placed in at most three groups for std, external
crates and the crate itself. Choosing a style enforceable by the tooling
reduces the reviewer burden.

Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-09-29 13:08:12 +01:00
BharatNarasimman
6e4aefe66f vmm: Remove console resize for Serial
Serial device doesnt support resize semantics. Setting up the
console resize pipe in the Serial device setup path, overwrites
the setup done as part of virtio-console.

Signed-off-by: BharatNarasimman <bharatn@microsoft.com>
2024-09-28 15:25:08 +00:00
Songqian Li
cc9899e09d vmm: remove unused mutex in api
This patch removes locks in VmCreate request and VmInfo response
since we needn't use a lock here and should ensure that internal
implementation is transparent to the runtime.

Signed-off-by: Songqian Li <sionli@tencent.com>
2024-09-28 14:02:04 +00:00
Songqian Li
7eb70730d1 test_infra: panic when killing with SIGKILL
Killing process with SIGKILL will miss the information since CLH process
needs to end normally to export code coverage information.

Signed-off-by: Songqian Li <sionli@tencent.com>
2024-09-28 13:59:40 +00:00
Songqian Li
0a3ad6153a scripts: add cargo test args for code coverage reports
Add release and target params to `cargo test` since we collect
the code coverage reports from `xx/$BUILD_TARGET/release/`.

Signed-off-by: Songqian Li <sionli@tencent.com>
2024-09-28 13:59:40 +00:00
Songqian Li
9f02839448 scripts: add code coverage script
Fixes: #6507

Signed-off-by: Songqian Li <sionli@tencent.com>
2024-09-28 13:59:40 +00:00
dependabot[bot]
eabbeac9c0 build: Bump instant from 0.1.12 to 0.1.13
Bumps [instant](https://github.com/sebcrozet/instant) from 0.1.12 to 0.1.13.
- [Changelog](https://github.com/sebcrozet/instant/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sebcrozet/instant/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-28 00:00:14 +00:00
Ruoqing He
f436231cba fuzz: Wrap params of FilePair with Arc
The construction of `FilePair` in `virtio_devices` component has changed
in 287887c, wrapping the parameters with `Arc` to fix fuzz build.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2024-09-27 15:58:21 +00:00
Ruoqing He
5a70d7ec69 build: Centralize rust-vmm crates to workspace
Modify `Cargo.toml` in each member crate to follow the dependencies
specified in root `Cargo.toml` file.

Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
2024-09-27 15:58:21 +00:00
dependabot[bot]
ea4be45bb0 build: Bump parking from 2.2.0 to 2.2.1
Bumps [parking](https://github.com/smol-rs/parking) from 2.2.0 to 2.2.1.
- [Release notes](https://github.com/smol-rs/parking/releases)
- [Changelog](https://github.com/smol-rs/parking/blob/master/CHANGELOG.md)
- [Commits](https://github.com/smol-rs/parking/compare/v2.2.0...v2.2.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-27 00:37:05 +00:00
dependabot[bot]
3d73509338 build: Bump landlock from 0.4.0 to 0.4.1 in /fuzz
Bumps [landlock](https://github.com/landlock-lsm/rust-landlock) from 0.4.0 to 0.4.1.
- [Release notes](https://github.com/landlock-lsm/rust-landlock/releases)
- [Changelog](https://github.com/landlock-lsm/rust-landlock/blob/main/CHANGELOG.md)
- [Commits](https://github.com/landlock-lsm/rust-landlock/compare/v0.4.0...v0.4.1)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-27 00:19:59 +00:00
BharatNarasimman
a0ae3ad1df vmm: Pass the newly created console resizer pipe during vm reboot
For a VM with virt-console enabled, when a reboot is requested, the
console devices are closed during the shutdown path. As part of this
the sigwinch listener process and the console resizer pipe are closed.
For the new incarnation of the VM, fresh set of console devices are
setup and a new console resizer pipe is created. The new VM should
be setup to use the newly created console devices including the console
resizer pipe.

Reading from the older console resizer pipe results in unexpected eof
error and terminates the cloud hypervisor process.

Signed-off-by: BharatNarasimman <bharatn@microsoft.com>
2024-09-26 20:06:53 +00:00
Rob Bradford
d90fa96bb7 build: Bulk update vm-memory and related dependencies
Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
2024-09-26 12:31:25 +00:00