Skip to content

Commit

Permalink
SPU: fixup after #9630
Browse files Browse the repository at this point in the history
Co-Authored-By: Ivan <nekotekina@gmail.com>
  • Loading branch information
elad335 and Nekotekina committed Jan 21, 2021
1 parent 12e1be2 commit a58c12d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions rpcs3/Emu/Cell/PPUThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,7 @@ void ppu_thread::exec_task()

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)
Expand Down
23 changes: 18 additions & 5 deletions rpcs3/Emu/Cell/SPUThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
const u32 addr = group ? SPU_FAKE_BASE_ADDR + SPU_LS_SIZE * (id & 0xffffff) : RAW_SPU_BASE_ADDR + RAW_SPU_OFFSET * index;
Expand All @@ -1689,11 +1699,8 @@ void spu_thread::cleanup()
g_raw_spu_ctr--;
}

// Free 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);
// Free range lock (and signals cleanup was called to the destructor)
vm::free_range_lock(std::exchange(range_lock, nullptr));
}

spu_thread::~spu_thread()
Expand All @@ -1710,6 +1717,12 @@ spu_thread::~spu_thread()

// Release LS mirrors area
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)
Expand Down
1 change: 0 additions & 1 deletion rpcs3/Emu/Cell/lv2/sys_ppu_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ bool ppu_thread_exit(ppu_thread& ppu)
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;
}

Expand Down

0 comments on commit a58c12d

Please sign in to comment.