mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-30 20:54:26 +00:00
Dragonball: update dependencies
Since rust-vmm and dragonball-sandbox has introduced several updates such as vPMU support for aarch64, we also need to update Dragonball dependencies to include those changes. Update: virtio-queue to v0.6.0 kvm-ioctls to v0.12.0 dbs-upcall to v0.2.0 dbs-virtio-devices to v0.2.0 kvm-bindings to v0.6.0 Also, several aarch64 features are updated because of dependencies changes: 1. update vcpu hotplug API. 2. update vpmu related API. 3. adjust unit test cases for aarch64 Dragonball. fixes: #6268 Signed-off-by: Chao Wu <chaowu@linux.alibaba.com>
This commit is contained in:
parent
44a780f262
commit
dd2713521e
863
src/dragonball/Cargo.lock
generated
863
src/dragonball/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -19,11 +19,11 @@ dbs-boot = "0.3.0"
|
|||||||
dbs-device = "0.2.0"
|
dbs-device = "0.2.0"
|
||||||
dbs-interrupt = { version = "0.2.0", features = ["kvm-irq"] }
|
dbs-interrupt = { version = "0.2.0", features = ["kvm-irq"] }
|
||||||
dbs-legacy-devices = "0.1.0"
|
dbs-legacy-devices = "0.1.0"
|
||||||
dbs-upcall = { version = "0.1.0", optional = true }
|
dbs-upcall = { version = "0.2.0", optional = true }
|
||||||
dbs-utils = "0.2.0"
|
dbs-utils = "0.2.0"
|
||||||
dbs-virtio-devices = { version = "0.1.0", optional = true, features = ["virtio-mmio"] }
|
dbs-virtio-devices = { version = "0.2.0", optional = true, features = ["virtio-mmio"] }
|
||||||
kvm-bindings = "0.5.0"
|
kvm-bindings = "0.6.0"
|
||||||
kvm-ioctls = "0.11.0"
|
kvm-ioctls = "0.12.0"
|
||||||
lazy_static = "1.2"
|
lazy_static = "1.2"
|
||||||
libc = "0.2.39"
|
libc = "0.2.39"
|
||||||
linux-loader = "0.6.0"
|
linux-loader = "0.6.0"
|
||||||
@ -37,7 +37,7 @@ slog = "2.5.2"
|
|||||||
slog-scope = "4.4.0"
|
slog-scope = "4.4.0"
|
||||||
thiserror = "1"
|
thiserror = "1"
|
||||||
vmm-sys-util = "0.11.0"
|
vmm-sys-util = "0.11.0"
|
||||||
virtio-queue = { version = "0.4.0", optional = true }
|
virtio-queue = { version = "0.6.0", optional = true }
|
||||||
vm-memory = { version = "0.9.0", features = ["backend-mmap"] }
|
vm-memory = { version = "0.9.0", features = ["backend-mmap"] }
|
||||||
crossbeam-channel = "0.5.6"
|
crossbeam-channel = "0.5.6"
|
||||||
|
|
||||||
|
@ -147,17 +147,13 @@ pub type Result<T> = ::std::result::Result<T, DeviceMgrError>;
|
|||||||
/// Type of the dragonball virtio devices.
|
/// Type of the dragonball virtio devices.
|
||||||
#[cfg(feature = "dbs-virtio-devices")]
|
#[cfg(feature = "dbs-virtio-devices")]
|
||||||
pub type DbsVirtioDevice = Box<
|
pub type DbsVirtioDevice = Box<
|
||||||
dyn VirtioDevice<
|
dyn VirtioDevice<GuestAddressSpaceImpl, virtio_queue::QueueSync, vm_memory::GuestRegionMmap>,
|
||||||
GuestAddressSpaceImpl,
|
|
||||||
virtio_queue::QueueStateSync,
|
|
||||||
vm_memory::GuestRegionMmap,
|
|
||||||
>,
|
|
||||||
>;
|
>;
|
||||||
|
|
||||||
/// Type of the dragonball virtio mmio devices.
|
/// Type of the dragonball virtio mmio devices.
|
||||||
#[cfg(feature = "dbs-virtio-devices")]
|
#[cfg(feature = "dbs-virtio-devices")]
|
||||||
pub type DbsMmioV2Device =
|
pub type DbsMmioV2Device =
|
||||||
MmioV2Device<GuestAddressSpaceImpl, virtio_queue::QueueStateSync, vm_memory::GuestRegionMmap>;
|
MmioV2Device<GuestAddressSpaceImpl, virtio_queue::QueueSync, vm_memory::GuestRegionMmap>;
|
||||||
|
|
||||||
/// Struct to support transactional operations for device management.
|
/// Struct to support transactional operations for device management.
|
||||||
pub struct DeviceManagerTx {
|
pub struct DeviceManagerTx {
|
||||||
|
@ -441,7 +441,8 @@ impl Vcpu {
|
|||||||
/// Returns error or enum specifying whether emulation was handled or interrupted.
|
/// Returns error or enum specifying whether emulation was handled or interrupted.
|
||||||
fn run_emulation(&mut self) -> Result<VcpuEmulation> {
|
fn run_emulation(&mut self) -> Result<VcpuEmulation> {
|
||||||
match Vcpu::emulate(&self.fd) {
|
match Vcpu::emulate(&self.fd) {
|
||||||
Ok(run) => match run {
|
Ok(run) => {
|
||||||
|
match run {
|
||||||
#[cfg(target_arch = "x86_64")]
|
#[cfg(target_arch = "x86_64")]
|
||||||
VcpuExit::IoIn(addr, data) => {
|
VcpuExit::IoIn(addr, data) => {
|
||||||
let _ = self.io_mgr.pio_read(addr, data);
|
let _ = self.io_mgr.pio_read(addr, data);
|
||||||
@ -475,9 +476,9 @@ impl Vcpu {
|
|||||||
Err(VcpuError::VcpuUnhandledKvmExit)
|
Err(VcpuError::VcpuUnhandledKvmExit)
|
||||||
}
|
}
|
||||||
// Documentation specifies that below kvm exits are considered errors.
|
// Documentation specifies that below kvm exits are considered errors.
|
||||||
VcpuExit::FailEntry => {
|
VcpuExit::FailEntry(reason, cpu) => {
|
||||||
METRICS.vcpu.failures.inc();
|
METRICS.vcpu.failures.inc();
|
||||||
error!("Received KVM_EXIT_FAIL_ENTRY signal");
|
error!("Received KVM_EXIT_FAIL_ENTRY signal, reason {reason}, cpu number {cpu}");
|
||||||
Err(VcpuError::VcpuUnhandledKvmExit)
|
Err(VcpuError::VcpuUnhandledKvmExit)
|
||||||
}
|
}
|
||||||
VcpuExit::InternalError => {
|
VcpuExit::InternalError => {
|
||||||
@ -509,7 +510,8 @@ impl Vcpu {
|
|||||||
error!("Unexpected exit reason on vcpu run: {:?}", r);
|
error!("Unexpected exit reason on vcpu run: {:?}", r);
|
||||||
Err(VcpuError::VcpuUnhandledKvmExit)
|
Err(VcpuError::VcpuUnhandledKvmExit)
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
}
|
||||||
// The unwrap on raw_os_error can only fail if we have a logic
|
// The unwrap on raw_os_error can only fail if we have a logic
|
||||||
// error in our code in which case it is better to panic.
|
// error in our code in which case it is better to panic.
|
||||||
Err(ref e) => {
|
Err(ref e) => {
|
||||||
@ -786,7 +788,7 @@ pub mod tests {
|
|||||||
MmioWrite,
|
MmioWrite,
|
||||||
Hlt,
|
Hlt,
|
||||||
Shutdown,
|
Shutdown,
|
||||||
FailEntry,
|
FailEntry(u64, u32),
|
||||||
InternalError,
|
InternalError,
|
||||||
Unknown,
|
Unknown,
|
||||||
SystemEvent(u32, u64),
|
SystemEvent(u32, u64),
|
||||||
@ -807,7 +809,9 @@ pub mod tests {
|
|||||||
EmulationCase::MmioWrite => Ok(VcpuExit::MmioWrite(0, &[])),
|
EmulationCase::MmioWrite => Ok(VcpuExit::MmioWrite(0, &[])),
|
||||||
EmulationCase::Hlt => Ok(VcpuExit::Hlt),
|
EmulationCase::Hlt => Ok(VcpuExit::Hlt),
|
||||||
EmulationCase::Shutdown => Ok(VcpuExit::Shutdown),
|
EmulationCase::Shutdown => Ok(VcpuExit::Shutdown),
|
||||||
EmulationCase::FailEntry => Ok(VcpuExit::FailEntry),
|
EmulationCase::FailEntry(error_type, cpu_num) => {
|
||||||
|
Ok(VcpuExit::FailEntry(*error_type, *cpu_num))
|
||||||
|
}
|
||||||
EmulationCase::InternalError => Ok(VcpuExit::InternalError),
|
EmulationCase::InternalError => Ok(VcpuExit::InternalError),
|
||||||
EmulationCase::Unknown => Ok(VcpuExit::Unknown),
|
EmulationCase::Unknown => Ok(VcpuExit::Unknown),
|
||||||
EmulationCase::SystemEvent(event_type, event_flags) => {
|
EmulationCase::SystemEvent(event_type, event_flags) => {
|
||||||
@ -850,6 +854,8 @@ pub mod tests {
|
|||||||
|
|
||||||
#[cfg(target_arch = "aarch64")]
|
#[cfg(target_arch = "aarch64")]
|
||||||
fn create_vcpu() -> (Vcpu, Receiver<VcpuStateEvent>) {
|
fn create_vcpu() -> (Vcpu, Receiver<VcpuStateEvent>) {
|
||||||
|
use kvm_ioctls::Kvm;
|
||||||
|
use std::os::fd::AsRawFd;
|
||||||
// Call for kvm too frequently would cause error in some host kernel.
|
// Call for kvm too frequently would cause error in some host kernel.
|
||||||
std::thread::sleep(std::time::Duration::from_millis(5));
|
std::thread::sleep(std::time::Duration::from_millis(5));
|
||||||
|
|
||||||
@ -918,7 +924,7 @@ pub mod tests {
|
|||||||
assert!(matches!(res, Err(VcpuError::VcpuUnhandledKvmExit)));
|
assert!(matches!(res, Err(VcpuError::VcpuUnhandledKvmExit)));
|
||||||
|
|
||||||
// KVM_EXIT_FAIL_ENTRY signal
|
// KVM_EXIT_FAIL_ENTRY signal
|
||||||
*(EMULATE_RES.lock().unwrap()) = EmulationCase::FailEntry;
|
*(EMULATE_RES.lock().unwrap()) = EmulationCase::FailEntry(0, 0);
|
||||||
let res = vcpu.run_emulation();
|
let res = vcpu.run_emulation();
|
||||||
assert!(matches!(res, Err(VcpuError::VcpuUnhandledKvmExit)));
|
assert!(matches!(res, Err(VcpuError::VcpuUnhandledKvmExit)));
|
||||||
|
|
||||||
|
@ -887,7 +887,9 @@ mod hotplug {
|
|||||||
cpu_ids_array[..cpu_ids.len()].copy_from_slice(&cpu_ids[..cpu_ids.len()]);
|
cpu_ids_array[..cpu_ids.len()].copy_from_slice(&cpu_ids[..cpu_ids.len()]);
|
||||||
let req = DevMgrRequest::AddVcpu(CpuDevRequest {
|
let req = DevMgrRequest::AddVcpu(CpuDevRequest {
|
||||||
count: cpu_ids.len() as u8,
|
count: cpu_ids.len() as u8,
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
apic_ids: cpu_ids_array,
|
apic_ids: cpu_ids_array,
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
apic_ver: APIC_VERSION,
|
apic_ver: APIC_VERSION,
|
||||||
});
|
});
|
||||||
self.send_upcall_action(upcall_client, req)?;
|
self.send_upcall_action(upcall_client, req)?;
|
||||||
@ -924,7 +926,9 @@ mod hotplug {
|
|||||||
cpu_ids_array[..cpu_ids.len()].copy_from_slice(&cpu_ids[..cpu_ids.len()]);
|
cpu_ids_array[..cpu_ids.len()].copy_from_slice(&cpu_ids[..cpu_ids.len()]);
|
||||||
let req = DevMgrRequest::DelVcpu(CpuDevRequest {
|
let req = DevMgrRequest::DelVcpu(CpuDevRequest {
|
||||||
count: cpu_num_to_be_del as u8,
|
count: cpu_num_to_be_del as u8,
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
apic_ids: cpu_ids_array,
|
apic_ids: cpu_ids_array,
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
apic_ver: APIC_VERSION,
|
apic_ver: APIC_VERSION,
|
||||||
});
|
});
|
||||||
self.send_upcall_action(upcall_client, req)?;
|
self.send_upcall_action(upcall_client, req)?;
|
||||||
@ -969,7 +973,10 @@ mod hotplug {
|
|||||||
vcpu_state_sender
|
vcpu_state_sender
|
||||||
.send(VcpuStateEvent::Hotplug((
|
.send(VcpuStateEvent::Hotplug((
|
||||||
result,
|
result,
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
resp.info.apic_id_index,
|
resp.info.apic_id_index,
|
||||||
|
#[cfg(target_arch = "aarch64")]
|
||||||
|
resp.info.cpu_id,
|
||||||
)))
|
)))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
vcpu_state_event.write(1).unwrap();
|
vcpu_state_event.write(1).unwrap();
|
||||||
|
@ -11,7 +11,7 @@ use std::fmt::Debug;
|
|||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
|
|
||||||
use dbs_arch::gic::GICDevice;
|
use dbs_arch::gic::GICDevice;
|
||||||
use dbs_arch::{DeviceInfoForFDT, DeviceType};
|
use dbs_arch::{DeviceInfoForFDT, DeviceType, VpmuFeatureLevel};
|
||||||
use dbs_boot::InitrdConfig;
|
use dbs_boot::InitrdConfig;
|
||||||
use dbs_utils::epoll_manager::EpollManager;
|
use dbs_utils::epoll_manager::EpollManager;
|
||||||
use dbs_utils::time::TimestampUs;
|
use dbs_utils::time::TimestampUs;
|
||||||
@ -51,6 +51,8 @@ fn configure_system<T: DeviceInfoForFDT + Clone + Debug, M: GuestMemory>(
|
|||||||
device_info,
|
device_info,
|
||||||
gic_device,
|
gic_device,
|
||||||
initrd,
|
initrd,
|
||||||
|
// We will add vpmu feature support in the future PRs. issue: #6168
|
||||||
|
&VpmuFeatureLevel::Disabled,
|
||||||
)
|
)
|
||||||
.map_err(Error::BootSystem)?;
|
.map_err(Error::BootSystem)?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
@ -1005,6 +1005,7 @@ pub mod tests {
|
|||||||
assert!(vm.remove_devices().is_ok());
|
assert!(vm.remove_devices().is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(target_arch = "x86_64")]
|
||||||
#[test]
|
#[test]
|
||||||
fn test_run_code() {
|
fn test_run_code() {
|
||||||
skip_if_not_root!();
|
skip_if_not_root!();
|
||||||
|
1201
src/runtime-rs/Cargo.lock
generated
1201
src/runtime-rs/Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user