From eacceaa5a33323b5ca94921fe10a4674841c51d6 Mon Sep 17 00:00:00 2001 From: Egor Lazarchuk Date: Fri, 26 Apr 2024 16:38:09 +0100 Subject: [PATCH 01/12] refactor(aarch64): import kvm_bindings items Import kvm_bindings items instead of referring them by full name. Signed-off-by: Egor Lazarchuk --- src/vmm/src/vstate/vcpu/aarch64.rs | 31 ++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/vmm/src/vstate/vcpu/aarch64.rs b/src/vmm/src/vstate/vcpu/aarch64.rs index 9d042a9af484..bf4e2dc60a88 100644 --- a/src/vmm/src/vstate/vcpu/aarch64.rs +++ b/src/vmm/src/vstate/vcpu/aarch64.rs @@ -7,6 +7,9 @@ use std::fmt::{Debug, Write}; +use kvm_bindings::{ + kvm_mp_state, kvm_vcpu_init, KVM_ARM_VCPU_POWER_OFF, KVM_ARM_VCPU_PSCI_0_2, KVM_ARM_VCPU_SVE, +}; use kvm_ioctls::*; use serde::{Deserialize, Serialize}; @@ -57,7 +60,7 @@ pub struct KvmVcpu { /// Vcpu peripherals, such as buses pub(super) peripherals: Peripherals, mpidr: u64, - kvi: Option, + kvi: Option, } /// Vcpu peripherals @@ -151,7 +154,7 @@ impl KvmVcpu { // Non-boot cpus are powered off initially. if 0 < self.index { - kvi.features[0] |= 1 << kvm_bindings::KVM_ARM_VCPU_POWER_OFF; + kvi.features[0] |= 1 << KVM_ARM_VCPU_POWER_OFF; } self.init_vcpu(&kvi)?; @@ -161,14 +164,14 @@ impl KvmVcpu { } /// Creates default kvi struct based on vcpu index. - pub fn default_kvi(vm_fd: &VmFd) -> Result { - let mut kvi: kvm_bindings::kvm_vcpu_init = kvm_bindings::kvm_vcpu_init::default(); + pub fn default_kvi(vm_fd: &VmFd) -> Result { + let mut kvi = kvm_vcpu_init::default(); // This reads back the kernel's preferred target type. vm_fd .get_preferred_target(&mut kvi) .map_err(KvmVcpuError::GetPreferredTarget)?; // We already checked that the capability is supported. - kvi.features[0] |= 1 << kvm_bindings::KVM_ARM_VCPU_PSCI_0_2; + kvi.features[0] |= 1 << KVM_ARM_VCPU_PSCI_0_2; Ok(kvi) } @@ -230,18 +233,18 @@ impl KvmVcpu { Ok(CpuConfiguration { regs }) } /// Initializes internal vcpufd. - fn init_vcpu(&self, kvi: &kvm_bindings::kvm_vcpu_init) -> Result<(), KvmVcpuError> { + fn init_vcpu(&self, kvi: &kvm_vcpu_init) -> Result<(), KvmVcpuError> { self.fd.vcpu_init(kvi).map_err(KvmVcpuError::Init)?; Ok(()) } /// Checks for SVE feature and calls `vcpu_finalize` if /// it is enabled. - fn finalize_vcpu(&self, kvi: &kvm_bindings::kvm_vcpu_init) -> Result<(), KvmVcpuError> { - if (kvi.features[0] & (1 << kvm_bindings::KVM_ARM_VCPU_SVE)) != 0 { + fn finalize_vcpu(&self, kvi: &kvm_vcpu_init) -> Result<(), KvmVcpuError> { + if (kvi.features[0] & (1 << KVM_ARM_VCPU_SVE)) != 0 { // KVM_ARM_VCPU_SVE has value 4 so casting to i32 is safe. #[allow(clippy::cast_possible_wrap)] - let feature = kvm_bindings::KVM_ARM_VCPU_SVE as i32; + let feature = KVM_ARM_VCPU_SVE as i32; self.fd.vcpu_finalize(&feature).unwrap(); } Ok(()) @@ -265,7 +268,7 @@ impl Peripherals { #[derive(Default, Clone, Serialize, Deserialize)] pub struct VcpuState { /// Multiprocessing state. - pub mp_state: kvm_bindings::kvm_mp_state, + pub mp_state: kvm_mp_state, /// Vcpu registers. pub regs: Aarch64RegisterVec, /// We will be using the mpidr for passing it to the VmState. @@ -275,7 +278,7 @@ pub struct VcpuState { /// kvi states for vcpu initialization. /// If None then use `default_kvi` to obtain /// kvi. - pub kvi: Option, + pub kvi: Option, } impl Debug for VcpuState { @@ -305,7 +308,7 @@ mod tests { #![allow(clippy::undocumented_unsafe_blocks)] use std::os::unix::io::AsRawFd; - use kvm_bindings::KVM_REG_SIZE_U64; + use kvm_bindings::{KVM_ARM_VCPU_PSCI_0_2, KVM_REG_SIZE_U64}; use super::*; use crate::arch::aarch64::regs::Aarch64RegisterRef; @@ -381,7 +384,7 @@ mod tests { let vcpu_features = vec![VcpuFeatures { index: 0, bitmap: RegisterValueFilter { - filter: 1 << kvm_bindings::KVM_ARM_VCPU_PSCI_0_2, + filter: 1 << KVM_ARM_VCPU_PSCI_0_2, value: 0, }, }]; @@ -390,7 +393,7 @@ mod tests { // Because vcpu_features vector is not empty, // kvi field should be non empty as well. let vcpu_kvi = vcpu.kvi.unwrap(); - assert!((vcpu_kvi.features[0] & (1 << kvm_bindings::KVM_ARM_VCPU_PSCI_0_2)) == 0) + assert!((vcpu_kvi.features[0] & (1 << KVM_ARM_VCPU_PSCI_0_2)) == 0) } #[test] From 19f36231c37285a179fc39a97b6f980e65035d85 Mon Sep 17 00:00:00 2001 From: Egor Lazarchuk Date: Fri, 26 Apr 2024 17:40:48 +0100 Subject: [PATCH 02/12] feat(aarch64): store kvi all the time Previously we were storing kvi for vcpus only when cpu template was used. This was done to save vcpu configuration for snapshot restoration step, because when vcpus are restored, we don't have access to the cpu template to apply changes again. But when cpu template was not used we did not store already created kvi and were getting new one from KVM. This is a redundant work which we can avoid if we store kvi all the time. Also storing kvi unconditionally simplifies the code significantly. Signed-off-by: Egor Lazarchuk --- src/vmm/src/builder.rs | 23 +++--- src/vmm/src/vstate/vcpu/aarch64.rs | 110 ++++++++++++----------------- src/vmm/src/vstate/vcpu/mod.rs | 2 +- 3 files changed, 54 insertions(+), 81 deletions(-) diff --git a/src/vmm/src/builder.rs b/src/vmm/src/builder.rs index 36f49a65e390..ae0e138e9c0a 100644 --- a/src/vmm/src/builder.rs +++ b/src/vmm/src/builder.rs @@ -496,20 +496,6 @@ pub fn build_microvm_from_snapshot( } // Restore vcpus kvm state. - #[cfg(target_arch = "aarch64")] - { - for (vcpu, state) in vcpus.iter_mut().zip(microvm_state.vcpu_states.iter()) { - vcpu.kvm_vcpu - .restore_state(vmm.vm.fd(), state) - .map_err(VcpuError::VcpuResponse) - .map_err(BuildMicrovmFromSnapshotError::RestoreVcpus)?; - } - let mpidrs = construct_kvm_mpidrs(µvm_state.vcpu_states); - // Restore kvm vm state. - vmm.vm.restore_state(&mpidrs, µvm_state.vm_state)?; - } - - #[cfg(target_arch = "x86_64")] for (vcpu, state) in vcpus.iter_mut().zip(microvm_state.vcpu_states.iter()) { vcpu.kvm_vcpu .restore_state(state) @@ -517,6 +503,13 @@ pub fn build_microvm_from_snapshot( .map_err(BuildMicrovmFromSnapshotError::RestoreVcpus)?; } + #[cfg(target_arch = "aarch64")] + { + let mpidrs = construct_kvm_mpidrs(µvm_state.vcpu_states); + // Restore kvm vm state. + vmm.vm.restore_state(&mpidrs, µvm_state.vm_state)?; + } + // Restore kvm vm state. #[cfg(target_arch = "x86_64")] vmm.vm.restore_state(µvm_state.vm_state)?; @@ -792,7 +785,7 @@ pub fn configure_system_for_boot( for vcpu in vcpus.iter_mut() { vcpu.kvm_vcpu - .init(vmm.vm.fd(), &cpu_template.vcpu_features) + .init(&cpu_template.vcpu_features) .map_err(VmmError::VcpuInit) .map_err(Internal)?; } diff --git a/src/vmm/src/vstate/vcpu/aarch64.rs b/src/vmm/src/vstate/vcpu/aarch64.rs index bf4e2dc60a88..2e2bb36fb07e 100644 --- a/src/vmm/src/vstate/vcpu/aarch64.rs +++ b/src/vmm/src/vstate/vcpu/aarch64.rs @@ -60,7 +60,7 @@ pub struct KvmVcpu { /// Vcpu peripherals, such as buses pub(super) peripherals: Peripherals, mpidr: u64, - kvi: Option, + kvi: kvm_vcpu_init, } /// Vcpu peripherals @@ -83,12 +83,18 @@ impl KvmVcpu { .create_vcpu(index.into()) .map_err(KvmVcpuError::CreateVcpu)?; + let mut kvi = Self::default_kvi(vm.fd())?; + // Secondary vcpus must be powered off for boot process. + if 0 < index { + kvi.features[0] |= 1 << KVM_ARM_VCPU_POWER_OFF; + } + Ok(KvmVcpu { index, fd: kvm_vcpu, peripherals: Default::default(), mpidr: 0, - kvi: None, + kvi, }) } @@ -134,31 +140,14 @@ impl KvmVcpu { /// # Arguments /// /// * `vm_fd` - The kvm `VmFd` for this microvm. - pub fn init( - &mut self, - vm_fd: &VmFd, - vcpu_features: &[VcpuFeatures], - ) -> Result<(), KvmVcpuError> { - let mut kvi = Self::default_kvi(vm_fd)?; - + pub fn init(&mut self, vcpu_features: &[VcpuFeatures]) -> Result<(), KvmVcpuError> { for feature in vcpu_features.iter() { let index = feature.index as usize; - kvi.features[index] = feature.bitmap.apply(kvi.features[index]); + self.kvi.features[index] = feature.bitmap.apply(self.kvi.features[index]); } - self.kvi = if !vcpu_features.is_empty() { - Some(kvi) - } else { - None - }; - - // Non-boot cpus are powered off initially. - if 0 < self.index { - kvi.features[0] |= 1 << KVM_ARM_VCPU_POWER_OFF; - } - - self.init_vcpu(&kvi)?; - self.finalize_vcpu(&kvi)?; + self.init_vcpu()?; + self.finalize_vcpu()?; Ok(()) } @@ -184,19 +173,22 @@ impl KvmVcpu { }; get_all_registers(&self.fd, &mut state.regs).map_err(KvmVcpuError::SaveState)?; state.mpidr = get_mpidr(&self.fd).map_err(KvmVcpuError::SaveState)?; + state.kvi = self.kvi; + // We don't save power off state in a snapshot, because + // it was only needed during uVM boot process. + // When uVM is restored, the kernel has already passed + // the boot state and turned secondary vcpus on. + state.kvi.features[0] &= !(1 << KVM_ARM_VCPU_POWER_OFF); + Ok(state) } /// Use provided state to populate KVM internal state. - pub fn restore_state(&mut self, vm_fd: &VmFd, state: &VcpuState) -> Result<(), KvmVcpuError> { - let kvi = match state.kvi { - Some(kvi) => kvi, - None => Self::default_kvi(vm_fd)?, - }; + pub fn restore_state(&mut self, state: &VcpuState) -> Result<(), KvmVcpuError> { self.kvi = state.kvi; - self.init_vcpu(&kvi)?; + self.init_vcpu()?; // If KVM_REG_ARM64_SVE_VLS is present it needs to // be set before vcpu is finalized. @@ -208,7 +200,7 @@ impl KvmVcpu { set_register(&self.fd, sve_vls_reg).map_err(KvmVcpuError::RestoreState)?; } - self.finalize_vcpu(&kvi)?; + self.finalize_vcpu()?; // KVM_REG_ARM64_SVE_VLS needs to be skipped after vcpu is finalized. // If it is present it is handled in the code above. @@ -233,15 +225,15 @@ impl KvmVcpu { Ok(CpuConfiguration { regs }) } /// Initializes internal vcpufd. - fn init_vcpu(&self, kvi: &kvm_vcpu_init) -> Result<(), KvmVcpuError> { - self.fd.vcpu_init(kvi).map_err(KvmVcpuError::Init)?; + fn init_vcpu(&self) -> Result<(), KvmVcpuError> { + self.fd.vcpu_init(&self.kvi).map_err(KvmVcpuError::Init)?; Ok(()) } /// Checks for SVE feature and calls `vcpu_finalize` if /// it is enabled. - fn finalize_vcpu(&self, kvi: &kvm_vcpu_init) -> Result<(), KvmVcpuError> { - if (kvi.features[0] & (1 << KVM_ARM_VCPU_SVE)) != 0 { + fn finalize_vcpu(&self) -> Result<(), KvmVcpuError> { + if (self.kvi.features[0] & (1 << KVM_ARM_VCPU_SVE)) != 0 { // KVM_ARM_VCPU_SVE has value 4 so casting to i32 is safe. #[allow(clippy::cast_possible_wrap)] let feature = KVM_ARM_VCPU_SVE as i32; @@ -276,9 +268,7 @@ pub struct VcpuState { /// registers. pub mpidr: u64, /// kvi states for vcpu initialization. - /// If None then use `default_kvi` to obtain - /// kvi. - pub kvi: Option, + pub kvi: kvm_vcpu_init, } impl Debug for VcpuState { @@ -322,7 +312,7 @@ mod tests { fn setup_vcpu(mem_size: usize) -> (Vm, KvmVcpu, GuestMemoryMmap) { let (mut vm, vm_mem) = setup_vm(mem_size); let mut vcpu = KvmVcpu::new(0, &vm).unwrap(); - vcpu.init(vm.fd(), &[]).unwrap(); + vcpu.init(&[]).unwrap(); vm.setup_irqchip(1).unwrap(); (vm, vcpu, vm_mem) @@ -388,23 +378,8 @@ mod tests { value: 0, }, }]; - vcpu.init(vm.fd(), &vcpu_features).unwrap(); - - // Because vcpu_features vector is not empty, - // kvi field should be non empty as well. - let vcpu_kvi = vcpu.kvi.unwrap(); - assert!((vcpu_kvi.features[0] & (1 << KVM_ARM_VCPU_PSCI_0_2)) == 0) - } - - #[test] - fn test_faulty_init_vcpu() { - let (vm, mut vcpu, _) = setup_vcpu(0x10000); - unsafe { libc::close(vm.fd().as_raw_fd()) }; - let err = vcpu.init(vm.fd(), &[]); - assert_eq!( - err.err().unwrap().to_string(), - "Error getting the vcpu preferred target: Bad file descriptor (os error 9)".to_string() - ); + vcpu.init(&vcpu_features).unwrap(); + assert!((vcpu.kvi.features[0] & (1 << KVM_ARM_VCPU_PSCI_0_2)) == 0) } #[test] @@ -421,24 +396,29 @@ mod tests { )); // Try to restore the register using a faulty state. + let mut faulty_vcpu_state = VcpuState::default(); + + // Try faulty kvi state + let res = vcpu.restore_state(&faulty_vcpu_state); + assert!(matches!(res.unwrap_err(), KvmVcpuError::Init(_))); + + // Try faulty vcpu regs + faulty_vcpu_state.kvi = KvmVcpu::default_kvi(vm.fd()).unwrap(); let mut regs = Aarch64RegisterVec::default(); let mut reg = Aarch64RegisterRef::new(KVM_REG_SIZE_U64, &[0; 8]); reg.id = 0; regs.push(reg); - let faulty_vcpu_state = VcpuState { - regs, - ..Default::default() - }; - let res = vcpu.restore_state(vm.fd(), &faulty_vcpu_state); + faulty_vcpu_state.regs = regs; + let res = vcpu.restore_state(&faulty_vcpu_state); assert!(matches!( res.unwrap_err(), KvmVcpuError::RestoreState(ArchError::SetOneReg(0, _)) )); - vcpu.init(vm.fd(), &[]).unwrap(); + vcpu.init(&[]).unwrap(); let state = vcpu.save_state().expect("Cannot save state of vcpu"); assert!(!state.regs.is_empty()); - vcpu.restore_state(vm.fd(), &state) + vcpu.restore_state(&state) .expect("Cannot restore state of vcpu"); } @@ -461,7 +441,7 @@ mod tests { let (mut vm, _vm_mem) = setup_vm(0x1000); let mut vcpu = KvmVcpu::new(0, &vm).unwrap(); vm.setup_irqchip(1).unwrap(); - vcpu.init(vm.fd(), &[]).unwrap(); + vcpu.init(&[]).unwrap(); vcpu.dump_cpu_config().unwrap(); } @@ -470,9 +450,9 @@ mod tests { fn test_setup_non_boot_vcpu() { let (vm, _) = setup_vm(0x1000); let mut vcpu1 = KvmVcpu::new(0, &vm).unwrap(); - vcpu1.init(vm.fd(), &[]).unwrap(); + vcpu1.init(&[]).unwrap(); let mut vcpu2 = KvmVcpu::new(1, &vm).unwrap(); - vcpu2.init(vm.fd(), &[]).unwrap(); + vcpu2.init(&[]).unwrap(); } #[test] diff --git a/src/vmm/src/vstate/vcpu/mod.rs b/src/vmm/src/vstate/vcpu/mod.rs index 2ecb8db6521d..b1b1e2c581e0 100644 --- a/src/vmm/src/vstate/vcpu/mod.rs +++ b/src/vmm/src/vstate/vcpu/mod.rs @@ -856,7 +856,7 @@ pub mod tests { #[cfg(target_arch = "aarch64")] let vcpu = { let mut vcpu = Vcpu::new(1, &vm, exit_evt).unwrap(); - vcpu.kvm_vcpu.init(vm.fd(), &[]).unwrap(); + vcpu.kvm_vcpu.init(&[]).unwrap(); vm.setup_irqchip(1).unwrap(); vcpu }; From 501a9e4ca5541da26ebbd970ffb6d073368b6988 Mon Sep 17 00:00:00 2001 From: Takahiro Itazuri Date: Tue, 30 Apr 2024 08:55:14 +0000 Subject: [PATCH 03/12] Revert "chore: Use pinned AMIs for cross snapshot restore target" This reverts commit 6624effdfb7ae201b05ded416d33c678a833b76c. Signed-off-by: Takahiro Itazuri --- .buildkite/pipeline_cross.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.buildkite/pipeline_cross.py b/.buildkite/pipeline_cross.py index c2cd80359e3b..c9730721e569 100755 --- a/.buildkite/pipeline_cross.py +++ b/.buildkite/pipeline_cross.py @@ -71,8 +71,7 @@ def cross_steps(): # https://github.com/firecracker-microvm/firecracker/blob/main/docs/kernel-policy.md#experimental-snapshot-compatibility-across-kernel-versions aarch64_platforms = [ - # TODO: unpin kernel 5.10 AMI once we fix io_uring test failures. - ("al2", "linux_5.10-pinned"), + ("al2", "linux_5.10"), ("al2023", "linux_6.1"), ] perms_aarch64 = itertools.product( From 7e10f5738adcea4a373814c1812ed46329da3211 Mon Sep 17 00:00:00 2001 From: Takahiro Itazuri Date: Tue, 30 Apr 2024 08:55:46 +0000 Subject: [PATCH 04/12] Revert "chore: Pin 5.10 kernel AMIs" This reverts commit 238f55c18adb8f67135eaa87af8b53eca4ee2a6f. Signed-off-by: Takahiro Itazuri --- .buildkite/common.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.buildkite/common.py b/.buildkite/common.py index 5a5609baaa1b..d8711269cf47 100644 --- a/.buildkite/common.py +++ b/.buildkite/common.py @@ -22,8 +22,7 @@ DEFAULT_PLATFORMS = [ ("al2", "linux_4.14"), - # TODO: Unpin 5.10 kernel AMI once io_uring issues is solved. - ("al2", "linux_5.10-pinned"), + ("al2", "linux_5.10"), ("al2023", "linux_6.1"), ] From b5a79d2c42018b99ae00b9d7ad14297f7ad33629 Mon Sep 17 00:00:00 2001 From: Egor Lazarchuk Date: Wed, 1 May 2024 11:36:03 +0000 Subject: [PATCH 05/12] feat: store snapshot files on test fail If test uses snapshots and fails save all files from `root` of a vm into the `test_results`. Signed-off-by: Egor Lazarchuk --- tests/conftest.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index b98c00a54035..4d6764856fb8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -258,18 +258,20 @@ def microvm_factory(request, record_property, results_dir): uvm_factory = MicroVMFactory(fc_binary_path, jailer_binary_path) yield uvm_factory - # if the test failed, save fc.log in test_results for troubleshooting + # if the test failed, save important files from the root of the uVM into `test_results` for troubleshooting report = request.node.stash[PHASE_REPORT_KEY] if "call" in report and report["call"].failed: for uvm in uvm_factory.vms: - if not uvm.log_file.exists(): - continue - dst = results_dir / uvm.id / uvm.log_file.name - dst.parent.mkdir() - shutil.copy(uvm.log_file, dst) - if uvm.metrics_file.exists(): - dst = results_dir / uvm.id / uvm.metrics_file.name - shutil.copy(uvm.metrics_file, dst) + uvm_data = results_dir / uvm.id + uvm_data.mkdir() + + uvm_root = uvm.path / "root" + for item in os.listdir(uvm_root): + src = uvm_root / item + if not os.path.isfile(src): + continue + dst = uvm_data / item + shutil.copy(src, dst) uvm_factory.kill() From fd636e3def049a2d652d8a4e4ab1f88bf6805ef3 Mon Sep 17 00:00:00 2001 From: Egor Lazarchuk Date: Fri, 3 May 2024 10:47:05 +0000 Subject: [PATCH 06/12] fix: update fingerprint baselines for 5.10 kernel KVM passes through bit 27 of the `MSR_IA32_ARCH_CAPABILITIES` MSR (0x10A) to the guest, to let them know whether the processor they're running on is affected by RFDS. According to Intel, only Atom processors are affected [[1]]. Our baselines for 6.1 kernel are already updated. Now this change was ported back to 5.10, so we update baselines for it. [1]: https://www.intel.com/content/www/us/en/developer/articles/technical/software-security-guidance/advisory-guidance/register-file-data-sampling.html Signed-off-by: Egor Lazarchuk --- .../fingerprint_INTEL_CASCADELAKE_5.10host.json | 4 ++-- .../fingerprint_INTEL_ICELAKE_5.10host.json | 4 ++-- .../fingerprint_INTEL_SKYLAKE_5.10host.json | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/data/cpu_template_helper/fingerprint_INTEL_CASCADELAKE_5.10host.json b/tests/data/cpu_template_helper/fingerprint_INTEL_CASCADELAKE_5.10host.json index 65f403e90f9c..31f8dad29244 100644 --- a/tests/data/cpu_template_helper/fingerprint_INTEL_CASCADELAKE_5.10host.json +++ b/tests/data/cpu_template_helper/fingerprint_INTEL_CASCADELAKE_5.10host.json @@ -1,6 +1,6 @@ { "firecracker_version": "1.8.0-dev", - "kernel_version": "5.10.214-202.855.amzn2.x86_64", + "kernel_version": "5.10.215-203.850.amzn2.x86_64", "microcode_version": "0x5003604", "bios_version": "1.0", "bios_revision": "3.80", @@ -1128,7 +1128,7 @@ }, { "addr": "0x10a", - "bitmap": "0b0000000000000000000000000000000000000100000010101010000011101011" + "bitmap": "0b0000000000000000000000000000000000001100000010101010000011101011" }, { "addr": "0x140", diff --git a/tests/data/cpu_template_helper/fingerprint_INTEL_ICELAKE_5.10host.json b/tests/data/cpu_template_helper/fingerprint_INTEL_ICELAKE_5.10host.json index 17615a9f1795..863ffd2851df 100644 --- a/tests/data/cpu_template_helper/fingerprint_INTEL_ICELAKE_5.10host.json +++ b/tests/data/cpu_template_helper/fingerprint_INTEL_ICELAKE_5.10host.json @@ -1,6 +1,6 @@ { "firecracker_version": "1.8.0-dev", - "kernel_version": "5.10.214-202.855.amzn2.x86_64", + "kernel_version": "5.10.215-203.850.amzn2.x86_64", "microcode_version": "0xd0003b9", "bios_version": "1.0", "bios_revision": "1.36", @@ -1220,7 +1220,7 @@ }, { "addr": "0x10a", - "bitmap": "0b0000000000000000000000000000000000000100000000101010000011101011" + "bitmap": "0b0000000000000000000000000000000000001100000000101010000011101011" }, { "addr": "0x140", diff --git a/tests/data/cpu_template_helper/fingerprint_INTEL_SKYLAKE_5.10host.json b/tests/data/cpu_template_helper/fingerprint_INTEL_SKYLAKE_5.10host.json index b87bd289e2a4..1681b9f7d248 100644 --- a/tests/data/cpu_template_helper/fingerprint_INTEL_SKYLAKE_5.10host.json +++ b/tests/data/cpu_template_helper/fingerprint_INTEL_SKYLAKE_5.10host.json @@ -1,6 +1,6 @@ { "firecracker_version": "1.8.0-dev", - "kernel_version": "5.10.214-202.855.amzn2.x86_64", + "kernel_version": "5.10.215-203.850.amzn2.x86_64", "microcode_version": "0x2007006", "bios_version": "1.0", "bios_revision": "3.80", @@ -1128,7 +1128,7 @@ }, { "addr": "0x10a", - "bitmap": "0b0000000000000000000000000000000000000100000000000000000001001100" + "bitmap": "0b0000000000000000000000000000000000001100000000000000000001001100" }, { "addr": "0x140", From da24307e7bd31e6e2d1d51667e8401879e64e25d Mon Sep 17 00:00:00 2001 From: Patrick Roy Date: Fri, 3 May 2024 13:52:12 +0100 Subject: [PATCH 07/12] doc: Troubleshooting for `ab_test.py analyze` Include which error one would see if one forgets to set the `AWS_EMF_NAMESPACE` and `AWS_EMF_ENVIRONMENT` variables to `local`. Note a common pitfall of trying to set environment variables through buildkite. Signed-off-by: Patrick Roy --- tests/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/README.md b/tests/README.md index a7ed49b1f569..3a92504a091f 100644 --- a/tests/README.md +++ b/tests/README.md @@ -260,6 +260,25 @@ tools/ab_test.py analyze This will then print the same analysis described in the previous sections. +#### Troubleshooting + +If during `tools/ab_test.py analyze` you get an error like + +```bash +$ tools/ab_test.py analyze +Traceback (most recent call last): + File "/firecracker/tools/ab_test.py", line 412, in + data_a = load_data_series(args.report_a) + File "/firecracker/tools/ab_test.py", line 122, in load_data_series + for line in test["teardown"]["stdout"].splitlines(): +KeyError: 'stdout' +``` + +double check that the `AWS_EMF_ENVIRONMENT` and `AWS_EMF_NAMESPACE` environment +variables are set to `local`. Particularly, when collecting data from buildkite +pipelines generated from `.buildkite/pipeline_perf.py`, ensure you pass +`--step-param env/AWS_EMF_NAMESPACE=local --step-param env/AWS_EMF_SERVICE_NAME=local`! + ## Adding Python Tests Tests can be added in any (existing or new) sub-directory of `tests/`, in files From 118c1c51afe16e2bc68dbb8f0a62ed51de40d503 Mon Sep 17 00:00:00 2001 From: Egor Lazarchuk Date: Fri, 3 May 2024 12:35:30 +0000 Subject: [PATCH 08/12] fix: update guest msr list for 5.10 host This is a follow up to #4593 Signed-off-by: Egor Lazarchuk --- ...CL_INTEL_CASCADELAKE_5.10host_4.14guest.csv | 10 +++++----- ...CL_INTEL_CASCADELAKE_5.10host_5.10guest.csv | 18 +++++++++--------- ...t_T2CL_INTEL_ICELAKE_5.10host_4.14guest.csv | 10 +++++----- ...t_T2CL_INTEL_ICELAKE_5.10host_5.10guest.csv | 12 ++++++------ ...2S_INTEL_CASCADELAKE_5.10host_4.14guest.csv | 6 +++--- ...2S_INTEL_CASCADELAKE_5.10host_5.10guest.csv | 6 +++--- ...st_T2S_INTEL_ICELAKE_5.10host_4.14guest.csv | 6 +++--- ...st_T2S_INTEL_ICELAKE_5.10host_5.10guest.csv | 6 +++--- 8 files changed, 37 insertions(+), 37 deletions(-) diff --git a/tests/data/msr/msr_list_T2CL_INTEL_CASCADELAKE_5.10host_4.14guest.csv b/tests/data/msr/msr_list_T2CL_INTEL_CASCADELAKE_5.10host_4.14guest.csv index 7bcff91156b9..d10f1cb6fb53 100644 --- a/tests/data/msr/msr_list_T2CL_INTEL_CASCADELAKE_5.10host_4.14guest.csv +++ b/tests/data/msr/msr_list_T2CL_INTEL_CASCADELAKE_5.10host_4.14guest.csv @@ -1,8 +1,8 @@ MSR_ADDR,VALUE 0,0x0 0x1,0x0 -0x10,0xb22538c0 -0x11,0x1ddaf68 +0x10,0xb71ac306 +0x11,0x1e09168 0x12,0x3ffdc001 0x17,0x0 0x1b,0xfee00d00 @@ -18,7 +18,7 @@ MSR_ADDR,VALUE 0xcd,0x3 0xce,0x80000000 0xfe,0x508 -0x10a,0x40aa0eb +0x10a,0xc0aa0eb 0x11e,0xbe702111 0x122,0x3 0x140,0x0 @@ -200,7 +200,7 @@ MSR_ADDR,VALUE 0x619,0x0 0x639,0x0 0x641,0x0 -0x6e0,0x1b6ffb282 +0x6e0,0x1c39ba60c 0x800,0x0 0x801,0x0 0x802,0x0 @@ -462,7 +462,7 @@ MSR_ADDR,VALUE 0xc0000082,0xffffffff81600020 0xc0000083,0xffffffff816019e0 0xc0000084,0x47700 -0xc0000100,0x7f18b3b44740 +0xc0000100,0x7f4577f1c740 0xc0000101,0xffff88803fc00000 0xc0000102,0x0 0xc0000103,0x0 diff --git a/tests/data/msr/msr_list_T2CL_INTEL_CASCADELAKE_5.10host_5.10guest.csv b/tests/data/msr/msr_list_T2CL_INTEL_CASCADELAKE_5.10host_5.10guest.csv index fc826f7bfab2..9c381dbe0c19 100644 --- a/tests/data/msr/msr_list_T2CL_INTEL_CASCADELAKE_5.10host_5.10guest.csv +++ b/tests/data/msr/msr_list_T2CL_INTEL_CASCADELAKE_5.10host_5.10guest.csv @@ -1,9 +1,9 @@ MSR_ADDR,VALUE 0,0x0 0x1,0x0 -0x10,0xf54dbae8 -0x11,0x2501008 -0x12,0x2502001 +0x10,0xbe7f66e8 +0x11,0x2748008 +0x12,0x2749001 0x17,0x0 0x1b,0xfee00d00 0x2a,0x0 @@ -18,13 +18,13 @@ MSR_ADDR,VALUE 0xcd,0x3 0xce,0x80000000 0xfe,0x508 -0x10a,0x40aa0eb +0x10a,0xc0aa0eb 0x11e,0xbe702111 0x122,0x3 0x140,0x0 0x174,0x10 0x175,0xfffffe0000003000 -0x176,0xffffffff81601450 +0x176,0xffffffff81801450 0x179,0x20 0x17a,0x0 0x186,0x0 @@ -200,7 +200,7 @@ MSR_ADDR,VALUE 0x619,0x0 0x639,0x0 0x641,0x0 -0x6e0,0x20c50faa6 +0x6e0,0x1e27998b4 0x800,0x0 0x801,0x0 0x802,0x0 @@ -459,10 +459,10 @@ MSR_ADDR,VALUE 0x8ff,0x0 0xc0000080,0xd01 0xc0000081,0x23001000000000 -0xc0000082,0xffffffff81600040 -0xc0000083,0xffffffff81601500 +0xc0000082,0xffffffff81800040 +0xc0000083,0xffffffff81801500 0xc0000084,0x47700 -0xc0000100,0x7f2e7e232740 +0xc0000100,0x7f6a7d9dd740 0xc0000101,0xffff88803ec00000 0xc0000102,0x0 0xc0000103,0x0 diff --git a/tests/data/msr/msr_list_T2CL_INTEL_ICELAKE_5.10host_4.14guest.csv b/tests/data/msr/msr_list_T2CL_INTEL_ICELAKE_5.10host_4.14guest.csv index 7413f507a257..c04a4dad7a7b 100644 --- a/tests/data/msr/msr_list_T2CL_INTEL_ICELAKE_5.10host_4.14guest.csv +++ b/tests/data/msr/msr_list_T2CL_INTEL_ICELAKE_5.10host_4.14guest.csv @@ -1,8 +1,8 @@ MSR_ADDR,VALUE 0,0x0 0x1,0x0 -0x10,0xbde8c520 -0x11,0x1ddaf68 +0x10,0xba5c8e38 +0x11,0x1e09168 0x12,0x3ffdc001 0x17,0x0 0x1b,0xfee00d00 @@ -18,7 +18,7 @@ MSR_ADDR,VALUE 0xcd,0x3 0xce,0x80000000 0xfe,0x508 -0x10a,0x402a0eb +0x10a,0xc02a0eb 0x11e,0xbe702111 0x122,0x3 0x140,0x0 @@ -200,7 +200,7 @@ MSR_ADDR,VALUE 0x619,0x0 0x639,0x0 0x641,0x0 -0x6e0,0x1ab151b30 +0x6e0,0x1aa51b242 0x800,0x0 0x801,0x0 0x802,0x0 @@ -462,7 +462,7 @@ MSR_ADDR,VALUE 0xc0000082,0xffffffff81600020 0xc0000083,0xffffffff816019e0 0xc0000084,0x47700 -0xc0000100,0x7f32aaab7740 +0xc0000100,0x7f9bbe091740 0xc0000101,0xffff88803fc00000 0xc0000102,0x0 0xc0000103,0x0 diff --git a/tests/data/msr/msr_list_T2CL_INTEL_ICELAKE_5.10host_5.10guest.csv b/tests/data/msr/msr_list_T2CL_INTEL_ICELAKE_5.10host_5.10guest.csv index 34fe95f16d56..ebcc77805469 100644 --- a/tests/data/msr/msr_list_T2CL_INTEL_ICELAKE_5.10host_5.10guest.csv +++ b/tests/data/msr/msr_list_T2CL_INTEL_ICELAKE_5.10host_5.10guest.csv @@ -1,9 +1,9 @@ MSR_ADDR,VALUE 0,0x0 0x1,0x0 -0x10,0x116bfb3a6 -0x11,0x2501008 -0x12,0x2502001 +0x10,0x114970c7a +0x11,0x2502008 +0x12,0x2503001 0x17,0x0 0x1b,0xfee00d00 0x2a,0x0 @@ -18,7 +18,7 @@ MSR_ADDR,VALUE 0xcd,0x3 0xce,0x80000000 0xfe,0x508 -0x10a,0x402a0eb +0x10a,0xc02a0eb 0x11e,0xbe702111 0x122,0x3 0x140,0x0 @@ -200,7 +200,7 @@ MSR_ADDR,VALUE 0x619,0x0 0x639,0x0 0x641,0x0 -0x6e0,0x21deded02 +0x6e0,0x21a0368a2 0x800,0x0 0x801,0x0 0x802,0x0 @@ -462,7 +462,7 @@ MSR_ADDR,VALUE 0xc0000082,0xffffffff81600040 0xc0000083,0xffffffff81601500 0xc0000084,0x47700 -0xc0000100,0x7efef7ddb740 +0xc0000100,0x7f8958489740 0xc0000101,0xffff88803ec00000 0xc0000102,0x0 0xc0000103,0x0 diff --git a/tests/data/msr/msr_list_T2S_INTEL_CASCADELAKE_5.10host_4.14guest.csv b/tests/data/msr/msr_list_T2S_INTEL_CASCADELAKE_5.10host_4.14guest.csv index a54402c79c25..ae7c587348f9 100644 --- a/tests/data/msr/msr_list_T2S_INTEL_CASCADELAKE_5.10host_4.14guest.csv +++ b/tests/data/msr/msr_list_T2S_INTEL_CASCADELAKE_5.10host_4.14guest.csv @@ -1,7 +1,7 @@ MSR_ADDR,VALUE 0,0x0 0x1,0x0 -0x10,0xb19661e6 +0x10,0xbfb503a0 0x11,0x1e09168 0x12,0x3ffdc001 0x17,0x0 @@ -199,7 +199,7 @@ MSR_ADDR,VALUE 0x619,0x0 0x639,0x0 0x641,0x0 -0x6e0,0x1f90101e6 +0x6e0,0x2232ada00 0x800,0x0 0x801,0x0 0x802,0x0 @@ -461,7 +461,7 @@ MSR_ADDR,VALUE 0xc0000082,0xfffffe0000006000 0xc0000083,0xffffffff816019e0 0xc0000084,0x47700 -0xc0000100,0x7f9bccbb1740 +0xc0000100,0x7ff47ece5740 0xc0000101,0xffff88803fc00000 0xc0000102,0x0 0xc0000103,0x0 diff --git a/tests/data/msr/msr_list_T2S_INTEL_CASCADELAKE_5.10host_5.10guest.csv b/tests/data/msr/msr_list_T2S_INTEL_CASCADELAKE_5.10host_5.10guest.csv index 8f2f6bc4717b..31157b898d29 100644 --- a/tests/data/msr/msr_list_T2S_INTEL_CASCADELAKE_5.10host_5.10guest.csv +++ b/tests/data/msr/msr_list_T2S_INTEL_CASCADELAKE_5.10host_5.10guest.csv @@ -1,7 +1,7 @@ MSR_ADDR,VALUE 0,0x0 0x1,0x0 -0x10,0xb91bc47c +0x10,0xc1aa1fac 0x11,0x2502008 0x12,0x2503001 0x17,0x0 @@ -199,7 +199,7 @@ MSR_ADDR,VALUE 0x619,0x0 0x639,0x0 0x641,0x0 -0x6e0,0x20a583884 +0x6e0,0x235ffcde0 0x800,0x0 0x801,0x0 0x802,0x0 @@ -461,7 +461,7 @@ MSR_ADDR,VALUE 0xc0000082,0xffffffff81600040 0xc0000083,0xffffffff81601500 0xc0000084,0x47700 -0xc0000100,0x7ff651d21740 +0xc0000100,0x7f3ce0258740 0xc0000101,0xffff88803ec00000 0xc0000102,0x0 0xc0000103,0x0 diff --git a/tests/data/msr/msr_list_T2S_INTEL_ICELAKE_5.10host_4.14guest.csv b/tests/data/msr/msr_list_T2S_INTEL_ICELAKE_5.10host_4.14guest.csv index b65fe3f2e702..0aaf0fa9cc7d 100644 --- a/tests/data/msr/msr_list_T2S_INTEL_ICELAKE_5.10host_4.14guest.csv +++ b/tests/data/msr/msr_list_T2S_INTEL_ICELAKE_5.10host_4.14guest.csv @@ -1,7 +1,7 @@ MSR_ADDR,VALUE 0,0x0 0x1,0x0 -0x10,0xc32f1fde +0x10,0x1192e9024 0x11,0x1e09168 0x12,0x3ffdc001 0x17,0x0 @@ -199,7 +199,7 @@ MSR_ADDR,VALUE 0x619,0x0 0x639,0x0 0x641,0x0 -0x6e0,0x229694c3c +0x6e0,0x287ff5aac 0x800,0x0 0x801,0x0 0x802,0x0 @@ -461,7 +461,7 @@ MSR_ADDR,VALUE 0xc0000082,0xfffffe0000006000 0xc0000083,0xffffffff816019e0 0xc0000084,0x47700 -0xc0000100,0x7f10ca4bc740 +0xc0000100,0x7fd4527a4740 0xc0000101,0xffff88803fc00000 0xc0000102,0x0 0xc0000103,0x0 diff --git a/tests/data/msr/msr_list_T2S_INTEL_ICELAKE_5.10host_5.10guest.csv b/tests/data/msr/msr_list_T2S_INTEL_ICELAKE_5.10host_5.10guest.csv index 487e3740b703..ca88204f0299 100644 --- a/tests/data/msr/msr_list_T2S_INTEL_ICELAKE_5.10host_5.10guest.csv +++ b/tests/data/msr/msr_list_T2S_INTEL_ICELAKE_5.10host_5.10guest.csv @@ -1,7 +1,7 @@ MSR_ADDR,VALUE 0,0x0 0x1,0x0 -0x10,0xce23f686 +0x10,0x11724c8da 0x11,0x2502008 0x12,0x2503001 0x17,0x0 @@ -199,7 +199,7 @@ MSR_ADDR,VALUE 0x619,0x0 0x639,0x0 0x641,0x0 -0x6e0,0x24b6359be +0x6e0,0x29027fb12 0x800,0x0 0x801,0x0 0x802,0x0 @@ -461,7 +461,7 @@ MSR_ADDR,VALUE 0xc0000082,0xffffffff81600040 0xc0000083,0xffffffff81601500 0xc0000084,0x47700 -0xc0000100,0x7f4e94671740 +0xc0000100,0x7fea39cd1740 0xc0000101,0xffff88803ec00000 0xc0000102,0x0 0xc0000103,0x0 From 7c6b4f1acd950543f1c9fbc0ac26fbe86da8d338 Mon Sep 17 00:00:00 2001 From: Eddie Cazares Date: Thu, 25 Apr 2024 17:54:53 -0500 Subject: [PATCH 09/12] Derive thiserror::Error and displaydoc::Display for error types Modified the following error types to derive thiserror::Error and displaydoc::Display: - MainError - RunWithoutApiError - FileError - FilterError - EditMemoryError - VcpuError - BlockIoError - DumpCpuConfigError - BuildMicrovmFromRequestsError - BalloonConfigError - DriveError - VsockConfigError - MemoryError - JailerError This change allows for more detailed error messages to be displayed when these errors are encountered. Also updated test cases to match the new error type output. Signed-off-by: Eddie Cazares Co-authored-by: Lindsey Bowen Co-authored-by: Thomas Bunch --- src/firecracker/src/main.rs | 2 +- src/jailer/src/main.rs | 6 +++--- src/rebase-snap/src/main.rs | 14 +++++++------- src/seccompiler/src/backend.rs | 4 ++-- src/snapshot-editor/src/edit_memory.rs | 2 +- src/vmm/src/arch/aarch64/vcpu.rs | 2 +- src/vmm/src/lib.rs | 5 ++--- src/vmm/src/rpc_interface.rs | 2 +- src/vmm/src/vmm_config/balloon.rs | 4 ++-- src/vmm/src/vmm_config/drive.rs | 2 +- src/vmm/src/vmm_config/vsock.rs | 4 ++-- src/vmm/src/vstate/memory.rs | 14 +++++++------- tests/integration_tests/functional/test_api.py | 4 +++- .../functional/test_cmd_line_start.py | 4 ++-- 14 files changed, 35 insertions(+), 34 deletions(-) diff --git a/src/firecracker/src/main.rs b/src/firecracker/src/main.rs index 9ec166f649ce..f353ea26bb43 100644 --- a/src/firecracker/src/main.rs +++ b/src/firecracker/src/main.rs @@ -55,7 +55,7 @@ enum MainError { InvalidLogLevel(vmm::logger::LevelFilterFromStrError), /// Could not initialize logger: {0} LoggerInitialization(vmm::logger::LoggerUpdateError), - /// Could not initialize metrics: {0:?} + /// Could not initialize metrics: {0} MetricsInitialization(MetricsConfigError), /// Seccomp error: {0} SeccompFilter(FilterError), diff --git a/src/jailer/src/main.rs b/src/jailer/src/main.rs index 84a859392fbe..5868fd17fcab 100644 --- a/src/jailer/src/main.rs +++ b/src/jailer/src/main.rs @@ -44,11 +44,11 @@ pub enum JailerError { CgroupInvalidParentPath(), #[error("Failed to write to cgroups file: {0}")] CgroupWrite(io::Error), - #[error("Failed to change owner for {0:?}: {1}")] + #[error("Failed to change owner for {0}: {1}")] ChangeFileOwner(PathBuf, io::Error), #[error("Failed to chdir into chroot directory: {0}")] ChdirNewRoot(io::Error), - #[error("Failed to change permissions on {0:?}: {1}")] + #[error("Failed to change permissions on {0}: {1}")] Chmod(PathBuf, io::Error), #[error("Failed cloning into a new child process: {0}")] Clone(io::Error), @@ -112,7 +112,7 @@ pub enum JailerError { ReadLine(PathBuf, io::Error), #[error("{}", format!("Failed to read file {:?} into a string: {}", .0, .1).replace('\"', ""))] ReadToString(PathBuf, io::Error), - #[error("Regex failed: {0:?}")] + #[error("Regex failed: {0}")] RegEx(regex::Error), #[error("Invalid resource argument: {0}")] ResLimitArgument(String), diff --git a/src/rebase-snap/src/main.rs b/src/rebase-snap/src/main.rs index 0c5f00083325..088b25c31bf8 100644 --- a/src/rebase-snap/src/main.rs +++ b/src/rebase-snap/src/main.rs @@ -18,19 +18,19 @@ const DEPRECATION_MSG: &str = "This tool is deprecated and will be removed in th #[derive(Debug, thiserror::Error, displaydoc::Display)] enum FileError { - /// Invalid base file: {0:?} + /// Invalid base file: {0} InvalidBaseFile(std::io::Error), - /// Invalid diff file: {0:?} + /// Invalid diff file: {0} InvalidDiffFile(std::io::Error), - /// Failed to seek data: {0:?} + /// Failed to seek data: {0} SeekData(std::io::Error), - /// Failed to seek hole: {0:?} + /// Failed to seek hole: {0} SeekHole(std::io::Error), - /// Failed to seek: {0:?} + /// Failed to seek: {0} Seek(std::io::Error), - /// Failed to send the file: {0:?} + /// Failed to send the file: {0} SendFile(std::io::Error), - /// Failed to get metadata: {0:?} + /// Failed to get metadata: {0} Metadata(std::io::Error), } diff --git a/src/seccompiler/src/backend.rs b/src/seccompiler/src/backend.rs index d0e446a2083c..4f76574896e8 100644 --- a/src/seccompiler/src/backend.rs +++ b/src/seccompiler/src/backend.rs @@ -103,7 +103,7 @@ pub enum FilterError { FilterTooLarge, /// The seccomp rule contains an invalid argument number. InvalidArgumentNumber, - /// {0:?} + /// {0} Arch(TargetArchError), /// Syscall {0} has conflicting rules. ConflictingRules(i64), @@ -1743,7 +1743,7 @@ mod tests { "{}", FilterError::Arch(TargetArchError::InvalidString("lala".to_string())) ), - format!("{:?}", TargetArchError::InvalidString("lala".to_string())) + format!("{0}", TargetArchError::InvalidString("lala".to_string())) ); } diff --git a/src/snapshot-editor/src/edit_memory.rs b/src/snapshot-editor/src/edit_memory.rs index 1835e5e92092..b91750f7d3fa 100644 --- a/src/snapshot-editor/src/edit_memory.rs +++ b/src/snapshot-editor/src/edit_memory.rs @@ -24,7 +24,7 @@ pub enum EditMemoryError { MetadataDiff(std::io::Error), /// Failed to seek in memory file: {0} SeekMemory(std::io::Error), - /// Failed to send the file: {0:?} + /// Failed to send the file: {0} SendFile(std::io::Error), } diff --git a/src/vmm/src/arch/aarch64/vcpu.rs b/src/vmm/src/arch/aarch64/vcpu.rs index 773032abb889..ccffb8aee7b7 100644 --- a/src/vmm/src/arch/aarch64/vcpu.rs +++ b/src/vmm/src/arch/aarch64/vcpu.rs @@ -27,7 +27,7 @@ pub enum VcpuError { GetMp(kvm_ioctls::Error), /// Failed to set multiprocessor state: {0} SetMp(kvm_ioctls::Error), - /// Failed FamStructWrapper operation: {0:?} + /// Failed FamStructWrapper operation: {0} Fam(utils::fam::Error), /// {0} GetMidrEl1(String), diff --git a/src/vmm/src/lib.rs b/src/vmm/src/lib.rs index 1584bd19158e..7af6d527ea9f 100644 --- a/src/vmm/src/lib.rs +++ b/src/vmm/src/lib.rs @@ -168,8 +168,7 @@ pub enum FcExitCode { Ok = 0, /// Generic error exit code. GenericError = 1, - /// Generic exit code for an error considered not possible to occur if the program logic is - /// sound. + /// Generic exit code error; not possible to occur if the program logic is sound. UnexpectedError = 2, /// Firecracker was shut down after intercepting a restricted system call. BadSyscall = 148, @@ -291,7 +290,7 @@ pub enum StartVcpusError { /// Error type for [`Vmm::dump_cpu_config()`] #[derive(Debug, thiserror::Error, displaydoc::Display)] pub enum DumpCpuConfigError { - /// Failed to send event to vcpu thread: {0:?} + /// Failed to send event to vcpu thread: {0} SendEvent(#[from] VcpuSendEventError), /// Got unexpected response from vcpu thread. UnexpectedResponse, diff --git a/src/vmm/src/rpc_interface.rs b/src/vmm/src/rpc_interface.rs index 6e18a06af4c4..adb526de91cb 100644 --- a/src/vmm/src/rpc_interface.rs +++ b/src/vmm/src/rpc_interface.rs @@ -293,7 +293,7 @@ pub type ApiResponse = Box>; /// Error type for `PrebootApiController::build_microvm_from_requests`. #[derive(Debug, thiserror::Error, displaydoc::Display, derive_more::From)] pub enum BuildMicrovmFromRequestsError { - /// Populating MMDS from file failed: {0:?}. + /// Populating MMDS from file failed: {0}. Mmds(data_store::MmdsDatastoreError), /// Loading snapshot failed. Restore, diff --git a/src/vmm/src/vmm_config/balloon.rs b/src/vmm/src/vmm_config/balloon.rs index 4b4e229b9ec0..5b6f25e86628 100644 --- a/src/vmm/src/vmm_config/balloon.rs +++ b/src/vmm/src/vmm_config/balloon.rs @@ -24,9 +24,9 @@ pub enum BalloonConfigError { TooManyPagesRequested, /// Statistics for the balloon device are not enabled StatsNotFound, - /// Error creating the balloon device: {0:?} + /// Error creating the balloon device: {0} CreateFailure(crate::devices::virtio::balloon::BalloonError), - /// Error updating the balloon device configuration: {0:?} + /// Error updating the balloon device configuration: {0} UpdateFailure(std::io::Error), /// Firecracker's huge pages support is incompatible with memory ballooning. HugePages, diff --git a/src/vmm/src/vmm_config/drive.rs b/src/vmm/src/vmm_config/drive.rs index 95865588d018..9e0c2efd7a1a 100644 --- a/src/vmm/src/vmm_config/drive.rs +++ b/src/vmm/src/vmm_config/drive.rs @@ -16,7 +16,7 @@ use crate::VmmError; /// Errors associated with the operations allowed on a drive. #[derive(Debug, thiserror::Error, displaydoc::Display)] pub enum DriveError { - /// Unable to create the virtio block device: {0:?} + /// Unable to create the virtio block device: {0} CreateBlockDevice(BlockError), /// Cannot create RateLimiter: {0} CreateRateLimiter(io::Error), diff --git a/src/vmm/src/vmm_config/vsock.rs b/src/vmm/src/vmm_config/vsock.rs index e19d8ed36586..8c170bd97a7d 100644 --- a/src/vmm/src/vmm_config/vsock.rs +++ b/src/vmm/src/vmm_config/vsock.rs @@ -13,9 +13,9 @@ type MutexVsockUnix = Arc>>; /// Errors associated with `NetworkInterfaceConfig`. #[derive(Debug, derive_more::From, thiserror::Error, displaydoc::Display)] pub enum VsockConfigError { - /// Cannot create backend for vsock device: {0:?} + /// Cannot create backend for vsock device: {0} CreateVsockBackend(VsockUnixBackendError), - /// Cannot create vsock device: {0:?} + /// Cannot create vsock device: {0} CreateVsockDevice(VsockError), } diff --git a/src/vmm/src/vstate/memory.rs b/src/vmm/src/vstate/memory.rs index 7b9021a89a5f..b23876b2262f 100644 --- a/src/vmm/src/vstate/memory.rs +++ b/src/vmm/src/vstate/memory.rs @@ -32,23 +32,23 @@ pub type GuestMmapRegion = vm_memory::MmapRegion>; /// Errors associated with dumping guest memory to file. #[derive(Debug, thiserror::Error, displaydoc::Display)] pub enum MemoryError { - /// Cannot access file: {0:?} + /// Cannot access file: {0} FileError(std::io::Error), - /// Cannot create memory: {0:?} + /// Cannot create memory: {0} CreateMemory(VmMemoryError), - /// Cannot create memory region: {0:?} + /// Cannot create memory region: {0} CreateRegion(MmapRegionError), - /// Cannot fetch system's page size: {0:?} + /// Cannot fetch system's page size: {0} PageSize(errno::Error), - /// Cannot dump memory: {0:?} + /// Cannot dump memory: {0} WriteMemory(GuestMemoryError), /// Cannot create mmap region: {0} MmapRegionError(MmapRegionError), /// Cannot create guest memory: {0} VmMemoryError(VmMemoryError), - /// Cannot create memfd: {0:?} + /// Cannot create memfd: {0} Memfd(memfd::Error), - /// Cannot resize memfd file: {0:?} + /// Cannot resize memfd file: {0} MemfdSetLen(std::io::Error), /// Cannot restore hugetlbfs backed snapshot by mapping the memory file. Please use uffd. HugetlbfsSnapshot, diff --git a/tests/integration_tests/functional/test_api.py b/tests/integration_tests/functional/test_api.py index 587a8d533b30..da504cd789f8 100644 --- a/tests/integration_tests/functional/test_api.py +++ b/tests/integration_tests/functional/test_api.py @@ -74,7 +74,9 @@ def test_drive_io_engine(uvm_plain): test_microvm.api.drive.put(io_engine="Async", **kwargs) # The Async engine is not supported for older kernels. test_microvm.check_log_message( - "Received Error. Status code: 400 Bad Request. Message: Drive config error: Unable to create the virtio block device: VirtioBackend(FileEngine(UnsupportedEngine(Async)))" + "Received Error. Status code: 400 Bad Request. Message: Drive config error: " + "Unable to create the virtio block device: Virtio backend error: " + "Error coming from the IO engine: Unsupported engine type: Async" ) # Now configure the default engine type and check that it works. diff --git a/tests/integration_tests/functional/test_cmd_line_start.py b/tests/integration_tests/functional/test_cmd_line_start.py index 897596c8b748..c45c42488477 100644 --- a/tests/integration_tests/functional/test_cmd_line_start.py +++ b/tests/integration_tests/functional/test_cmd_line_start.py @@ -331,7 +331,7 @@ def test_start_with_metadata_limit(uvm_plain): test_microvm.spawn() test_microvm.check_log_message( - "Populating MMDS from file failed: DataStoreLimitExceeded" + "Populating MMDS from file failed: The MMDS patch request doesn't fit." ) @@ -349,7 +349,7 @@ def test_start_with_metadata_default_limit(uvm_plain): test_microvm.spawn() test_microvm.check_log_message( - "Populating MMDS from file failed: DataStoreLimitExceeded" + "Populating MMDS from file failed: The MMDS patch request doesn't fit." ) From e55c2f43f5140e714225b27390f9ab172a08548d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 May 2024 16:11:50 +0000 Subject: [PATCH 10/12] build(deps): Bump the firecracker group with 19 updates Bumps the firecracker group with 19 updates: | Package | From | To | | --- | --- | --- | | [zerocopy](https://github.com/google/zerocopy) | `0.7.32` | `0.7.33` | | [serde](https://github.com/serde-rs/serde) | `1.0.199` | `1.0.200` | | [serde_derive](https://github.com/serde-rs/serde) | `1.0.199` | `1.0.200` | | [aws-lc-rs](https://github.com/awslabs/aws-lc-rs) | `1.7.0` | `1.7.1` | | [base64](https://github.com/marshallpierce/rust-base64) | `0.22.0` | `0.22.1` | | [anstream](https://github.com/rust-cli/anstyle) | `0.6.13` | `0.6.14` | | [anstyle](https://github.com/rust-cli/anstyle) | `1.0.6` | `1.0.7` | | [anstyle-parse](https://github.com/rust-cli/anstyle) | `0.2.3` | `0.2.4` | | [anstyle-query](https://github.com/rust-cli/anstyle) | `1.0.2` | `1.0.3` | | [anstyle-wincon](https://github.com/rust-cli/anstyle) | `3.0.2` | `3.0.3` | | [autocfg](https://github.com/cuviper/autocfg) | `1.2.0` | `1.3.0` | | [aws-lc-fips-sys](https://github.com/aws/aws-lc-rs) | `0.12.7` | `0.12.8` | | [aws-lc-sys](https://github.com/aws/aws-lc-rs) | `0.15.0` | `0.16.0` | | [cc](https://github.com/rust-lang/cc-rs) | `1.0.96` | `1.0.97` | | [colorchoice](https://github.com/rust-cli/anstyle) | `1.0.0` | `1.0.1` | | [getrandom](https://github.com/rust-random/getrandom) | `0.2.14` | `0.2.15` | | [num-traits](https://github.com/rust-num/num-traits) | `0.2.18` | `0.2.19` | | [winnow](https://github.com/winnow-rs/winnow) | `0.6.7` | `0.6.8` | | [zerocopy-derive](https://github.com/google/zerocopy) | `0.7.32` | `0.7.33` | Updates `zerocopy` from 0.7.32 to 0.7.33 - [Release notes](https://github.com/google/zerocopy/releases) - [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md) - [Commits](https://github.com/google/zerocopy/compare/v0.7.32...v0.7.33) Updates `serde` from 1.0.199 to 1.0.200 - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.199...v1.0.200) Updates `serde_derive` from 1.0.199 to 1.0.200 - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.199...v1.0.200) Updates `aws-lc-rs` from 1.7.0 to 1.7.1 - [Release notes](https://github.com/awslabs/aws-lc-rs/releases) - [Commits](https://github.com/awslabs/aws-lc-rs/compare/v1.7.0...v1.7.1) Updates `base64` from 0.22.0 to 0.22.1 - [Changelog](https://github.com/marshallpierce/rust-base64/blob/master/RELEASE-NOTES.md) - [Commits](https://github.com/marshallpierce/rust-base64/compare/v0.22.0...v0.22.1) Updates `anstream` from 0.6.13 to 0.6.14 - [Commits](https://github.com/rust-cli/anstyle/compare/anstream-v0.6.13...anstream-v0.6.14) Updates `anstyle` from 1.0.6 to 1.0.7 - [Commits](https://github.com/rust-cli/anstyle/compare/v1.0.6...v1.0.7) Updates `anstyle-parse` from 0.2.3 to 0.2.4 - [Commits](https://github.com/rust-cli/anstyle/compare/anstyle-parse-v0.2.3...anstyle-parse-v0.2.4) Updates `anstyle-query` from 1.0.2 to 1.0.3 - [Commits](https://github.com/rust-cli/anstyle/compare/anstyle-query-v1.0.2...anstyle-query-v1.0.3) Updates `anstyle-wincon` from 3.0.2 to 3.0.3 - [Commits](https://github.com/rust-cli/anstyle/compare/anstyle-wincon-v3.0.2...anstyle-wincon-v3.0.3) Updates `autocfg` from 1.2.0 to 1.3.0 - [Commits](https://github.com/cuviper/autocfg/compare/1.2.0...1.3.0) Updates `aws-lc-fips-sys` from 0.12.7 to 0.12.8 - [Release notes](https://github.com/aws/aws-lc-rs/releases) - [Commits](https://github.com/aws/aws-lc-rs/compare/aws-lc-fips-sys/v0.12.7...aws-lc-fips-sys/v0.12.8) Updates `aws-lc-sys` from 0.15.0 to 0.16.0 - [Release notes](https://github.com/aws/aws-lc-rs/releases) - [Commits](https://github.com/aws/aws-lc-rs/compare/aws-lc-sys/v0.15.0...aws-lc-sys/v0.16.0) Updates `cc` from 1.0.96 to 1.0.97 - [Release notes](https://github.com/rust-lang/cc-rs/releases) - [Commits](https://github.com/rust-lang/cc-rs/compare/1.0.96...1.0.97) Updates `colorchoice` from 1.0.0 to 1.0.1 - [Commits](https://github.com/rust-cli/anstyle/compare/colorchoice-v1.0.0...colorchoice-v1.0.1) Updates `getrandom` from 0.2.14 to 0.2.15 - [Changelog](https://github.com/rust-random/getrandom/blob/master/CHANGELOG.md) - [Commits](https://github.com/rust-random/getrandom/compare/v0.2.14...v0.2.15) Updates `num-traits` from 0.2.18 to 0.2.19 - [Changelog](https://github.com/rust-num/num-traits/blob/master/RELEASES.md) - [Commits](https://github.com/rust-num/num-traits/compare/num-traits-0.2.18...num-traits-0.2.19) Updates `winnow` from 0.6.7 to 0.6.8 - [Changelog](https://github.com/winnow-rs/winnow/blob/main/CHANGELOG.md) - [Commits](https://github.com/winnow-rs/winnow/compare/v0.6.7...v0.6.8) Updates `zerocopy-derive` from 0.7.32 to 0.7.33 - [Release notes](https://github.com/google/zerocopy/releases) - [Changelog](https://github.com/google/zerocopy/blob/main/CHANGELOG.md) - [Commits](https://github.com/google/zerocopy/compare/v0.7.32...v0.7.33) --- updated-dependencies: - dependency-name: zerocopy dependency-type: direct:production update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: serde_derive dependency-type: direct:production update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: aws-lc-rs dependency-type: direct:production update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: base64 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: anstream dependency-type: indirect update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: anstyle dependency-type: indirect update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: anstyle-parse dependency-type: indirect update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: anstyle-query dependency-type: indirect update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: anstyle-wincon dependency-type: indirect update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: autocfg dependency-type: indirect update-type: version-update:semver-minor dependency-group: firecracker - dependency-name: aws-lc-fips-sys dependency-type: indirect update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: aws-lc-sys dependency-type: indirect update-type: version-update:semver-minor dependency-group: firecracker - dependency-name: cc dependency-type: indirect update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: colorchoice dependency-type: indirect update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: getrandom dependency-type: indirect update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: num-traits dependency-type: indirect update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: winnow dependency-type: indirect update-type: version-update:semver-patch dependency-group: firecracker - dependency-name: zerocopy-derive dependency-type: indirect update-type: version-update:semver-patch dependency-group: firecracker ... Signed-off-by: dependabot[bot] --- Cargo.lock | 85 ++++++++++++++++-------------- src/acpi-tables/Cargo.toml | 2 +- src/cpu-template-helper/Cargo.toml | 2 +- src/firecracker/Cargo.toml | 6 +-- src/seccompiler/Cargo.toml | 2 +- src/utils/Cargo.toml | 2 +- src/vmm/Cargo.toml | 8 +-- 7 files changed, 57 insertions(+), 50 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8baffdcc5739..50dbed439cbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -64,47 +64,48 @@ checksum = "4b46cbb362ab8752921c97e041f5e366ee6297bd428a31275b9fcf1e380f7299" [[package]] name = "anstream" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" dependencies = [ "windows-sys", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", "windows-sys", @@ -112,15 +113,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "aws-lc-fips-sys" -version = "0.12.7" +version = "0.12.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae2108c0c026115b1bbc2e779aab668e802e98ae5f843b8cb470d8fc169db32e" +checksum = "592ea6b0df0a72ec29701890f4857bc25c5e95a93370afe9d70b5e41db6ffcf3" dependencies = [ "bindgen 0.69.4", "cmake", @@ -132,9 +133,9 @@ dependencies = [ [[package]] name = "aws-lc-rs" -version = "1.7.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5509d663b2c00ee421bda8d6a24d6c42e15970957de1701b8df9f6fbe5707df1" +checksum = "8487b59d62764df8231cb371c459314df895b41756df457a1fb1243d65c89195" dependencies = [ "aws-lc-fips-sys", "aws-lc-sys", @@ -146,9 +147,9 @@ dependencies = [ [[package]] name = "aws-lc-sys" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d5d317212c2a78d86ba6622e969413c38847b62f48111f8b763af3dac2f9840" +checksum = "c15eb61145320320eb919d9bab524617a7aa4216c78d342fae3a758bc33073e4" dependencies = [ "bindgen 0.69.4", "cc", @@ -161,9 +162,9 @@ dependencies = [ [[package]] name = "base64" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bincode" @@ -203,7 +204,7 @@ dependencies = [ "bitflags 2.5.0", "cexpr", "clang-sys", - "itertools 0.12.1", + "itertools 0.10.5", "lazy_static", "lazycell", "log", @@ -253,9 +254,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.0.96" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "065a29261d53ba54260972629f9ca6bffa69bac13cd1fed61420f7fa68b9f8bd" +checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" dependencies = [ "jobserver", "libc", @@ -404,9 +405,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "cpu-template-helper" @@ -627,9 +628,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -725,6 +726,12 @@ dependencies = [ "windows-sys", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itertools" version = "0.10.5" @@ -940,9 +947,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", @@ -1178,18 +1185,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.199" +version = "1.0.200" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9f6e76df036c77cd94996771fb40db98187f096dd0b9af39c6c6e452ba966a" +checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.199" +version = "1.0.200" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc" +checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" dependencies = [ "proc-macro2", "quote", @@ -1690,18 +1697,18 @@ checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" [[package]] name = "winnow" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14b9415ee827af173ebb3f15f9083df5a122eb93572ec28741fb153356ea2578" +checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" dependencies = [ "memchr", ] [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "087eca3c1eaf8c47b94d02790dd086cd594b912d2043d4de4bfdd466b3befb7c" dependencies = [ "byteorder", "zerocopy-derive", @@ -1709,9 +1716,9 @@ dependencies = [ [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "6f4b6c273f496d8fd4eaf18853e6b448760225dc030ff2c485a786859aea6393" dependencies = [ "proc-macro2", "quote", diff --git a/src/acpi-tables/Cargo.toml b/src/acpi-tables/Cargo.toml index 6e9612a72416..e8120e12e0bb 100644 --- a/src/acpi-tables/Cargo.toml +++ b/src/acpi-tables/Cargo.toml @@ -10,7 +10,7 @@ license = "Apache-2.0" displaydoc = "0.2.4" thiserror = "1.0.59" vm-memory = { version = "0.14.1", features = ["backend-mmap", "backend-bitmap"] } -zerocopy = { version = "0.7.32", features = ["derive"] } +zerocopy = { version = "0.7.33", features = ["derive"] } [lib] bench = false diff --git a/src/cpu-template-helper/Cargo.toml b/src/cpu-template-helper/Cargo.toml index 5af3675ba27b..0c1c882d35e5 100644 --- a/src/cpu-template-helper/Cargo.toml +++ b/src/cpu-template-helper/Cargo.toml @@ -14,7 +14,7 @@ clap = { version = "4.5.4", features = ["derive", "string"] } displaydoc = "0.2.4" libc = "0.2.154" log-instrument = { path = "../log-instrument", optional = true } -serde = { version = "1.0.199", features = ["derive"] } +serde = { version = "1.0.200", features = ["derive"] } serde_json = "1.0.116" thiserror = "1.0.59" diff --git a/src/firecracker/Cargo.toml b/src/firecracker/Cargo.toml index 20a09fed76ed..19ed5f36caff 100644 --- a/src/firecracker/Cargo.toml +++ b/src/firecracker/Cargo.toml @@ -23,7 +23,7 @@ log-instrument = { path = "../log-instrument", optional = true } micro_http = { git = "https://github.com/firecracker-microvm/micro-http" } seccompiler = { path = "../seccompiler" } -serde = { version = "1.0.199", features = ["derive"] } +serde = { version = "1.0.200", features = ["derive"] } serde_derive = "1.0.136" serde_json = "1.0.116" thiserror = "1.0.59" @@ -37,13 +37,13 @@ libc = "0.2.154" regex = { version = "1.10.4", default-features = false, features = ["std", "unicode-perl"] } # Dev-Dependencies for uffd examples -serde = { version = "1.0.199", features = ["derive"] } +serde = { version = "1.0.200", features = ["derive"] } userfaultfd = "0.8.1" [build-dependencies] bincode = "1.2.1" seccompiler = { path = "../seccompiler" } -serde = { version = "1.0.199" } +serde = { version = "1.0.200" } serde_json = "1.0.116" [features] diff --git a/src/seccompiler/Cargo.toml b/src/seccompiler/Cargo.toml index 232adef25c23..cf1cb143f694 100644 --- a/src/seccompiler/Cargo.toml +++ b/src/seccompiler/Cargo.toml @@ -20,7 +20,7 @@ bincode = "1.2.1" displaydoc = "0.2.4" libc = "0.2.154" log-instrument = { path = "../log-instrument", optional = true } -serde = { version = "1.0.199", features = ["derive"] } +serde = { version = "1.0.200", features = ["derive"] } serde_json = "1.0.116" thiserror = "1.0.59" diff --git a/src/utils/Cargo.toml b/src/utils/Cargo.toml index 0e39b34671b6..5aa69c6be4fe 100644 --- a/src/utils/Cargo.toml +++ b/src/utils/Cargo.toml @@ -13,7 +13,7 @@ derive_more = { version = "0.99.17", default-features = false, features = ["from displaydoc = "0.2.4" libc = "0.2.154" log-instrument = { path = "../log-instrument", optional = true } -serde = { version = "1.0.199", features = ["derive"] } +serde = { version = "1.0.200", features = ["derive"] } thiserror = "1.0.59" vm-memory = { version = "0.14.1", features = ["backend-mmap", "backend-bitmap"] } vmm-sys-util = { version = "0.12.1", features = ["with-serde"] } diff --git a/src/vmm/Cargo.toml b/src/vmm/Cargo.toml index e8ef32bd9d29..dae1c44792cb 100644 --- a/src/vmm/Cargo.toml +++ b/src/vmm/Cargo.toml @@ -11,8 +11,8 @@ bench = false [dependencies] acpi_tables = { path = "../acpi-tables" } aes-gcm = { version = "0.10.1", default-features = false, features = ["aes"] } -aws-lc-rs = { version = "1.7.0", features = ["bindgen"] } -base64 = "0.22.0" +aws-lc-rs = { version = "1.7.1", features = ["bindgen"] } +base64 = "0.22.1" bincode = "1.2.1" bitflags = "2.5.0" crc64 = "2.0.0" @@ -31,7 +31,7 @@ micro_http = { git = "https://github.com/firecracker-microvm/micro-http" } seccompiler = { path = "../seccompiler" } semver = { version = "1.0.17", features = ["serde"] } -serde = { version = "1.0.199", features = ["derive", "rc"] } +serde = { version = "1.0.200", features = ["derive", "rc"] } serde_json = "1.0.116" slab = "0.4.7" smallvec = "1.11.2" @@ -43,7 +43,7 @@ vhost = { version = "0.11.0", features = ["vhost-user-frontend"] } vm-allocator = "0.1.0" vm-memory = { version = "0.14.1", features = ["backend-mmap", "backend-bitmap"] } vm-superio = "0.8.0" -zerocopy = { version = "0.7.32" } +zerocopy = { version = "0.7.33" } [target.'cfg(target_arch = "aarch64")'.dependencies] vm-fdt = "0.3.0" From bc72ac4561e4a4299893c576082e0e8a46df8393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Barb=C3=A1chano?= Date: Mon, 6 May 2024 15:57:54 +0200 Subject: [PATCH 11/12] test: stop all monitors before killing microvm MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If a test fails, the FCmetricsMonitor keeps running in some tests. After we kill the microvm and remove the resources, the monitor complains it cannot find the metrics file. This is tricky to fix simply since we don't have a handle to the monitor either at fixture teardown or in the Microvm class. Add a hook in the Microvm class to register monitors, so we can stop all of them before killing the microvm. Also adapt existing monitors to fix this pattern. Signed-off-by: Pablo Barbáchano --- tests/framework/microvm.py | 9 ++++++--- tests/host_tools/fcmetrics.py | 16 +++++++++------- tests/host_tools/memory.py | 6 ++++++ 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/tests/framework/microvm.py b/tests/framework/microvm.py index 538ae1704a52..fccf032be893 100644 --- a/tests/framework/microvm.py +++ b/tests/framework/microvm.py @@ -204,9 +204,11 @@ def __init__( if int(os.environ.get("PYTEST_XDIST_WORKER_COUNT", 1)) > 1: self.time_api_requests = False + self.monitors = [] self.memory_monitor = None if monitor_memory: self.memory_monitor = MemoryMonitor(self) + self.monitors.append(self.memory_monitor) self.api = None self.log_file = None @@ -237,6 +239,10 @@ def kill(self): """All clean up associated with this microVM should go here.""" # pylint: disable=subprocess-run-check + # Stop any registered monitors + for monitor in self.monitors: + monitor.stop() + # We start with vhost-user backends, # because if we stop Firecracker first, the backend will want # to exit as well and this will cause a race condition. @@ -286,9 +292,6 @@ def kill(self): self._validate_api_response_times() if self.memory_monitor: - if self.memory_monitor.is_alive(): - self.memory_monitor.signal_stop() - self.memory_monitor.join(timeout=1) self.memory_monitor.check_samples() def _validate_api_response_times(self): diff --git a/tests/host_tools/fcmetrics.py b/tests/host_tools/fcmetrics.py index 1306c22bf59c..53caf4d4adcd 100644 --- a/tests/host_tools/fcmetrics.py +++ b/tests/host_tools/fcmetrics.py @@ -500,6 +500,7 @@ class FCMetricsMonitor(Thread): def __init__(self, vm, timer=60): Thread.__init__(self, daemon=True) self.vm = vm + vm.monitors.append(self) self.timer = timer self.metrics_index = 0 @@ -538,13 +539,14 @@ def stop(self): in sleep when stop is called and once it wakes out of sleep the "vm" might not be avaiable to provide the metrics. """ - self.running = False - # wait for the running thread to finish - # this should also avoid any race condition leading to - # uploading the same metrics twice - self.join() - self.vm.api.actions.put(action_type="FlushMetrics") - self._flush_metrics() + if self.is_alive(): + self.running = False + # wait for the running thread to finish + # this should also avoid any race condition leading to + # uploading the same metrics twice + self.join() + self.vm.api.actions.put(action_type="FlushMetrics") + self._flush_metrics() def run(self): self.running = True diff --git a/tests/host_tools/memory.py b/tests/host_tools/memory.py index fe9e7af931ea..690cda387016 100644 --- a/tests/host_tools/memory.py +++ b/tests/host_tools/memory.py @@ -46,6 +46,12 @@ def signal_stop(self): """Signal that the thread should stop.""" self._should_stop = True + def stop(self): + """Stop the thread""" + if self.is_alive(): + self.signal_stop() + self.join(timeout=1) + def run(self): """Thread for monitoring the RSS memory usage of a Firecracker process. From 252e85e6107f50eacb899cc7962b73c9f7325307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Barb=C3=A1chano?= Date: Mon, 15 Apr 2024 16:58:28 +0200 Subject: [PATCH 12/12] test: add a global dimension to test failure metric MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The current test failure metrics have high cardinality because they include the test name. This makes it hard to visualize them in CloudWatch since we run into aggregation limits. It would be nice to have one global failure rate, and some views per-kernel and per-CPU type. This adds 10 new metrics = 6 per-CPU + 3 per-host kernel + 1 global metric so it is not too costly. Signed-off-by: Pablo Barbáchano --- tests/conftest.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 4d6764856fb8..bcd9c1f69802 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -117,17 +117,24 @@ def record_props(request, record_property): def pytest_runtest_logreport(report): """Send general test metrics to CloudWatch""" if report.when == "call": - dimensions = { - "test": report.nodeid, - "instance": global_props.instance, - "cpu_model": global_props.cpu_model, - "host_kernel": "linux-" + global_props.host_linux_version, - } + METRICS.set_dimensions( + { + "test": report.nodeid, + "instance": global_props.instance, + "cpu_model": global_props.cpu_model, + "host_kernel": "linux-" + global_props.host_linux_version, + }, + # per host kernel + {"host_kernel": "linux-" + global_props.host_linux_version}, + # per CPU + {"cpu_model": global_props.cpu_model}, + # and global + {}, + ) METRICS.set_property("result", report.outcome) METRICS.set_property("location", report.location) for prop_name, prop_val in report.user_properties: METRICS.set_property(prop_name, prop_val) - METRICS.set_dimensions(dimensions) METRICS.put_metric( "duration", report.duration,