Reimplement RSX reservation access #8983
Conversation
|
I think you need to add it to texture faults handling as well. |
|
Those are atomic as the pages are no-access. Flushing is done in mirror space so no way we can have contesting writes. |
|
Is there a opential deadlock here where SPU enters texture cache fault handler for adderess X on a reservation then when RSX waits on the same address to be unlocked it cannot handle the texture cache fault and the SPU and RSX freezes because they wait for each other forever? |
|
On this PR L.A Noire locks up in the menu with reservations enabled. |
5e13b5b
to
677b3b6
|
FTR, deadlock on RSX-is-asleep-while-SPU-thread-is-in-exception-handling was always a problem. Fixing it in a straightforward manner would be terrible and allows other threads to essentially starve RSX of the locks, which means a custom primitive with first come first serve is needed that optionally invokes a callback while waiting and still maintains request order. This is easy to do on *nix but not so much on windows so I need to think of something that plays a bit nicer and doesn't scare people. I have a few ideas I'd love to try out; we'll see which implementation is the winner. |
|
@xddxd I forgot to request a retest, I fixed a potential deadlock. |
|
Same behavior. |
|
L.A Noire discussion moved to #9134 |
This PR adds block-level reservation management for RSX vs CELL. The basic design philosophy here is that when "Accurate RSX reservations" is enabled, access to memory shared between CELL and RSX is accessed in an exclusive manner. Multiple CELL threads are free to simultaneously manipulate memory as they have their own synchronization mechanisms, but RSX accesses said memory in an exclusive manner. This fixes a lot of problems where SPU/PPU has a reservation line but data is clobbered by RSX DMA operations. TSX normally fixes this issue for capable CPUs which is why some users can play affected games at good performance with no issues.
The advantage of doing it this way of course is performance, the performance hit is now much less and games that require the option to work see comparable performance to using TSX, being only slightly behind.
While this change is now heavily simplified and reuses existing sync primitives, it was previously overly complicated with custom page-locking mechanism but that solution was scrapped as it was overdesigned and broke very easily. The new version also has slightly better performance (about 1 fps or so).
To Testers: Please focus on games that require the "Accurate RSX reservations" option. If you have TSX, compare TSX on vs TSX off + the option enabled.