Skip to content

Commit

Permalink
Adding CVM_ALLOWED to critical errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jazzybluesea committed Dec 17, 2024
1 parent 044a158 commit 4a5d652
Show file tree
Hide file tree
Showing 53 changed files with 239 additions and 46 deletions.
22 changes: 22 additions & 0 deletions Cargo.lock
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ dependencies = [
"chipset_device",
"chipset_device_resources",
"chipset_resources",
"cvm_tracing",
"futures",
"input_core",
"inspect",
Expand Down Expand Up @@ -1844,6 +1845,7 @@ dependencies = [
"anyhow",
"async-trait",
"chipset_device",
"cvm_tracing",
"guestmem",
"inspect",
"memory_range",
Expand Down Expand Up @@ -2169,6 +2171,7 @@ dependencies = [
"anyhow",
"async-trait",
"chipset_device",
"cvm_tracing",
"device_emulators",
"futures",
"gdma_defs",
Expand Down Expand Up @@ -2368,6 +2371,7 @@ version = "0.0.0"
dependencies = [
"anyhow",
"async-trait",
"cvm_tracing",
"get_protocol",
"get_resources",
"guestmem",
Expand Down Expand Up @@ -2447,6 +2451,7 @@ version = "0.0.0"
dependencies = [
"anyhow",
"chipset_resources",
"cvm_tracing",
"futures",
"futures-concurrency",
"get_protocol",
Expand Down Expand Up @@ -2598,6 +2603,7 @@ version = "0.0.0"
dependencies = [
"anyhow",
"async-trait",
"cvm_tracing",
"guid",
"inspect",
"open_enum",
Expand Down Expand Up @@ -2758,6 +2764,7 @@ dependencies = [
"cfg-if",
"chipset_device_resources",
"chipset_legacy",
"cvm_tracing",
"debug_ptr",
"disk_backend",
"fdt",
Expand Down Expand Up @@ -2865,6 +2872,7 @@ name = "hvlite_helpers"
version = "0.0.0"
dependencies = [
"anyhow",
"cvm_tracing",
"disk_backend_resources",
"disk_vhd1",
"disk_vhdmp",
Expand Down Expand Up @@ -2985,6 +2993,7 @@ dependencies = [
name = "hyperv_ic_guest"
version = "0.0.0"
dependencies = [
"cvm_tracing",
"guid",
"hyperv_ic_protocol",
"hyperv_ic_resources",
Expand Down Expand Up @@ -3584,6 +3593,7 @@ version = "0.0.0"
dependencies = [
"anyhow",
"chipset_device",
"cvm_tracing",
"futures",
"gdma",
"gdma_defs",
Expand Down Expand Up @@ -4269,6 +4279,7 @@ version = "0.0.0"
dependencies = [
"async-trait",
"chipset_device",
"cvm_tracing",
"device_emulators",
"disk_backend",
"event-listener",
Expand Down Expand Up @@ -4312,6 +4323,7 @@ version = "0.0.0"
dependencies = [
"anyhow",
"chipset_device",
"cvm_tracing",
"disklayer_ram",
"event-listener",
"futures",
Expand Down Expand Up @@ -4557,6 +4569,7 @@ dependencies = [
"clap",
"clap_dyn_complete",
"console_relay",
"cvm_tracing",
"debug_worker_defs",
"diag_client",
"dirs",
Expand Down Expand Up @@ -6141,6 +6154,7 @@ dependencies = [
"anyhow",
"async-trait",
"criterion",
"cvm_tracing",
"disklayer_ram",
"event-listener",
"fast_select",
Expand Down Expand Up @@ -7037,6 +7051,7 @@ name = "underhill_crash"
version = "0.0.0"
dependencies = [
"anyhow",
"cvm_tracing",
"fs-err",
"futures",
"get_protocol",
Expand All @@ -7057,6 +7072,7 @@ name = "underhill_dump"
version = "0.0.0"
dependencies = [
"anyhow",
"cvm_tracing",
"elfcore",
"libc",
"tracing",
Expand Down Expand Up @@ -7097,6 +7113,7 @@ version = "0.0.0"
dependencies = [
"anyhow",
"build_rs_guest_arch",
"cvm_tracing",
"futures",
"guestmem",
"hcl",
Expand Down Expand Up @@ -7390,6 +7407,7 @@ dependencies = [
"bitfield-struct",
"build_rs_guest_arch",
"cfg-if",
"cvm_tracing",
"guestmem",
"hv1_emulator",
"hv1_hypercall",
Expand Down Expand Up @@ -7454,6 +7472,7 @@ dependencies = [
"bitvec",
"build_rs_guest_arch",
"cfg-if",
"cvm_tracing",
"fs-err",
"guestmem",
"hcl",
Expand Down Expand Up @@ -8148,6 +8167,7 @@ dependencies = [
"anyhow",
"cfg-if",
"crc32fast",
"cvm_tracing",
"disk_backend",
"disklayer_ram",
"getrandom",
Expand Down Expand Up @@ -8261,6 +8281,7 @@ dependencies = [
"build_rs_guest_arch",
"cache_topology",
"chipset",
"cvm_tracing",
"futures",
"futures-concurrency",
"guestmem",
Expand Down Expand Up @@ -8494,6 +8515,7 @@ dependencies = [
"chipset_arc_mutex_device",
"chipset_device",
"closeable_mutex",
"cvm_tracing",
"device_emulators",
"guestmem",
"guid",
Expand Down
12 changes: 10 additions & 2 deletions openhcl/underhill_core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,11 @@ async fn do_main(driver: DefaultDriver, mut tracing: TracingBackend) -> anyhow::

let r = run_control(driver, &mesh, opt, &mut tracing).await;
if let Err(err) = &r {
tracing::error!(error = err.as_ref() as &dyn std::error::Error, "VM failure");
tracing::error!(
CVM_ALLOWED,
error = err.as_ref() as &dyn std::error::Error,
"VM failure"
);
}

// Wait a few seconds for child processes to terminate and tracing to finish.
Expand Down Expand Up @@ -725,7 +729,11 @@ async fn run_control(
return Err(anyhow::Error::from(err)).context("vm worker failed");
}
WorkerEvent::RestartFailed(err) => {
tracing::error!(error = &err as &dyn std::error::Error, "restart failed");
tracing::error!(
CVM_ALLOWED,
error = &err as &dyn std::error::Error,
"restart failed"
);
restart_response.take().unwrap().send(Err(err));
state = ControlState::Started;
}
Expand Down
16 changes: 12 additions & 4 deletions openhcl/underhill_core/src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ use anyhow::Context;
use async_trait::async_trait;
use chipset_device::ChipsetDevice;
use closeable_mutex::CloseableMutex;
use cvm_tracing::CVM_ALLOWED;
use debug_ptr::DebugPtr;
use disk_backend::Disk;
use disk_blockdevice::BlockDeviceResolver;
Expand Down Expand Up @@ -359,6 +360,7 @@ impl Worker for UnderhillVmWorker {

if let Err(err) = &result {
tracing::error!(
CVM_ALLOWED,
error = err.as_ref() as &dyn std::error::Error,
"failed to start VM"
);
Expand Down Expand Up @@ -683,6 +685,7 @@ impl UhVmNetworkSettings {
for instance_id in instance_ids {
if !nic_channels.iter().any(|(id, _)| *id == instance_id) {
tracing::error!(
CVM_ALLOWED,
"No vmbus channel found that matches VF Manager instance_id: {instance_id}"
);
}
Expand Down Expand Up @@ -936,6 +939,7 @@ impl LoadedVmNetworkSettings for UhVmNetworkSettings {
.collect::<anyhow::Result<Vec<_>>>();
if let Err(err) = result {
tracing::error!(
CVM_ALLOWED,
error = err.as_ref() as &dyn std::error::Error,
rollback,
"Failed preparing accelerated network devices for hibernate"
Expand Down Expand Up @@ -1198,7 +1202,7 @@ async fn new_underhill_vm(
servicing_state.flush_logs_result
{
if let Some(error) = error {
tracing::error!(duration_us, error, "flush logs result")
tracing::error!(CVM_ALLOWED, duration_us, error, "flush logs result")
} else {
tracing::info!(duration_us, "flush logs result")
}
Expand Down Expand Up @@ -1424,7 +1428,11 @@ async fn new_underhill_vm(
} else {
// BUGBUG: This needs to be fixed, but allow it with just an error
// log for now.
tracing::error!(alias_map, "alias map bit larger than supported");
tracing::error!(
CVM_ALLOWED,
alias_map,
"alias map bit larger than supported"
);
false
}
});
Expand Down Expand Up @@ -1630,7 +1638,7 @@ async fn new_underhill_vm(
// VBS not supported yet, fall back to the host type.
// Raise an error message instead of aborting so that
// we do not block VBS bringup.
tracing::error!("VBS attestation not supported yet");
tracing::error!(CVM_ALLOWED, "VBS attestation not supported yet");
// TODO VBS: Support VBS attestation
AttestationType::Host
}
Expand Down Expand Up @@ -2049,7 +2057,7 @@ async fn new_underhill_vm(
match res {
Ok(vars) => vars,
Err(e) => {
tracing::error!("Failed to load custom UEFI vars");
tracing::error!(CVM_ALLOWED, "Failed to load custom UEFI vars");
get_client
.event_log_fatal(EventLogId::BOOT_FAILURE_SECURE_BOOT_FAILED)
.await;
Expand Down
1 change: 1 addition & 0 deletions openhcl/underhill_crash/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ guid.workspace = true
libc.workspace = true
thiserror.workspace = true
tracing.workspace = true
cvm_tracing.workspace = true
tracing-subscriber.workspace = true
zerocopy.workspace = true

Expand Down
Loading

0 comments on commit 4a5d652

Please sign in to comment.