Commit graph

420 commits

Author SHA1 Message Date
dependabot[bot]
34d71f3420 build(deps): bump the patches group with 4 updates
Bumps the patches group with 4 updates: [serde](https://github.com/serde-rs/serde), [proc-macro2](https://github.com/dtolnay/proc-macro2), [syn](https://github.com/dtolnay/syn) and [zerocopy](https://github.com/google/zerocopy).


Updates `serde` from 1.0.210 to 1.0.213
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.210...v1.0.213)

Updates `proc-macro2` from 1.0.88 to 1.0.89
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.88...1.0.89)

Updates `syn` from 2.0.82 to 2.0.85
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.82...2.0.85)

Updates `zerocopy` from 0.8.6 to 0.8.7
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.8.6...v0.8.7)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patches
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patches
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patches
- dependency-name: zerocopy
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patches
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 07:51:59 -07:00
Changyuan Lyu
3ef3eb0985 fix(vfio): open the iommu device as read-only
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-27 23:38:27 -07:00
Changyuan Lyu
7d158564f7 docs: mark supporting legacy VFIO API as done
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-27 23:20:39 -07:00
Changyuan Lyu
a8e87c6869 fix(vfio): handle the flag NORESIZE of an IRQ
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-27 23:20:39 -07:00
Changyuan Lyu
2cbd394f93 feat(vfio): building devices from legacy VFIO API
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-27 23:20:39 -07:00
Changyuan Lyu
2bb4de20e7 feat(vfio): add parameter type for legacy VFIO API
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-27 23:20:39 -07:00
Changyuan Lyu
c33baf4c61 feat(vfio): let VfioPciDev::new take a generic Device
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-27 23:20:39 -07:00
Changyuan Lyu
339fb32e6e refactor(vfio): let VfioPciDev::new take a configured device
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-27 23:20:39 -07:00
Changyuan Lyu
727d081e21 feat(vfio): allow specifying the path to iommu dev
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-27 23:20:39 -07:00
Changyuan Lyu
a4d915ce60 feat(vfio): add Group and Container
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-27 23:20:39 -07:00
Changyuan Lyu
ed76bde07b feat(vfio): add bindings for legacy VFIO APIs
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-27 23:20:39 -07:00
Changyuan Lyu
ab304a4b60 refactor(vfio): move device ioctls to a trait
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-27 23:20:39 -07:00
Changyuan Lyu
e30be1f41e fix(cdev): ignore detach calls if not attached yet
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-27 23:20:39 -07:00
Changyuan Lyu
08385387c4 refactor(vfio): remove generic parameters from Cdev and Ioas
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-27 23:20:39 -07:00
Changyuan Lyu
e58f221f62 fix(pvh): check if the alignment is a power of 2
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-23 00:42:17 -07:00
Changyuan Lyu
fd0f2d826f fix: let align_up/align_down take number of bits
It ensures that the alignment is always a power of 2.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-23 00:42:17 -07:00
dependabot[bot]
ff2b65832e build(deps): bump the patches group with 2 updates
Bumps the patches group with 2 updates: [syn](https://github.com/dtolnay/syn) and [flexi_logger](https://github.com/emabee/flexi_logger).


Updates `syn` from 2.0.80 to 2.0.82
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.80...2.0.82)

