mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-21 03:55:32 +00:00
SPU: Detect reservation spinning loop
This commit is contained in:
parent
3be687cd18
commit
7d7909149f
1 changed files with 7 additions and 19 deletions
|
@ -1718,33 +1718,21 @@ bool spu_thread::process_mfc_cmd()
|
|||
{
|
||||
const u32 addr = ch_mfc_cmd.eal & -128;
|
||||
const auto& data = vm::_ref<decltype(rdata)>(addr);
|
||||
auto& dst = _ref<decltype(rdata)>(ch_mfc_cmd.lsa & 0x3ff80);
|
||||
u64 ntime;
|
||||
|
||||
const bool is_polling = false; // TODO
|
||||
|
||||
if (is_polling)
|
||||
if (addr == raddr && g_cfg.core.spu_loop_detection && rtime == vm::reservation_acquire(addr, 128) && cmp_rdata(rdata, data))
|
||||
{
|
||||
rtime = vm::reservation_acquire(addr, 128) & -128;
|
||||
|
||||
while (cmp_rdata(rdata, data) && (vm::reservation_acquire(addr, 128)) == rtime)
|
||||
if (g_use_rtm)
|
||||
{
|
||||
state += cpu_flag::wait;
|
||||
|
||||
if (is_stopped())
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
thread_ctrl::wait_for(500);
|
||||
}
|
||||
|
||||
if (test_stopped())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// Spinning, might as well yield cpu resources
|
||||
std::this_thread::yield();
|
||||
}
|
||||
|
||||
auto& dst = _ref<decltype(rdata)>(ch_mfc_cmd.lsa & 0x3ff80);
|
||||
u64 ntime;
|
||||
|
||||
for (u64 i = 0;; [&]()
|
||||
{
|
||||
if (ntime & 127 && g_use_rtm && !(state & cpu_flag::wait))
|
||||
|
|
Loading…
Add table
Reference in a new issue