-
Notifications
You must be signed in to change notification settings - Fork 70
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
Adding POSTCOPY support #218
Conversation
ecca605
to
9c1e5a3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if this works with operation modes where regions are mapped on demand (Xen grants, for example). But I will let @vireshk comment on that.
Otherwise, I think commit messages are pretty bare-bone. Not everyone (at least not me :)) is an expert on these migration topics so it might help to explain what is happening in more detail.
@germag: This may be related to your work on migration? |
7f856e6
to
6703c5d
Compare
Added musl-tools package. It is needed for `userfaultfd` crate to compile for musl target. The PR that need this: rust-vmm/vhost#218 Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Added musl-tools package. This is required for rust-vmm/vhost#218 which adds the userfaultfd crates fails to compile without this. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Added musl-tools package. This is required for rust-vmm/vhost#218 which adds the userfaultfd crate which fails to compile without this. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Added musl-tools package. This is required for rust-vmm/vhost#218 which adds the userfaultfd crate which fails to compile without this. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
6703c5d
to
588543e
Compare
This version adds musl-tools package which is required for rust-vmm/vhost#218 to compile userfaultfd crate for musl target. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
This version adds musl-tools package which is required for rust-vmm/vhost#218 to compile userfaultfd crate for musl target. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
631868b
to
ae202c0
Compare
ab4a1d3
to
b9e8f0d
Compare
@ShadowCurse did you test the changes of For example, what I usually do is:
|
/cc @stsquad |
91a5e5b
to
17f0ac4
Compare
6329054
to
e63a374
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The typo makes me a bit nervous. It probably results in a no-op for all the builds, or do I miss something here?
Could you elaborate how you tested this? Would it maybe make sense to add automated tests?
25e75b5
to
378fd6c
Compare
Now that we have tests for the new code, maybe we can enable diff --git a/coverage_config_x86_64.json b/coverage_config_x86_64.json
index d201e56..9923e17 100644
--- a/coverage_config_x86_64.json
+++ b/coverage_config_x86_64.json
@@ -1,5 +1,5 @@
{
"coverage_score": 75.0,
"exclude_path": "vhost/src/vhost_kern/",
- "crate_features": "vhost/vhost-user-frontend,vhost/vhost-user-backend"
+ "crate_features": "vhost/vhost-user-frontend,vhost/vhost-user-backend,vhost-user-backend/postcopy"
} I tried it locally and the coverage test passes successfully. |
378fd6c
to
2fdafb6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Nit: there is a little typo in the last commit title (s/coverade/coverage).
2fdafb6
to
67ba79c
Compare
New feature `postcopy` is introduced. It acts as a gate for a new functionality. This feature is not compatible with `xen` feature because `xen` can map memory regions on demand and this does not work with uffd. Now frondned supports sending POSTCOPY messages to the backend. The POSTCOPY messages are only usable when VHOST_USER_PROTOCOL_F_PAGEFAULT feature is negotiated. The messages and their descriptions are: - VHOST_USER_POSTCOPY_ADVISE: When the front-end sends this message to the backend, the back-end must open a userfaultfd for later use and send it's fd to the front-end. - VHOST_USER_POSTCOPY_LISTEN When the back-end receives this message it must ensure that shared memory is registered with userfaultfd to cause faulting of non-present pages. This is always sent sometime after a VHOST_USER_POSTCOPY_ADVISE. - VHOST_USER_POSTCOPY_END When the back-end receives this message it must disable the userfaultfd. The reply is an acknowledgement only. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
This functionality is gated by `postcopy` feature. Now backend supports processing of POSTCOPY messages. This is only available when `xen` feature is not in use. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
New feature `postcopy` is introduced. It acts as a gate for a new functionality. This feature is not compatible with `xen` feature because `xen` can map memory regions on demand and this does not work with uffd. Now backend handler supports processing of POSTCOPY messages. This is only available when `xen` feature is not in use. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Additional tests that trigger postcopy messages handling on both frontend and backend side. To run successfully they need access to /dev/userfaultfd. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
New sections in README files describe what `postcopy` feature enables and the limitation of using it with `xen` feature. Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
Signed-off-by: Egor Lazarchuk <yegorlz@amazon.co.uk>
67ba79c
to
28984d5
Compare
Thanks! |
Summary of the PR
Added ability to use
VHOST_USER_POSTCOPY_ADVISE
,VHOST_USER_POSTCOPY_LISTEN
andVHOST_USER_POSTCOPY_END
messages. This includes sending them from the frontend and processing them on the backend.The
POSTCOPY
messages are only usable whenVHOST_USER_PROTOCOL_F_PAGEFAULT
feature is negotiated.Messages and their descriptions are:
VHOST_USER_POSTCOPY_ADVISE
:When the front-end sends this message to the backend,
the back-end must open a userfaultfd for later use
and send it's fd to the front-end.
VHOST_USER_POSTCOPY_LISTEN
When the back-end receives this message it must ensure
that shared memory is registered with userfaultfd to
cause faulting of non-present pages.
This is always sent sometime after a
VHOST_USER_POSTCOPY_ADVISE
.VHOST_USER_POSTCOPY_END
When the back-end receives this message it must disable the
userfaultfd. The reply is an acknowledgement only.
Requirements
Before submitting your PR, please make sure you addressed the following
requirements:
git commit -s
), and the commitmessage has max 60 characters for the summary 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.