mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-21 19:02:30 +00:00
vmm: Allocate enough MSI-X vectors for multiqueue virtio devices
The default number of MSI-X vector allocated was 2, which is the minimum defined by the virtio specification. The reason for this minimum is that virtio needs at least one interrupt to signal that configuration changed and at least one to specify something happened regarding the virtqueues. But this current implementation is not optimal because our VMM supports as many MSI-X vectors as allowed by the MSI-X specification (2048 max). For that reason, the current patch relies on the number of virtqueues needed by the virtio device to determine the right amount of MSI-X vectors needed. It's important not to forget the dedicated vector for any configuration change too. Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
parent
d2db34edf2
commit
69e27288a2
@ -974,7 +974,7 @@ mod tests {
|
||||
.trim()
|
||||
.parse::<u32>()
|
||||
.unwrap_or_default(),
|
||||
10
|
||||
12
|
||||
);
|
||||
|
||||
guest.ssh_command("sudo shutdown -h now")?;
|
||||
@ -1031,7 +1031,7 @@ mod tests {
|
||||
.trim()
|
||||
.parse::<u32>()
|
||||
.unwrap_or_default(),
|
||||
10
|
||||
12
|
||||
);
|
||||
|
||||
guest.ssh_command("sudo shutdown -h now")?;
|
||||
@ -1088,7 +1088,7 @@ mod tests {
|
||||
.trim()
|
||||
.parse::<u32>()
|
||||
.unwrap_or_default(),
|
||||
10
|
||||
12
|
||||
);
|
||||
|
||||
guest.ssh_command("sudo shutdown -h now")?;
|
||||
@ -2062,7 +2062,7 @@ mod tests {
|
||||
.trim()
|
||||
.parse::<u32>()
|
||||
.unwrap_or_default(),
|
||||
10
|
||||
12
|
||||
);
|
||||
|
||||
guest.ssh_command("sudo shutdown -h now")?;
|
||||
|
@ -39,8 +39,6 @@ use vm_virtio::transport::VirtioPciDevice;
|
||||
use vm_virtio::{VirtioSharedMemory, VirtioSharedMemoryList};
|
||||
use vmm_sys_util::eventfd::EventFd;
|
||||
|
||||
const DEFAULT_MSIX_VEC_NUM: u16 = 2;
|
||||
|
||||
// IOAPIC address range
|
||||
const IOAPIC_RANGE_ADDR: u64 = 0xfec0_0000;
|
||||
const IOAPIC_RANGE_SIZE: u64 = 0x20;
|
||||
@ -849,7 +847,10 @@ impl DeviceManager {
|
||||
interrupt_info: &InterruptInfo,
|
||||
) -> DeviceManagerResult<()> {
|
||||
let msix_num = if interrupt_info.msi_capable {
|
||||
DEFAULT_MSIX_VEC_NUM
|
||||
// Allows support for one MSI-X vector per queue. It also adds 1
|
||||
// as we need to take into account the dedicated vector to notify
|
||||
// about a virtio config change.
|
||||
(virtio_device.queue_max_sizes().len() + 1) as u16
|
||||
} else {
|
||||
0
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user