mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 22:19:02 +00:00
CELL: Postponed address notifications
This commit is contained in:
parent
384c807d6a
commit
dddd12f66b
4 changed files with 86 additions and 6 deletions
|
|
@ -3049,12 +3049,29 @@ static bool ppu_store_reservation(ppu_thread& ppu, u32 addr, u64 reg_value)
|
|||
return false;
|
||||
}())
|
||||
{
|
||||
// Test a common pattern in lwmutex
|
||||
extern atomic_t<u32> liblv2_begin, liblv2_end;
|
||||
|
||||
const u32 notify = ppu.res_notify;
|
||||
|
||||
if (notify)
|
||||
{
|
||||
vm::reservation_notifier(notify).notify_all();
|
||||
ppu.res_notify = 0;
|
||||
}
|
||||
|
||||
// Avoid notifications from lwmutex or sys_spinlock
|
||||
if (ppu.cia < liblv2_begin || ppu.cia >= liblv2_end)
|
||||
{
|
||||
res.notify_all();
|
||||
if (!notify)
|
||||
{
|
||||
// Try to postpone notification to when PPU is asleep or join notifications on the same address
|
||||
// This also optimizes a mutex - won't notify after lock is aqcuired (prolonging the critical section duration), only notifies on unlock
|
||||
ppu.res_notify = addr;
|
||||
}
|
||||
else if ((addr ^ notify) & -128)
|
||||
{
|
||||
res.notify_all();
|
||||
}
|
||||
}
|
||||
|
||||
if (addr == ppu.last_faddr)
|
||||
|
|
@ -3066,6 +3083,16 @@ static bool ppu_store_reservation(ppu_thread& ppu, u32 addr, u64 reg_value)
|
|||
return true;
|
||||
}
|
||||
|
||||
const u32 notify = ppu.res_notify;
|
||||
|
||||
// Do not risk postponing too much (because this is probably an indefinite loop)
|
||||
// And on failure it has some time to do something else
|
||||
if (notify && ((addr ^ notify) & -128))
|
||||
{
|
||||
vm::reservation_notifier(notify).notify_all();
|
||||
ppu.res_notify = 0;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue