SPU: fixup after #9630

Co-Authored-By: Ivan <nekotekina@gmail.com>
This commit is contained in:
Eladash 2021-01-21 18:29:37 +02:00 committed by Ivan
parent 12e1be2626
commit a58c12db0b
3 changed files with 19 additions and 6 deletions

View File

@ -914,6 +914,7 @@ void ppu_thread::exec_task()
ppu_thread::~ppu_thread() ppu_thread::~ppu_thread()
{ {
perf_log.notice("Perf stats for STCX reload: successs %u, failure %u", last_succ, last_fail);
} }
ppu_thread::ppu_thread(const ppu_thread_params& param, std::string_view name, u32 prio, int detached) ppu_thread::ppu_thread(const ppu_thread_params& param, std::string_view name, u32 prio, int detached)

View File

@ -1675,6 +1675,16 @@ void spu_thread::cpu_task()
} }
} }
struct raw_spu_cleanup
{
~raw_spu_cleanup()
{
std::memset(spu_thread::g_raw_spu_id, 0, sizeof(spu_thread::g_raw_spu_id));
spu_thread::g_raw_spu_ctr = 0;
g_fxo->get<raw_spu_cleanup>(); // Register destructor
}
};
void spu_thread::cleanup() void spu_thread::cleanup()
{ {
const u32 addr = group ? SPU_FAKE_BASE_ADDR + SPU_LS_SIZE * (id & 0xffffff) : RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * index; const u32 addr = group ? SPU_FAKE_BASE_ADDR + SPU_LS_SIZE * (id & 0xffffff) : RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * index;
@ -1689,11 +1699,8 @@ void spu_thread::cleanup()
g_raw_spu_ctr--; g_raw_spu_ctr--;
} }
// Free range lock // Free range lock (and signals cleanup was called to the destructor)
vm::free_range_lock(range_lock); vm::free_range_lock(std::exchange(range_lock, nullptr));
perf_log.notice("Perf stats for transactions: success %u, failure %u", stx, ftx);
perf_log.notice("Perf stats for PUTLLC reload: successs %u, failure %u", last_succ, last_fail);
} }
spu_thread::~spu_thread() spu_thread::~spu_thread()
@ -1710,6 +1717,12 @@ spu_thread::~spu_thread()
// Release LS mirrors area // Release LS mirrors area
utils::memory_release(ls - (SPU_LS_SIZE * 2), SPU_LS_SIZE * 5); utils::memory_release(ls - (SPU_LS_SIZE * 2), SPU_LS_SIZE * 5);
// Free range lock if not freed already
if (range_lock) vm::free_range_lock(range_lock);
perf_log.notice("Perf stats for transactions: success %u, failure %u", stx, ftx);
perf_log.notice("Perf stats for PUTLLC reload: successs %u, failure %u", last_succ, last_fail);
} }
spu_thread::spu_thread(lv2_spu_group* group, u32 index, std::string_view name, u32 lv2_id, bool is_isolated, u32 option) spu_thread::spu_thread(lv2_spu_group* group, u32 index, std::string_view name, u32 lv2_id, bool is_isolated, u32 option)

View File

@ -49,7 +49,6 @@ bool ppu_thread_exit(ppu_thread& ppu)
dct->used -= ppu.stack_size; dct->used -= ppu.stack_size;
} }
perf_log.notice("Perf stats for STCX reload: successs %u, failure %u", ppu.last_succ, ppu.last_fail);
return false; return false;
} }