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>
Since these non-standard backend request
message types are confirmed not to be used
anymore, let's just remove them.
```
pub enum BackendReq {
...
/// Virtio-fs draft: map file content into the window.
FS_MAP = 100,
/// Virtio-fs draft: unmap file content from the window.
FS_UNMAP = 1001,
/// Virtio-fs draft: sync file content.
FS_SYNC = 1002,
/// Virtio-fs draft: perform a read/write from an fd directly to GPA.
FS_IO = 1003,
...
}
```
Closes: #213
Signed-off-by: Albert Esteve <aesteve@redhat.com>
New code was added to the `BackendReqHandler` that is not feasible to
test right now. The rest of the code are just definitions.
Signed-off-by: German Maglione <gmaglione@redhat.com>
After updating the CI the coverage value changed causing failures:
Current code coverage (76.33%) deviates by 7.67% from the
previous code coverage 84.00%.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Following vhost-user specification, replace
all uses of master/slave with backend/frontend
in the vhost crate.
Signed-off-by: Albert Esteve <aesteve@redhat.com>
Convert the vhost git repository into a crate, which hosts vhost crate
for now. Support for vhost-user-backend and other crates will be added
later on.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
The InvalidOperation error type covers a wide range of error cases
which can be inscrutable when passed to the user. To help with this
we:
- add a textual reason field to the error message
- create InactiveFeature for use of un-neogitated features
- create InactiveOperation for use of un-negotiated protocol extensions
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
In order to support vhost-user client mode, we introduce a new method
start_client() to VhostUserDaemon. It allows the daemon to connect to
the VMM side running as the server in this case.
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
In order to let the consumer of the crate access directly the file
descriptor related to the VringEpollHandler, we implement the AsRawFd
trait.
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Previous patch causes dramatic code coverage decrease, it actually
disclose some issue in the code coverage test. Then we add test case
to cover VhostUserHandler, it actually increases the code coverage.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
Try to increase code coverage by adding more test code. But it actually
causes dramatic decreases in code coverage:(
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
Fix a bug in SlaveReqHandler::set_config(), it should remove the
message header of the buffer passed to backend.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
There's a wrapper for epoll from vmm-sys-util, so use the wrapper
instead of the epoll crate directly. It may help to ease dependency
management.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
Add new VhostVdpa trait to handle vhost-vdpa devices and a new
vhost-vdpa building feature.
vhost-vdpa devices is based on vhost backend, for this reason
VhostVdpa trait requires VhostBackend.
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Backend::handle_event() takes an argument of `vrings: &[V]` with
`V: VringT`, so methods of VringT should not take `&mut self`.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
Refine the way to manage epoll event id and simplify interfaces:
- Change VhostUserBackend::exit_event() to return Option<EventFd>
instead of Option<(EventFd, u16)>.
- Delete VringEpollHandler::exit_event_id.
- Add VringEpollHandler::register_event/unregister_event for internal
use.
- Make VringEpollHandler::register_listener/unregister_listener() for
external users only, and 'data` range [0..backend.num_queues()] is
reserved for queues and exit event.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
Implement FromRawFd for Listener, using the underlying UnixListener
FromRawFd implementation.
This is useful when the listener socket is inherited as a file
descriptor from a parent (such as libvirt or a jailer).
Signed-off-by: Sergio Lopez <slp@redhat.com>
The coverage test started failing in the following PR:
https://github.com/rust-vmm/vhost/pull/73, which only
modified the codeowners file. It is probably a kcov bug.
Signed-off-by: Laura Loghin <lauralg@amazon.com>
The SET_LOG_BASE implementation was incomplete as it didn't include the
ability to send the shared memory region information along with the file
descriptor.
This is required to perform proper dirty page logging with a vhost-user
device.
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
It is helpful for the consumer of this crate to be able clone and copy
the VringConfigData structure, as well as being able to initialize it
only partially thanks to the Default trait.
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
fix warning, when compiling with 1.53.0
```
warning: reference to packed field is unaligned
--> src/vhost_user/message.rs:252:53
|
252 | unsafe { std::mem::transmute_copy::<u32, R>(&self.request) }
| ^^^^^^^^^^^^^
|
= note: `#[warn(unaligned_references)]` on by default
= warning: this was previously accepted by the compiler but is being
phased out; it will become a hard error in a future release!
= note: for more information, see issue #82523
<https://github.com/rust-lang/rust/issues/82523>
= note: fields of packed structs are not properly aligned, and
creating a misaligned reference is undefined behavior (even if
that reference is never dereferenced)
```
Signed-off-by: wanglei <wllenyj@linux.alibaba.com>
Use `File` or `dyn AsRawFd` instead of `RawFd` to handle ownership
easily.
Fixes#37.
Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
Change-Id: I6c79d73d1a54163d4612b0ca4d30bf7bd53f9b0f
The inflight I/O tracking feature is useful for handling crashes and
disconnections from the backend. It allows the backend to rely on a
buffer that was shared earlier with the VMM to restore to the previous
state it was before the crash.
This feature depends on the availability of the protocol feature
VHOST_USER_PROTOCOL_F_INFLIGHT_SHMFD, and it implements both
VHOST_USER_GET_INFLIGHT_FD and VHOST_USER_SET_INFLIGHT_FD messages.
Fixes#43
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Introduce a new method set_flags() in order to let the caller define the
expected set of flags that should be applied to the header for the
following messages.
Fixes#40
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Adding support for a new message REM_MEM_REG. This command request an
existing memory region to be removed and unmapped from the vhost-user
backend.
It is designed for supporting memory hot-unplug, rather than using
SET_MEM_TABLE, which is less efficient as it would remap all remaining
regions.
It is only available if the protocol feature
VHOST_USER_PROTOCOL_F_CONFIGURE_MEM_SLOTS has been negotiated.
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Add more negative unit test cases to improve code coverage.
Also add two helper functions to simplify code.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>
Upgrade Cargo.toml to rust edition 2018. Also introduce a helper
feature flag "vhost-user" to simplify code.
Signed-off-by: Liu Jiang <gerry@linux.alibaba.com>