Skip to content

Commit

Permalink
runtime-rs: Add pci_hotplug as a config option
Browse files Browse the repository at this point in the history
There are cases where enabling PCI hotplug by default, breaks
Dragonball's initial setup, resulting in the following error message:

```
FATA[0000] failed to create shim task: Others("failed to handle message try
init runtime instance\n\nCaused by:\n    0: init runtime handler\n
1: start sandbox\n    2: start vm\n  3: start vmm instance\n
4: Failed to start vmm\n    5: Failed to start MicroVm\n
6: vmm action error: StartMicroVm(CreateVfioDevice(NoResource))"): unknown
```

Adding this as a config option enables normal booting even on nodes that
lack the default functionality.

Fixes: #9509

Signed-off-by: Anastassios Nanos <ananos@nubificus.co.uk>
  • Loading branch information
ananos committed May 4, 2024
1 parent e5e0983 commit 592966c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/libs/kata-types/src/config/hypervisor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,12 @@ pub struct DeviceInfo {
#[serde(default)]
pub default_bridges: u32,

/// Enable PCI hotplug support, default false
///
/// Enabling this will result in hotplugin VFIO devices (see below).
#[serde(default)]
pub pci_hotplug: bool,

/// VFIO devices are hotplugged on a bridge by default.
///
/// Enable hotplugging on root bus. This may be required for devices with a large PCI bar,
Expand Down
2 changes: 2 additions & 0 deletions src/runtime-rs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ DEFMEMSLOTS := 10
DEFMAXMEMSZ := 0
##VAR DEFBRIDGES=<number> Default number of bridges
DEFBRIDGES := 0
DEFPCIHOTPLUG := false
DEFENABLEANNOTATIONS := [\"kernel_params\"]
DEFDISABLEGUESTSECCOMP := true
DEFDISABLEGUESTEMPTYDIR := false
Expand Down Expand Up @@ -362,6 +363,7 @@ USER_VARS += DEFMEMSZ
USER_VARS += DEFMEMSLOTS
USER_VARS += DEFMAXMEMSZ
USER_VARS += DEFBRIDGES
USER_VARS += DEFPCIHOTPLUG
USER_VARS += DEFNETWORKMODEL_DB
USER_VARS += DEFNETWORKMODEL_CLH
USER_VARS += DEFNETWORKMODEL_QEMU
Expand Down
5 changes: 5 additions & 0 deletions src/runtime-rs/config/configuration-dragonball.toml.in
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ default_maxvcpus = @DEFMAXVCPUS_DB@
# > 5 --> will be set to 5
default_bridges = @DEFBRIDGES@

# PCI hotplug
# Enable or disable pci_hotplug
# will be set to @DEFPCIHOTPLUG@
pci_hotplug = @DEFPCIHOTPLUG@

# Default memory size in MiB for SB/VM.
# If unspecified then it will be set @DEFMEMSZ@ MiB.
default_memory = @DEFMEMSZ@
Expand Down
2 changes: 1 addition & 1 deletion src/runtime-rs/crates/hypervisor/src/dragonball/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ impl DragonballInner {
max_vcpu_count: self.config.cpu_info.default_maxvcpus as u8,
mem_type,
mem_file_path,
pci_hotplug_enabled: true,
pci_hotplug_enabled: self.hypervisor_config().device_info.pci_hotplug,
..Default::default()
};
info!(sl!(), "vm config: {:?}", vm_config);
Expand Down

0 comments on commit 592966c

Please sign in to comment.