Update vm-sys-util crate from 0.12.1 to 0.14.0. Also, bump vm-memory to
latest 0.16.2 which uses that vmm-sys-util version.
Signed-off-by: Babis Chalios <bchalios@amazon.es>
For use in QEMU, I would like GuestMemoryRegion to return a BitmapSlice
instead of a &Bitmap. This adds some flexibility that QEMU needs in
order to support a single global dirty bitmap that is sliced by the
various GuestMemoryRegions.
However, this removes access to the BitmapReplace trait, because it is of
course not possible to replace a slice of the bitmap only. Fortunately,
vhost is built around the GM<> type alias, which has a pluggable bitmap
type but hardcodes the backend:
type GM<B> = GuestMemoryAtomic<GuestMemoryMmap<B>>;
and therefore `region` is known to be a GuestRegionMmap. Adding a
single dereference of the GuestRegionMmap returns the MmapRegion to
which the bitmap is attached, thus calling MmapRegion::bitmap() instead
of <GuestRegionMmap as GuestRegion>::bitmap().
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Our CI is being upgraded to Rust 1.85 and this will produce new warnings
from clippy like this one:
error: this `map_or` can be simplified
--> vhost/src/vhost_kern/mod.rs:79:12
|
79 | if GuestAddress(config_data.desc_table_addr)
| ____________^
80 | | .checked_add(desc_table_size)
81 | | .map_or(true, |v| !m.address_in_range(v))
| |_____________________________________________________^
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_map_or
= note: `-D clippy::unnecessary-map-or` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_map_or)]`
help: use is_none_or instead
|
79 ~ if GuestAddress(config_data.desc_table_addr)
80 + .checked_add(desc_table_size).is_none_or(|v| !m.address_in_range(v))
|
Apply the advice using `cargo clippy --fix`.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
New clippy version in the CI highlighted some code to improve.
This patch is generated using `clippy --fix ...`.
Fixed 2 type of warnings:
1 - error: the following explicit lifetimes could be elided: 'a
--> vhost-user-backend/src/bitmap.rs:109:6
|
109 | impl<'a> WithBitmapSlice<'a> for BitmapMmapRegion {
2 - error: unnecessary closure used to substitute value for `Option::None`
--> vhost-user-backend/src/handler.rs:356:21
|
356 | let vring = self
| _____________________^
357 | | .vrings
358 | | .get(index as usize)
359 | | .ok_or_else(|| VhostUserError::InvalidParam)?;
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Add frontend support of `VHOST_GET_SHARED_OBJECT` message
to request a file descriptor from the backend.
Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
Add support for the `VHOST_USER_GET_SHARED_OBJECT` request
in the backend. The GET_SHARED_OBJECT message is only usable
when VhostUserProtocolFeatures::SHARED_OBJECT feature is
negotiated. This support involves implementing a new method
`get_shared_object` to enable the frontend to retrieve a fd
from the backend about shared objects. When the frontend
sends this `GET_SHARED_OBJECT` message to the backend, the
backend opens a fd for use, and sends it's fd to the frontend.
The implementation of the `get_shared_object` method is
optional, and ensure that the function `get_shared_object`
returns an error if the backend does not implement it.
If the back-end supports shared objects, it should return
a `File` representing the fd.
Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
The reply header call is moved outside the match
statement to ensure consistent reply header usage
in both success and error cases of postcopy_advice.
This change fixes an issue where the reply header
was not being used in the error case of postcopy_advice.
Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
Every time I do a release I notice this difference between
changelogs in this workspace, so let's try to uniform them by using
the form used in vhost-user-backend: without square brackets in the
title of the release and the `v` as prefix (v0.0.0).
Also fixed some difference in how we link PRs, let's follow the
most used way: [[#000]](url)
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This release adds support for `VHOST_USER_RESET_DEVICE` and
updates vm-memory to 0.16.0 and virtio-queue to 0.13.0.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This release adds support for `VHOST_USER_RESET_DEVICE` and
updates vm-memory to 0.16.0 and virtio-queue to 0.13.0.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This version got yanked because the `gpu_socket` feature introduced
in this release was causing problems
(see [#265](https://github.com/rust-vmm/vhost/issues/265)).
Starting with the next version (v0.16.1), the `gpu_socket`
feature was removed.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This version got yanked because the `gpu_socket` feature introduced
in this release was causing problems
(see [#265](https://github.com/rust-vmm/vhost/issues/265)).
Starting with the next version (v0.12.1), the `gpu_socket`
feature was removed.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Added mostly for being able to add a reasonable test to
vhost-user-backend/tests/vhost-user-server.rs.
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Add an associated const to MockVhostBackend that reflects the feature
bits it supports, so we can easily verify this value in other places.
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Handle RESET_DEVICE messages by disabling all vrings and resetting the
device state (but retaining the protocol state, i.e. the negotiated
protocol flags) as per the specification.
Just like all other protocol features, support for this is not
auto-announced, but back-end implementations must actively decide to do
so in their protocol_features() implementation.
Back-end implementation can define their own reset_device() handler to
reset additional device state, if necessary.
Signed-off-by: Hanna Czenczek <hreitz@redhat.com>
Remove the gpu-socket feature just introduced, since it doesn't work
well with cargo feature unification.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Remove the gpu-socket feature just introduced, since it doesn't work
well with cargo feature unification.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
relax the requirement of the trait when implementing
the `set_gpu_socket` method, make the `set_gpu_socket`
method optional, and ensure that the function `set_gpu_socket`
returns an error if the backend does not implement it.
Fixes#265
Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
Remove conditional compilation because when multiple crates
that are in thesame workspace set different features,
cargo feature unification already defeats the purpose of
the `gpu-socket` feature flag since cargo merges all the
feature flags specified by dependent crates into a single
set when compiling shared dependencies. for reference see:
[feature-unification](https://doc.rust-lang.org/cargo/reference/features.html#feature-unification)
Fixes: #265
Signed-off-by: Dorinda Bassey <dbassey@redhat.com>
By centralizing rust-vmm crates to workspace root, effectively reduce
places to look around when updating dependencies manually.
Signed-off-by: Ruoqing He <heruoqing@iscas.ac.cn>
It can be useful to debug the various address mappings sent to a vhost
user device backend. impl Debug for both the postcopy and non-postcopy
versions of AddrMapping.
Signed-off-by: Tyler Fanelli <tfanelli@redhat.com>
cargo recently complains about our cargo configuration file name:
$ cargo build
warning: `vhost/.cargo/config` is deprecated in favor of
`config.toml`
note: if you need to support cargo 1.38 or earlier, you can
symlink `config` to `config.toml`
As suggested, let's update the file name. We don't create the symlink
since 2021 edition is not supported by 1.38 toolchain:
$ cargo +1.38.0 build
error: failed to parse manifest at `vhost/Cargo.toml`
Caused by:
failed to parse the `edition` key
Caused by:
supported edition values are `2015` or `2018`, but `2021` is unknown
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
This release has the following changes:
1. Move the set of event_idx property from set_vring_base callback to set_features one
2. Add shared objects support
3. Add support for `VHOST_USER_GPU_SET_SOCKET`
4. Update virtio-queue version from 0.12.0 to 0.13.0 and vm-memory from 0.14.0 to 0.15.0.
Signed-off-by: Muminul Islam <muislam@microsoft.com>
This release has the following changes:
1. Bump vm-memory crate from 0.14.0 to 0.15.0
2. Add shared objects support
3. Remove support for FS_* requests
4. Add support for `VHOST_USER_GPU_SET_SOCKET`
5. Ignore unknown bits in `VHOST_USER_GET_PROTOCOL_FEATURES` response.
Signed-off-by: Muminul Islam <muislam@microsoft.com>
The latest toolchain update in rust-vmm-ci increased the coverage,
causing the following CI error:
Current code coverage (78.40%) deviates by 5.36% from the previous code
coverage 73.04%
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
The new clippy in rust-vmm-ci complain about this:
error: unnecessary use of `get(&uuid.uuid).is_some()`
--> vhost/src/vhost_user/frontend_req_handler.rs:393:36
|
393 | if self.shared_objects.get(&uuid.uuid).is_some() {
| ^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace it with: `contains(&uuid.uuid)`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_get_then_check
= note: `-D clippy::unnecessary-get-then-check` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::unnecessary_get_then_check)]`
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
The new clippy in rust-vmm-ci complain about this:
error: doc list item missing indentation
--> vhost/src/vhost_user/connection.rs:305:9
|
305 | /// In other words, recvmsg() operations must not cross the packet boundary, other...
| ^
|
= help: if this is supposed to be its own paragraph, add a blank line
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#doc_lazy_continuation
= note: `-D clippy::doc-lazy-continuation` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::doc_lazy_continuation)]`
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
The new clippy in rust-vmm-ci complain about this:
error: match can be simplified with `.unwrap_or_default()`
--> vhost/src/vhost_user/connection.rs:138:20
|
138 | let rfds = match fds {
| ____________________^
139 | | Some(rfds) => rfds,
140 | | _ => &[],
141 | | };
| |_________^ help: replace it with: `fds.unwrap_or_default()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_unwrap_or_default
= note: `-D clippy::manual-unwrap-or-default` implied by `-D warnings`
= help: to override `-D warnings` add `#[allow(clippy::manual_unwrap_or_default)]`
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
The latest toolchain update in rust-vmm-ci caused the following
error:
error: unexpected `cfg` condition value: `cargo-clippy`
--> vhost/src/vhost_user/message.rs:758:16
|
758 | #[cfg_attr(feature = "cargo-clippy", allow(clippy::useless_conversion))]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
As suggested in [1], today is no longer needed to check the
`cargo-clippy` feature (which has been deprecated), but we can
just use `#[allow(clippy::lint_name)]`.
[1] https://blog.rust-lang.org/2024/02/28/Clippy-deprecating-feature-cargo-clippy.html
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>