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

vmm: support VFIO device #99

Merged
merged 4 commits into from
Jan 9, 2024
Merged

vmm: support VFIO device #99

merged 4 commits into from
Jan 9, 2024

Conversation

Burning1020
Copy link
Member

@Burning1020 Burning1020 commented Dec 4, 2023

  1. Support VFIO device in vmm.
  2. Run libc::connect() in spawn_blocking to avoid blocking other task.
  3. Return OK() if sandbox is in CREATED state.
  4. Return io error in cmd pre_exec

@Burning1020 Burning1020 requested a review from a team as a code owner December 4, 2023 11:43
@Burning1020 Burning1020 force-pushed the vmm-vfio branch 12 times, most recently from 3f52e80 to 1290b92 Compare December 7, 2023 09:04
@Burning1020 Burning1020 changed the title task: support VFIO device for vmm vmm: support VFIO device Dec 7, 2023
@Vanient
Copy link
Member

Vanient commented Dec 26, 2023

It would be better to split three commits, a little confusing to review if mixed together

{
Ok(interface) => interface,
Err(e) => {
warn!("failed to parse network interface: {}, paas it", e);
Copy link
Member

Choose a reason for hiding this comment

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

pass

@@ -266,6 +266,20 @@ impl NetworkInterface {
}
}
}
// find the pci device for unknown type interface, maybe it is a physical interface.
Copy link
Member

Choose a reason for hiding this comment

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

Is it certain that all physical interface with unknown type? Or is there any possibility that any other inferface with unknown type, will it cause any problem?

Copy link
Member Author

Choose a reason for hiding this comment

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

Is it certain that all physical interface with unknown type? Or is there any possibility that any other inferface with unknown type, will it cause any problem?

We checked the netlink.LinkDeserialize() golang code, every type does have a correspond struct, but some of the structs do not be used, so we centralize them by Unknown type.

@Burning1020 Burning1020 force-pushed the vmm-vfio branch 6 times, most recently from 247c514 to 5da472e Compare January 1, 2024 14:18
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
.map_err(|_| anyhow!("hvsock retry {}ms timeout", HVSOCK_RETRY_TIMEOUT_IN_MS))?
})
.await
.map_err(|e| anyhow!("failed to spawn blocking task: {}", e))?
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is the timeout removed when waiting?

Copy link
Member Author

Choose a reason for hiding this comment

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

We have three kinds of "connectiing" method for unix socket, vsock and hvsock. All the methonds only handle the connecting, leaving the timeout be handled in the upper caller, e.g. new_ttrpc_client.

let start_time = SystemTime::now();
loop {
tokio::task::spawn_blocking(move || loop {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we have to change it to async?

Copy link
Member Author

@Burning1020 Burning1020 Jan 3, 2024

Choose a reason for hiding this comment

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

We have called sync function UnixStream::connect(), thus it's better put it in a spawn_blocking

vmm/sandbox/src/network/link.rs Show resolved Hide resolved
{
Ok(interface) => interface,
Err(e) => {
warn!("failed to parse network interface: {}, pass it", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

ignore it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good

vmm/sandbox/src/sandbox.rs Show resolved Hide resolved
Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
@abel-von abel-von merged commit 4f43907 into kuasar-io:main Jan 9, 2024
15 checks passed
@Burning1020 Burning1020 deleted the vmm-vfio branch April 7, 2024 04:00
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.

3 participants