From c10d82f73aa03c39bc757a7b8029e3ac8f8af71b Mon Sep 17 00:00:00 2001 From: DH Date: Tue, 2 Dec 2025 04:43:00 +0300 Subject: [PATCH] orbis: remove incomplete check from dmem & add debug log for blockpool --- kernel/orbis/src/blockpool.cpp | 17 +++++++++++------ kernel/orbis/src/dmem.cpp | 6 +++--- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/kernel/orbis/src/blockpool.cpp b/kernel/orbis/src/blockpool.cpp index c2389e954..6379f1ac5 100644 --- a/kernel/orbis/src/blockpool.cpp +++ b/kernel/orbis/src/blockpool.cpp @@ -6,6 +6,7 @@ #include "rx/AddressRange.hpp" #include "rx/MemoryTable.hpp" #include "rx/die.hpp" +#include "rx/format.hpp" #include "thread/Process.hpp" #include "vmem.hpp" #include @@ -187,14 +188,16 @@ struct PooledMemoryResource { auto mapVirtualRange = rx::AddressRange::fromBeginSize( virtualRange.beginAddress(), block.size()); - virtualRange = rx::AddressRange::fromBeginEnd( - mapVirtualRange.endAddress(), virtualRange.endAddress()); - auto errc = orbis::pmem::map(mapVirtualRange.beginAddress(), block, orbis::vmem::toCpuProtection(protection)); rx::dieIf(errc != orbis::ErrorCode{}, - "blockpool: failed to map physical memory"); + "blockpool: failed to map physical memory, vmem {:x}-{:x}, " + "pmem {:x}-{:x}, commit vmem {:x}-{:x}, error {}", + mapVirtualRange.beginAddress(), mapVirtualRange.endAddress(), + block.beginAddress(), block.endAddress(), + virtualRange.beginAddress(), virtualRange.endAddress(), errc); + amdgpu::mapMemory(process->pid, mapVirtualRange, type, protection, block.beginAddress()); @@ -202,6 +205,9 @@ struct PooledMemoryResource { {.pmemAddress = block.beginAddress(), .type = type}, false); freeBlocks.pop_back(); + + virtualRange = rx::AddressRange::fromBeginEnd( + mapVirtualRange.endAddress(), virtualRange.endAddress()); } } @@ -309,8 +315,7 @@ orbis::ErrorCode orbis::blockpool::commit(Process *process, rx::AddressRange vmemRange, MemoryType type, rx::EnumBitSet protection) { - auto pool = - type == MemoryType::WbOnion ? g_cachedBlockpool : g_blockpool; + auto pool = type == MemoryType::WbOnion ? g_cachedBlockpool : g_blockpool; auto otherPool = type == MemoryType::WbOnion ? g_blockpool : g_cachedBlockpool; diff --git a/kernel/orbis/src/dmem.cpp b/kernel/orbis/src/dmem.cpp index 37a3e8cd1..8b4645c8f 100644 --- a/kernel/orbis/src/dmem.cpp +++ b/kernel/orbis/src/dmem.cpp @@ -673,9 +673,9 @@ orbis::ErrorCode orbis::dmem::map(orbis::Process *process, unsigned dmemIndex, return ErrorCode::ACCES; } - if (!allocationInfoIt->mappings.empty() && !process->allowDmemAliasing) { - return ErrorCode::INVAL; - } + // if (!allocationInfoIt->mappings.empty() && !process->allowDmemAliasing) { + // return ErrorCode::INVAL; + // } auto directRange = rx::AddressRange::fromBeginSize(offset, range.size()) .intersection(allocationInfoIt.range());