generated from rust-vmm/crate-template
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ioctls: Add new MshvError type derived from thiserror::Error #138
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NunoDasNeves
requested review from
russell-islam,
liuw and
jinankjain
as code owners
April 3, 2024 22:46
4 tasks
Signed-off-by: Nuno Das Neves <[email protected]>
NunoDasNeves
force-pushed
the
nudasnev/mshv-error-result-type
branch
4 times, most recently
from
April 3, 2024 23:02
0e0258d
to
9179ab5
Compare
4 tasks
NOTE: All the changes are in the 2nd commit. The first is just |
NunoDasNeves
force-pushed
the
nudasnev/mshv-error-result-type
branch
2 times, most recently
from
April 4, 2024 23:31
2201b51
to
a8468de
Compare
jinankjain
reviewed
Apr 5, 2024
NunoDasNeves
force-pushed
the
nudasnev/mshv-error-result-type
branch
from
April 5, 2024 19:03
a8468de
to
5788a8b
Compare
MshvError allows different kinds of errors to be returned from the library. One intended use is to return details about a failed hypercall from the MSHV_ROOT_HVCALL ioctl, so useful error messages can be printed. Implement from_hvcall for future use with MSHV_ROOT_HVCALL, along with tests. Use into() to convert uses of errno::Error to MshvError. Signed-off-by: Nuno Das Neves <[email protected]>
NunoDasNeves
force-pushed
the
nudasnev/mshv-error-result-type
branch
from
April 5, 2024 22:51
5788a8b
to
ec3c268
Compare
russell-islam
approved these changes
Apr 6, 2024
russell-islam
approved these changes
Apr 6, 2024
jinankjain
approved these changes
Apr 8, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
MshvError allows different kinds of errors to be returned from the
library. One intended use is to return details about a failed hypercall
from the MSHV_ROOT_HVCALL ioctl, so useful error messages can be
printed.
Implement from_hvcall for future use with MSHV_ROOT_HVCALL, along with
tests.
Use into() to convert uses of errno::Error to MshvError.
Summary of the PR
This is a precursor patch to #128.
The only way to debug hypercall failures that result from the IOCTL calls in
mshv-ioctls
today, is to use dmesg and rely on debug printing in the kernel itself.The MshvError type is the first step to solving thism this by allowing
mshv-ioctls
to return either anerrno::Error
or details about a hypercall-related error (hypercall code and status code).This will help users/developers of VMMs identify the root cause of issues more reliably.
This PR introduces a couple of dependencies:
From
andDisplay
traits. Similarly, here it is used to define MshvError.TryFromPrimitive
trait. It is used to convertu16
toenum HvError
. If there is a better way to do this please let me know!Since this PR changes the
Result
type used by mshv-ioctls, it may cause API breakages with other crates. From testing with Cloud Hypervisor, I have only found one, in the vfio-ioctls crate. It is fixed in a backward-compatible manner here: rust-vmm/vfio#44Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s
), and the commit message has max 60 characters for thesummary and max 75 characters for each description line.
test.
Release" section of CHANGELOG.md (if no such section exists, please create one).
unsafe
code is properly documented.