Skip to content

Commit

Permalink
SPU: Cleanup GETLLAR
Browse files Browse the repository at this point in the history
  • Loading branch information
elad335 committed Jun 18, 2024
1 parent 1f94c23 commit 5e75a50
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions rpcs3/Emu/Cell/SPUThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4583,13 +4583,11 @@ bool spu_thread::process_mfc_cmd()
busy_wait(300);
}

last_gtsc = utils::get_tsc();
}
else
{
last_gtsc = perf0.get();
// Reset perf
perf0.restart();
}

last_gtsc = perf0.get();
return true;
}

Expand All @@ -4603,9 +4601,6 @@ bool spu_thread::process_mfc_cmd()

get_resrv_waiters_count(addr)--;

// Reset perf
perf0.restart();

// Quick check if there were reservation changes
const u64 new_time = res;

Expand All @@ -4630,17 +4625,19 @@ bool spu_thread::process_mfc_cmd()
u8& val = getllar_wait_time[pc / 32].front();
val = static_cast<u8>(std::min<u32>(val + 1, u8{umax}));

last_gtsc = utils::get_tsc();
// Reset perf
perf0.restart();
last_gtsc = perf0.get();
return true;
}

static atomic_t<u32> g_ctr, g_fail;
static atomic_t<u32> g_changed, g_unchanged;

if (new_time == this_time && res == this_time)
{
spu_log.trace("RTIME unchanged on address 0x%x", addr);

g_fail++;
g_unchanged++;

// Try to forcefully change timestamp in order to notify threads
if (get_resrv_waiters_count(addr) && res.compare_and_swap_test(this_time, this_time + 128))
Expand All @@ -4650,11 +4647,13 @@ bool spu_thread::process_mfc_cmd()
}
else
{
g_ctr++;
g_changed++;
}

if ((g_ctr + g_fail) % 200 == 0)
spu_log.trace("SPU 100WAIT: fail=%d, ok=%d", +g_fail, +g_ctr);
if ((g_changed + g_unchanged) % 200 == 0)
{
spu_log.trace("SPU GETLLAR wait on RTIME stats: unchanged=%d, changed=%d", +g_unchanged, +g_changed);
}
}
}

Expand All @@ -4670,6 +4669,9 @@ bool spu_thread::process_mfc_cmd()
// We can't, LR needs to be set now
set_events(SPU_EVENT_LR);
static_cast<void>(test_stopped());

// Reset perf
perf0.restart();
}

last_getllar = pc;
Expand Down

0 comments on commit 5e75a50

Please sign in to comment.