Skip to content

Commit bddef9a

Browse files
dma_client: remove fallback allocator (#2350)
#2061 added a fallback allocator for situations where the private pool is available but persistence isn't needed. This had the unintended effect of MANA devices using the private pool when available even though its memory won't be persisted or restored. This leads to restoration failures on servicing because not all memory from the private pool is restored, and could also lead to scenarios where MANA could exhaust the private pool even though it doesn't need to use it. This change removes the fallback allocator so this scenario isn't possible.
1 parent 1f72974 commit bddef9a

File tree

3 files changed

+2
-26
lines changed

3 files changed

+2
-26
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5041,7 +5041,6 @@ dependencies = [
50415041
"memory_range",
50425042
"mesh",
50435043
"page_pool_alloc",
5044-
"tracing",
50455044
"user_driver",
50465045
"virt",
50475046
"vmcore",

openhcl/openhcl_dma_manager/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ virt.workspace = true
2121
vmcore.workspace = true
2222

2323
anyhow.workspace = true
24-
tracing.workspace = true
2524

2625
[lints]
2726
workspace = true

openhcl/openhcl_dma_manager/src/lib.rs

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -287,20 +287,12 @@ impl DmaManagerInner {
287287
allocation_visibility: AllocationVisibility::Private,
288288
persistent_allocations: false,
289289
shared_spawner: _,
290-
private_spawner,
290+
private_spawner: _,
291291
} => match lower_vtl_policy {
292292
LowerVtlPermissionPolicy::Any => {
293293
// No persistence needed means the `LockedMemorySpawner`
294294
// using normal VTL2 ram is fine.
295-
match private_spawner {
296-
Some(private) => DmaClientBacking::PrivatePoolWithFallback((
297-
private
298-
.allocator(device_name.into())
299-
.context("failed to create private allocator")?,
300-
LockedMemorySpawner,
301-
)),
302-
None => DmaClientBacking::LockedMemory(LockedMemorySpawner),
303-
}
295+
DmaClientBacking::LockedMemory(LockedMemorySpawner)
304296
}
305297
LowerVtlPermissionPolicy::Vtl0 => {
306298
// `LockedMemorySpawner` uses private VTL2 ram, so
@@ -425,7 +417,6 @@ enum DmaClientBacking {
425417
SharedPool(#[inspect(skip)] PagePoolAllocator),
426418
PrivatePool(#[inspect(skip)] PagePoolAllocator),
427419
LockedMemory(#[inspect(skip)] LockedMemorySpawner),
428-
PrivatePoolWithFallback(#[inspect(skip)] (PagePoolAllocator, LockedMemorySpawner)),
429420
PrivatePoolLowerVtl(#[inspect(skip)] LowerVtlMemorySpawner<PagePoolAllocator>),
430421
LockedMemoryLowerVtl(#[inspect(skip)] LowerVtlMemorySpawner<LockedMemorySpawner>),
431422
}
@@ -439,16 +430,6 @@ impl DmaClientBacking {
439430
DmaClientBacking::SharedPool(allocator) => allocator.allocate_dma_buffer(total_size),
440431
DmaClientBacking::PrivatePool(allocator) => allocator.allocate_dma_buffer(total_size),
441432
DmaClientBacking::LockedMemory(spawner) => spawner.allocate_dma_buffer(total_size),
442-
DmaClientBacking::PrivatePoolWithFallback((allocator, spawner)) => {
443-
allocator.allocate_dma_buffer(total_size).or_else(|err| {
444-
tracing::warn!(
445-
size = total_size,
446-
error = ?err,
447-
"falling back to locked memory for dma allocation"
448-
);
449-
spawner.allocate_dma_buffer(total_size)
450-
})
451-
}
452433
DmaClientBacking::PrivatePoolLowerVtl(spawner) => {
453434
spawner.allocate_dma_buffer(total_size)
454435
}
@@ -462,9 +443,6 @@ impl DmaClientBacking {
462443
match self {
463444
DmaClientBacking::SharedPool(allocator) => allocator.attach_pending_buffers(),
464445
DmaClientBacking::PrivatePool(allocator) => allocator.attach_pending_buffers(),
465-
DmaClientBacking::PrivatePoolWithFallback(_) => {
466-
anyhow::bail!("cannot attach pending buffers with fallback allocator")
467-
}
468446
DmaClientBacking::LockedMemory(_) => {
469447
anyhow::bail!(
470448
"attaching pending buffers is not supported with locked memory; \

0 commit comments

Comments
 (0)