Commit graph

402 commits

Author SHA1 Message Date
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
dependabot[bot]
0073a89bc0 build(deps): bump clap from 4.5.16 to 4.5.17
Bumps [clap](https://github.com/clap-rs/clap) from 4.5.16 to 4.5.17.
- [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.16...clap_complete-v4.5.17)

---
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-09 09:14:21 -07:00
dependabot[bot]
632a492ec7 build(deps): bump serde from 1.0.209 to 1.0.210
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.209 to 1.0.210.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.209...v1.0.210)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-09-09 09:14:00 -07:00
Changyuan Lyu
342e0163f7 feat(blk): io_uring based virtio-blk device
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-08 20:02:17 -07:00
Changyuan Lyu
213e216b48 refactor(blk): split descriptor handler to 2 parts
Parse the descriptor first and then do the IO. The first part can
be reused in an io_uring based implementation.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-08 20:02:17 -07:00
Changyuan Lyu
9a3857f84d fix(blk): flush disk file on FLUSH requests
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-08 20:02:17 -07:00
Changyuan Lyu
e9fe9c82ae fix(virtio): let devices handle hostside io errors
Some devices can report errors to the guest. For example, virtio-blk
can set a non-zero status code in the buffer.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-08 20:02:17 -07:00
Changyuan Lyu
6d1f59925c perf(virtio): replace Vec<QueueSubmit> with Box<[QueueSubmit]>
We never need to push new elements to the vector.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-07 18:23:39 -07:00
Changyuan Lyu
0c4fc4e3ba fix(virtio): monitor eventfds with IORING_OP_POLL_ADD
The extra benefit is that for the waker, we can use
`IORING_POLL_ADD_MULTI` to avoid re-registering the waker.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-07 18:23:39 -07:00
Changyuan Lyu
8968a24bc3 fix(virtio): reset io_uring queue_submits at start up
Otherwise, after guest reboots, `queue_submits` still holds the
states of queues before reboot.

Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-07 18:23:39 -07:00
Changyuan Lyu
798ae4cdf9 refactor(virtio): replace Queues<'m> with [Option<Q>]
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-07 18:23:39 -07:00
Changyuan Lyu
08d4876fef chore: add description to serde-aco-derive
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-02 20:46:22 -07:00
Changyuan Lyu
d574a2c83a chore: bump version to 0.5.0
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-02 20:20:23 -07:00
Changyuan Lyu
1407086c96 fix(virtio): avoid spam of no free entry warnings
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-02 20:17:30 -07:00
Changyuan Lyu
10002f508b feat(net): implement io_uring based virtio device
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-02 15:40:39 -07:00
Changyuan Lyu
648fdf7d44 feat(virtio): io_uring based async IO backend
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-02 15:40:39 -07:00
Changyuan Lyu
0a33defb13 refactor(virtio): separate mio from trait Virtio
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-02 15:40:39 -07:00
Changyuan Lyu
3d416a1f1c refactor(virtio): log device errors in do_work()
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-02 15:40:39 -07:00
Changyuan Lyu
7155249f23 refactor(virtio): add name() to trait Virtio
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
2024-09-02 15:40:39 -07:00