Skip to content
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

Add support for vhost device input v1 #561

Merged
merged 2 commits into from
Dec 7, 2023

Conversation

Leo-Yan
Copy link
Contributor

@Leo-Yan Leo-Yan commented Nov 30, 2023

Summary of the PR

This patch set is to add vhost backend for emulation input device.

Requirements

Before submitting your PR, please make sure you addressed the following
requirements:

  • All commits in this PR are signed (with git commit -s), and the commit
    message has max 60 characters for the summary and max 75 characters for each
    description line.
  • All added/changed functionality has a corresponding unit/integration
    test.
  • All added/changed public-facing functionality has entries in the "Upcoming
    Release" section of CHANGELOG.md (if no such section exists, please create one).
  • Any newly added unsafe code is properly documented.

Copy link
Contributor

@Ablu Ablu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some early feedback :). Nothing extraordinary...

vhost-device-input/CHANGELOG.md Outdated Show resolved Hide resolved
vhost-device-input/Cargo.toml Outdated Show resolved Hide resolved
vhost-device-input/README.md Outdated Show resolved Hide resolved
vhost-device-input/src/main.rs Outdated Show resolved Hide resolved
vhost-device-input/src/main.rs Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Show resolved Hide resolved
@epilys epilys marked this pull request as draft November 30, 2023 19:12
vhost-device-input/CHANGELOG.md Outdated Show resolved Hide resolved
vhost-device-input/Cargo.toml Outdated Show resolved Hide resolved
vhost-device-input/Cargo.toml Outdated Show resolved Hide resolved
vhost-device-input/Cargo.toml Outdated Show resolved Hide resolved
vhost-device-input/src/main.rs Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Outdated Show resolved Hide resolved
@Leo-Yan Leo-Yan force-pushed the add_spport_vhost_device_input_v1 branch 3 times, most recently from ea09275 to 6d8fc1a Compare December 3, 2023 13:48
Copy link
Contributor

@Ablu Ablu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments, mostly on Error handling. But I think overall it looks fairly good already :).

vhost-device-input/src/main.rs Show resolved Hide resolved
vhost-device-input/src/main.rs Outdated Show resolved Hide resolved
vhost-device-input/src/main.rs Outdated Show resolved Hide resolved
vhost-device-input/src/main.rs Outdated Show resolved Hide resolved

for handle in handles {
handle.join().map_err(|_| Error::FailedJoiningThreads)??;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, when reconsidering the suggestion to use a thread::scope was not super great here... You would still need to manually .join() in order to report the error properly. That said, I am a bit confused about the error that you ran into...

But lets just keep the code as you had it initially. We probably need some helper to terminate threads as soon any thread fails... But that is out of scope for this PR of course.

vhost-device-input/src/vhu_input.rs Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Show resolved Hide resolved
@epilys epilys changed the title Add spport vhost device input v1 Add support for vhost device input v1 Dec 4, 2023
vhost-device-input/Cargo.toml Outdated Show resolved Hide resolved
vhost-device-input/src/input.rs Outdated Show resolved Hide resolved
vhost-device-input/src/main.rs Outdated Show resolved Hide resolved
vhost-device-input/src/main.rs Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Outdated Show resolved Hide resolved
@epilys epilys marked this pull request as ready for review December 4, 2023 10:43
@Leo-Yan Leo-Yan force-pushed the add_spport_vhost_device_input_v1 branch 4 times, most recently from 2848be7 to 6d6390c Compare December 5, 2023 14:49
epilys
epilys previously approved these changes Dec 5, 2023
Cargo.toml Outdated Show resolved Hide resolved
vhost-device-input/src/vhu_input.rs Show resolved Hide resolved
@Leo-Yan Leo-Yan force-pushed the add_spport_vhost_device_input_v1 branch from 6d6390c to 50a6d17 Compare December 6, 2023 13:27
@Ablu
Copy link
Contributor

Ablu commented Dec 6, 2023

https://github.com/rust-vmm/vm-memory/pull/274/files will hopefully allow us to get rid of Default trait impl in the future.

epilys
epilys previously approved these changes Dec 7, 2023
@epilys epilys force-pushed the add_spport_vhost_device_input_v1 branch from 50a6d17 to 3d2d27d Compare December 7, 2023 09:21
@epilys epilys enabled auto-merge (rebase) December 7, 2023 09:42
README.md Outdated Show resolved Hide resolved
Leo Yan added 2 commits December 7, 2023 19:08
This patch is to add support for vhost input device emulation.

The code skeleton heavily reuses vhost-device-i2c and vhost-device-rng,
including sharing the same license, and how to create the multi-thread
mode and daemon for backend virtual device.

It gives detailed usage for enabling virtual input device for guest in
the README.md.

Signed-off-by: Leo Yan <[email protected]>
This patch adds test cases for verification vhost input backend.

Signed-off-by: Leo Yan <[email protected]>
auto-merge was automatically disabled December 7, 2023 11:27

Head branch was pushed to by a user without write access

@Leo-Yan Leo-Yan force-pushed the add_spport_vhost_device_input_v1 branch from 3d2d27d to c271be6 Compare December 7, 2023 11:27
@epilys epilys enabled auto-merge (rebase) December 7, 2023 11:45
@epilys epilys requested a review from vireshk December 7, 2023 11:45
@epilys epilys merged commit 740ad22 into rust-vmm:main Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants