Skip to content

Commit 127b33f

Browse files
committed
reduce error spam for dead hwc resources
1 parent b624c77 commit 127b33f

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

vm/devices/net/mana_driver/src/gdma_driver.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1495,15 +1495,16 @@ impl<T: DeviceBacking> GdmaDriver<T> {
14951495
)
14961496
.await
14971497
}
1498+
1499+
/// Returns true if the HWC has failed and no further requests will succeed.
1500+
pub fn hwc_failure(&self) -> bool {
1501+
self.hwc_failure
1502+
}
14981503
}
14991504

15001505
#[cfg(test)]
15011506
impl<T: DeviceBacking> GdmaDriver<T> {
15021507
pub(crate) fn hwc_timeout_in_ms(&self) -> u32 {
15031508
self.hwc_timeout_in_ms
15041509
}
1505-
1506-
pub(crate) fn hwc_failure(&self) -> bool {
1507-
self.hwc_failure
1508-
}
15091510
}

vm/devices/net/mana_driver/src/resources.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,23 @@ impl ResourceArena {
6363
}
6464

6565
pub(crate) async fn destroy<T: DeviceBacking>(mut self, gdma: &mut GdmaDriver<T>) {
66+
// When HWC has already failed, skip sending teardown commands for HWC resources:
67+
// DmaRegion, Eq, BnicQueue. HWC requests all fail: "Previous hardware failure".
68+
// Device should reclaim resources on its own reset.
69+
let skip_hwc = gdma.hwc_failure();
70+
if skip_hwc {
71+
tracing::info!(
72+
count = self.resources.len(),
73+
"skipping HWC resource teardown after hardware failure"
74+
);
75+
}
6676
for resource in self.resources.drain(..).rev() {
6777
let r = match resource {
6878
Resource::MemoryBlock(mem) => {
6979
drop(ManuallyDrop::into_inner(mem));
7080
Ok(())
7181
}
82+
_ if skip_hwc => continue,
7283
Resource::DmaRegion {
7384
dev_id,
7485
gdma_region,

0 commit comments

Comments
 (0)