-
Notifications
You must be signed in to change notification settings - Fork 477
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
Activate virtio devices via VMM thread #2032
Activate virtio devices via VMM thread #2032
Conversation
af89bc8
to
3b46616
Compare
@sameo This PR shows up a Rust (nightly) compiler bug...but otherwise works dandy! |
Here is the nightly failure: rust-lang/rust#79661 |
LGTM |
3b46616
to
ef4fa3f
Compare
The trait already includes an empty implementation of this function. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This can be uses to indicate to the caller that it should wait on the barrier before returning as there is some asynchronous activity triggered by the write which requires the KVM exit to block until it's completed. This is useful for having vCPU thread wait for the VMM thread to proceed to activate the virtio devices. See cloud-hypervisor#1863 Signed-off-by: Rob Bradford <robert.bradford@intel.com>
Wait for the barrier if one is provided by the result of the MMIO and PIO write. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
We need to be able to return the barrier from the code that prepares to activate the virtio device. This triggered by a write to the configuration fields stored in the PCI BAR. Since bars can be accessed by both memory mapping and through PCI config I/O several prototypes must be changed. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This can then be used to activate the device from a separate thread. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
When a device is ready to be activated signal to the VMM thread via an EventFd that there is a device to be activated. When the VMM receives a notification on the EventFd that there is a device to be activated notify the device manager to attempt to activate any devices that have not been activated. As a side effect the VMM thread will create the virtio device threads. Fixes: cloud-hypervisor#1863 Signed-off-by: Rob Bradford <robert.bradford@intel.com>
Starting the virtio device threads from the VMM thread has slowed down the start of the VM when running on a highly contested system like the CI. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
ef4fa3f
to
01fe93f
Compare
I was interested in if this had any impact on boot time:
|
On the CI we are seeing that sometimes the epoll is receing these errors which do not indicate a failure but that we should retry. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
I saw
|
@rbradford I see CI is green now. Did you update the PR to fix the barrier not being released issue? |
It could either be just general flakiness, or it could be that this change makes the tests more flaky. |
I'd say let's merge that one. |
If a virtio device needs activation (because the device status field has been updated) signal to the VMM thread that there is a device that can be activated via an EventFd. Since the device must be ready when the write to the configuration register is completed use a barrier so that the CPU thread will wait until the VMM thread activates the device. This ensures that from the guest perspective the device is activated synchronously by the write that it made to the status register.
Fixes: #1863
This is based on an earlier PR: #1953 that didn't correctly handle the required synchronous behaviour.