Updates `flexi_logger` from 0.29.3 to 0.29.4
- [Changelog](https://github.com/emabee/flexi_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/emabee/flexi_logger/commits)

---
updated-dependencies:
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patches
- dependency-name: flexi_logger
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patches
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-21 08:05:32 -07:00
Changyuan Lyu
cd9bb82519 docs: update README
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-20 18:33:25 -07:00
Changyuan Lyu
f2dd1f9f79 feat(balloon): implement inflate queue
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-20 18:33:25 -07:00
Changyuan Lyu
4313406fa0 feat(balloon): implement free page reporting
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-20 18:33:25 -07:00
Changyuan Lyu
cc3d28c112 feat(virtio): skeleton of a balloon device
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-20 00:15:51 -07:00
Changyuan Lyu
01b3485a6e refactor(virtio): simplify method parameters of trait VirtioMio
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-19 22:15:29 -07:00
Changyuan Lyu
d2b2490ac6 refactor(virtio): remove activate_dev from trait Backend
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-19 22:15:29 -07:00
Changyuan Lyu
33df84a4ca refactor(virtio): add a new trait ActiveBackend
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-19 22:15:29 -07:00
dependabot[bot]
f9cb2634f9 build(deps): bump the patches group with 5 updates
Bumps the patches group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [proc-macro2](https://github.com/dtolnay/proc-macro2) | `1.0.87` | `1.0.88` |
| [syn](https://github.com/dtolnay/syn) | `2.0.79` | `2.0.80` |
| [zerocopy](https://github.com/google/zerocopy) | `0.8.5` | `0.8.6` |
| [libc](https://github.com/rust-lang/libc) | `0.2.159` | `0.2.161` |
| [io-uring](https://github.com/tokio-rs/io-uring) | `0.7.0` | `0.7.1` |


Updates `proc-macro2` from 1.0.87 to 1.0.88
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.87...1.0.88)

Updates `syn` from 2.0.79 to 2.0.80
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.79...2.0.80)

Updates `zerocopy` from 0.8.5 to 0.8.6
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/commits)

Updates `libc` from 0.2.159 to 0.2.161
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.161/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.159...0.2.161)

Updates `io-uring` from 0.7.0 to 0.7.1
- [Commits](https://github.com/tokio-rs/io-uring/commits)

---
updated-dependencies:
- dependency-name: proc-macro2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patches
- dependency-name: syn
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patches
- dependency-name: zerocopy
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patches
- dependency-name: libc
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patches
- dependency-name: io-uring
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: patches
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-19 19:56:23 -07:00
Changyuan Lyu
73f540f513 chore: group dependabot PRs
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-19 18:35:15 -07:00
dependabot[bot]
0ce7db8610
build(deps): bump zerocopy from 0.7.35 to 0.8.5
Bumps [zerocopy](https://github.com/google/zerocopy) from 0.7.35 to 0.8.5.
- [Release notes](https://github.com/google/zerocopy/releases)
- [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md)
- [Commits](https://github.com/google/zerocopy/compare/v0.7.35...v0.8.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-19 18:06:08 -07:00
dependabot[bot]
8d89963dfa build(deps): bump proc-macro2 from 1.0.86 to 1.0.87
Bumps [proc-macro2](https://github.com/dtolnay/proc-macro2) from 1.0.86 to 1.0.87.
- [Release notes](https://github.com/dtolnay/proc-macro2/releases)
- [Commits](https://github.com/dtolnay/proc-macro2/compare/1.0.86...1.0.87)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-19 11:14:07 -07:00
dependabot[bot]
944175e6a9 build(deps): bump clap from 4.5.19 to 4.5.20
Bumps [clap](https://github.com/clap-rs/clap) from 4.5.19 to 4.5.20.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.19...clap_complete-v4.5.20)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-19 11:13:59 -07:00
dependabot[bot]
6f61cd6630 build(deps): bump flexi_logger from 0.29.1 to 0.29.3
Bumps [flexi_logger](https://github.com/emabee/flexi_logger) from 0.29.1 to 0.29.3.
- [Changelog](https://github.com/emabee/flexi_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/emabee/flexi_logger/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-19 11:13:49 -07:00
dependabot[bot]
d70cc985b4 ci: bump actions/cache from 4.1.0 to 4.1.1
Bumps [actions/cache](https://github.com/actions/cache) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](2cdf405574...3624ceb22c)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-19 11:13:35 -07:00
dependabot[bot]
e27bd2779b ci: bump actions/checkout from 4.2.0 to 4.2.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.2.0 to 4.2.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](d632683dd7...eef61447b9)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-19 11:13:17 -07:00
dependabot[bot]
1e20ed37a5 build(deps): bump flexi_logger from 0.29.0 to 0.29.1
Bumps [flexi_logger](https://github.com/emabee/flexi_logger) from 0.29.0 to 0.29.1.
- [Changelog](https://github.com/emabee/flexi_logger/blob/main/CHANGELOG.md)
- [Commits](https://github.com/emabee/flexi_logger/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 21:42:04 -07:00
dependabot[bot]
115fc1368d ci: bump actions/cache from 4.0.2 to 4.1.0
Bumps [actions/cache](https://github.com/actions/cache) from 4.0.2 to 4.1.0.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](0c45773b62...2cdf405574)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 21:41:53 -07:00
dependabot[bot]
a7f14485c0 build(deps): bump clap from 4.5.18 to 4.5.19
Bumps [clap](https://github.com/clap-rs/clap) from 4.5.18 to 4.5.19.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.18...clap_complete-v4.5.19)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-07 21:41:43 -07:00
Changyuan Lyu
acdfb5dbca fix(virtio): monitor ioeventfds with IORING_OP_POLL_ADD
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-10-06 23:05:45 -07:00
dependabot[bot]
bc40ba6c71 build(deps): bump io-uring from 0.6.4 to 0.7.0
Bumps [io-uring](https://github.com/tokio-rs/io-uring) from 0.6.4 to 0.7.0.
- [Commits](https://github.com/tokio-rs/io-uring/commits)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-30 10:02:08 -07:00
dependabot[bot]
e4b394f1b5 build(deps): bump snafu from 0.8.4 to 0.8.5
Bumps [snafu](https://github.com/shepmaster/snafu) from 0.8.4 to 0.8.5.
- [Changelog](https://github.com/shepmaster/snafu/blob/main/CHANGELOG.md)
- [Commits](https://github.com/shepmaster/snafu/compare/0.8.4...0.8.5)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-30 09:14:45 -07:00
dependabot[bot]
1e093d54fe build(deps): bump libc from 0.2.158 to 0.2.159
Bumps [libc](https://github.com/rust-lang/libc) from 0.2.158 to 0.2.159.
- [Release notes](https://github.com/rust-lang/libc/releases)
- [Changelog](https://github.com/rust-lang/libc/blob/0.2.159/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/libc/compare/0.2.158...0.2.159)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-30 08:31:21 -07:00
dependabot[bot]
85abf140c1 build(deps): bump syn from 2.0.77 to 2.0.79
Bumps [syn](https://github.com/dtolnay/syn) from 2.0.77 to 2.0.79.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/2.0.77...2.0.79)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-30 08:31:01 -07:00
dependabot[bot]
236fbd6143 ci: bump actions/checkout from 4.1.7 to 4.2.0
Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.7 to 4.2.0.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](692973e3d9...d632683dd7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-30 08:30:39 -07:00
dependabot[bot]
be920927f6 build(deps): bump clap from 4.5.17 to 4.5.18
Bumps [clap](https://github.com/clap-rs/clap) from 4.5.17 to 4.5.18.
- [Release notes](https://github.com/clap-rs/clap/releases)
- [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md)
- [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.17...clap_complete-v4.5.18)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-23 07:29:04 -07:00
Changyuan Lyu
95b9d5f9dd fix(virtio): monitor the waker with IORING_OP_POLL_ADD
With `IORING_POLL_ADD_MULTI`, we do not need to re-add the waker
to the ring.

Commit 0c4fc4e3ba also used IORING_OP_POLL_ADD for ioeventfds, which
was problematic because POLL_ADD does not clear the internal counter
of an eventfd when it creates a cqe. So once an ioeventfd is re-added
to the ring, it immediately generates a new cqe, despite that there is
no new MMIO yet. This causes the event loop thread to spin.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-16 10:16:26 -07:00
Changyuan Lyu
5659cd29f5 Revert "fix(virtio): monitor eventfds with IORING_OP_POLL_ADD"
This reverts commit 0c4fc4e3ba.

It causes 100% CPU usage while io_uring is enabled.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-15 23:19:09 -07:00
Changyuan Lyu
1177f32dfe Revert "perf(net): deregister tap from poll while handling events"
This reverts commit f365429dff.

It causes 100% CPU usage.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-15 23:15:51 -07:00
Changyuan Lyu
f365429dff perf(net): deregister tap from poll while handling events
virtio-net benchmark data (io_ops/sec) with neper/tcp_rr

AMD
     | before    | after
 ----|-----------|----------
  TX | 48710.859 | 55276.65
  RX | 48285.602 | 55761.6

Intel
     | before    | after
 ----|-----------|-----------
  TX | 38647.308 | 46642.882
  RX | 39126.857 | 47304.954

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-15 15:20:42 -07:00
Changyuan Lyu
b306c1a7b2 perf(virtio): send 1 interrupt in a single loop
virtio-net benchmark data (Gbits/sec) with iperf3

AMD
     | before | after
 ----|--------|-------
  TX | 53.77  | 55.64
  RX | 49.18  | 57.6

Intel
     | before | after
 ----|--------|-------
  TX | 37.68  | 36.32
  RX | 44.17  | 47.07

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-15 15:20:42 -07:00
Changyuan Lyu
608fb13e3d test(kvm): use 2-MiB page in the guest
Not all processors support 1-GiB page.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-11 23:41:58 -07:00
Changyuan Lyu
8291ce5f90 fix(kvm): calculate correct mask for 64bit MMIO
1u64.wrapping_shl(64) returns 1 instead of 0. Without the fix, for 64bit
MMIO, the mask is 0 instead of u64::MAX.

Fixes: c988169b27 ("fix(kvm): clear the high part of mmio write values")
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-11 18:29:21 -07:00
dependabot[bot]
48b1f36ac1 build(deps): bump bitfield from 0.16.1 to 0.17.0
Bumps [bitfield](https://github.com/dzamlo/rust-bitfield) from 0.16.1 to 0.17.0.
- [Changelog](https://github.com/dzamlo/rust-bitfield/blob/master/CHANGELOG.md)
- [Commits](https://github.com/dzamlo/rust-bitfield/compare/v0.16.1...v0.17.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-09 09:14:29 -07:00