Commit graph

89 commits

Author SHA1 Message Date
Megamouse fcac6a9322 sys_event: remove unnecessary copy 2025-01-22 02:18:07 +01:00
Elad 2614450e4b Fix IDM image serialization 2025-01-04 09:29:09 +02:00
Elad 575a245f8d
IDM: Implement lock-free smart pointers (#16403)
Replaces `std::shared_pointer` with `stx::atomic_ptr` and `stx::shared_ptr`.

Notes to programmers:

* This pr kills the use of `dynamic_cast`, `std::dynamic_pointer_cast` and `std::weak_ptr` on IDM objects, possible replacement is to save the object ID on the base object, then use idm::check/get_unlocked to the destination type via the saved ID which may be null. Null pointer check is how you can tell type mismatch (as dynamic cast) or object destruction (as weak_ptr locking).
* Double-inheritance on IDM objects should be used with care, `stx::shared_ptr` does not support constant-evaluated pointer offsetting to parent/child type.
* `idm::check/get_unlocked` can now be used anywhere.

Misc fixes:
* Fixes some segfaults with RPCN with interaction with IDM.
* Fix deadlocks in access violation handler due locking recursion.
* Fixes race condition in process exit-spawn on memory containers read.
* Fix bug that theoretically can prevent RPCS3 from booting - fix `id_manager::typeinfo` comparison to compare members instead of `memcmp` which can fail spuriously on padding bytes.
* Ensure all IDM inherited types of base, either has `id_base` or `id_type` defined locally, this allows to make getters such as `idm::get_unlocked<lv2_socket, lv2_socket_raw>()` which were broken before. (requires save-states invalidation)
* Removes broken operator[] overload of `stx::shared_ptr` and `stx::single_ptr` for non-array types.
2024-12-22 20:59:48 +02:00
Elad e67d090c35 Fixup sys_event_port_send 2024-11-01 10:43:46 +02:00
Elad b87c891ec4 Fixup sys_event to check EBUSY only for PPU->PPU signals 2024-11-01 07:37:57 +02:00
Elad 5c5edb4785 sys_event: Implement EBUSY for disconnection 2024-10-30 21:15:16 +02:00
Elad Ashkenazi 33851d51ab Fixup and Improve CELL reservation notifications 2024-07-01 18:59:26 +03:00
Elad Ashkenazi caf81f1367 LV2: Race condition fixup 2024-06-12 12:41:15 +03:00
Elad Ashkenazi f58b418b7d LV2: Optimization for timeout 2024-06-12 11:31:56 +03:00
Eladash ce5f7bd4ff Savestates: Rename DeferDeserialization, add some asserts 2024-01-01 11:58:00 +02:00
Eladash f60bdbaece Savestates: Compressed state files 2023-11-27 12:36:17 +02:00
Eladash b2e969eb8f Savestates: Fix rsxaudio 2023-10-05 05:07:46 +03:00
Eladash f57c8c1c35 LV2: Unconditional Timer Synchronization Fix 2023-06-02 08:54:46 +03:00
Margen67 5bb89328d0 Remove whitespace 2023-02-15 08:58:02 +01:00
Megamouse d3183708e8 overlays: do not open home menu in VSH 2023-01-21 09:11:53 +01:00
Eladash d25d1ecb3a LV2: Avoid using multi-variable atomic waiting on cpu_thread::state wait 2022-10-04 16:28:34 +03:00
Elad Ashkenazi 238298f695
sys_ppu_thread: Fix surmixer hack (#12689)
* sys_ppu_thread: Fix surmixer hack

* Hotfix after #12678
2022-09-21 21:10:59 +03:00
Eladash 194f7375da SPU/LV2: Fix tiny race conditions 2022-09-21 20:35:34 +03:00
Eladash 34bae90820 LV2: Move nearly all notifications out of all mutex scopes including IDM 2022-08-07 20:23:54 +03:00
Eladash a17a6527f6 LV2: Move memory unlocking outside of mutex ownership and make it conditional 2022-08-07 20:23:54 +03:00
Eladash 73aaff1b29 LV2: allocation-free synchronization syscalls
* Show waiters' ID in kernel explorer.
* Remove deque dependency from sys_sync.h
2022-08-07 20:23:54 +03:00
Eladash bc728db15b LV2: Add busy waiting before entering atomic wait 2022-08-07 20:23:54 +03:00
Eladash 2eebbd307d LV2: Minor optimization regarding signal flag 2022-08-07 20:23:54 +03:00
Eladash dc851a729e LV2: Postpone thread notifications to afterward mutex ownership(s) 2022-08-07 20:23:54 +03:00
Eladash 5f8f9e33f1 RSX/Savestates: Replace GCM hack with a proper fix 2022-07-08 12:57:43 +03:00
Eladash f0c71ae2ae Savestates: Fix saving sys_event_queue_destroy 2022-07-08 12:57:43 +03:00
Elad Ashkenazi fcd297ffb2
Savestates Support For PS3 Emulation (#10478) 2022-07-04 16:02:17 +03:00
Eladash 48ad959697
sys_event: Fix PPU queue forced uproot of waiters (#11147) 2021-11-13 20:22:54 +03:00
Eladash 063df64108 SPU/event queue: Implement protocol for SPU queue 2021-08-13 08:58:09 +03:00
Eladash bf61c826d5 SPU/event queue: Atomically resume SPU group 2021-08-12 22:24:54 +03:00
clienthax 85b33e9cae Hack for msmw2.sprx timeout. 2021-07-17 14:39:36 +02:00
Eladash 8bd58b1ad4 Remove lv2_event_queue::check(weak_ptr) 2021-05-15 00:31:14 +03:00
Eladash 31b55e0030 event queue: Structure size efficiency 2021-05-09 10:58:14 +03:00
Eladash 363cc60c82 sys_event: Save ID of self event queue 2021-05-09 10:58:14 +03:00
Eladash 64997662d2 LV2: Fixup for IPC
* Fix typo in lv2_obj::create.
* Always save ipc_key as 0 for non-shared object creations, regardless of thbe value set by creation attribute.
* Show IPC key of shared memory (sys_mmapper) memory objects in kernel explorer.
2021-05-07 14:58:22 +03:00
Eladash 900ebf6583
sys_event: Typo fix (#10246) 2021-05-07 09:34:25 +01:00
Eladash 7b6482c01d
LV2: Improve IPC support (#10206)
* Remove custom event queue's IPC management of favour of universal LV2 approach.
* Move ipc_manager to FXO.
* Fix ipc_manager internal storage memory leak: deallocate entry when IPC object destroyed.
* Rewrite lv2_obj::create to be simpler (remove many duplicated code).
* Always execute lv2_obj::create under both IPC and IDM mutexes at once (not in non-atomic single-steps). Fixing potential case where concurrency can cause IDM to contain 2 or more different objects with the same IPC key with SYS_SYNC_NOT_CARE (instead of the same object).
* Do not rely on smart ptr reference count to tell if the object exists. Use similar approach as event queues as it makes error checkings accurate.
* Optimize lv2_event_port by using std::shared_ptr for queue which wasn't allowed before.
2021-05-07 09:58:30 +03:00
Eladash 72c85744b9 kernel-explorer: Show bound queue to port information
Show its IPC key or ID, depends on the queue's type.
2021-04-23 21:34:05 +03:00
Megamouse a16d8ba3ea More random changes 2021-04-11 14:01:51 +03:00
Eladash f43260bd58
Atomic waiting refactoring (#9208)
* Use atomic waitables instead instead of global thread wait as often as possible.
* Add ::is_stopped() and and ::is_paued() which can be used in atomic loops and with atomic wait. (constexpr cpu flags test functions)
* Fix notification bug of sys_spu_thread_group_exit/terminate. (old bug, enhanced by #9117)
* Function time statistics at Emu.Stop() restored. (instead of current "X syscall failed with 0x00000000 : 0")
2021-02-13 17:50:07 +03:00
RipleyTom af8c661a64 Remove BOM markers 2020-12-06 15:30:12 +03:00
Nekotekina 605d57c541 sys_event: cleanup (replace vm::temporary_unlock)
Also made minor changes in sys_rsx.cpp.
Removed unused exception std headers.
2020-10-30 17:49:07 +03:00
Eladash d9750e8f9f SPU/PPU reservations: Optimizations for reservation locks and check_state() (non-TSX) 2020-07-09 03:17:35 +01:00
Eladash a0f0f58fc5 sys_event_queue: Fix IPC support 2020-06-15 17:08:57 +03:00
Eladash edde748519 sys_event_queue: Fix forced event queue destruction
Add missing last existence check at sys_spu_thread_(try)receive_event and lv2_event_queue::send.
2020-05-04 01:10:19 +03:00
Eladash 2b75df22d9 sys_event_queue: Fix ports disconnection after queue destruction 2020-04-30 18:58:42 +03:00
Eladash 66bd8308d9
lv2: Wait for rescheduling before confirming timeouts (#7875) 2020-03-28 03:16:59 +00:00
Nekotekina 92e3eaf3ff Fix signed-unsigned comparisons and mark warning as error (part 2). 2020-02-19 22:54:58 +03:00
Megamouse fe75311be2 move config structs to own files and clean up some headers 2020-02-17 15:08:17 +03:00
Nekotekina ad9c9f0183 C-style cast cleanup II 2019-11-30 18:17:45 +03:00