Commit graph

57 commits

Author SHA1 Message Date
Eladash 194f7375da SPU/LV2: Fix tiny race conditions 2022-09-21 20:35:34 +03:00
Elad Ashkenazi c4cc0154be LV2: Optimizations and fixes
Fix and optimize sys_ppu_thread_yield

Fix LV2 syscalls with timeout bug. (use ppu_thread::cancel_sleep instead)

Move timeout notification out of mutex scope

Allow g_waiting timeouts to be awaked in scope
2022-08-11 11:42:16 +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 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 6007fd630f Do not use lv2_obj::g_waiting when not needed in sys_timer_usleep 2022-08-07 20:23:54 +03:00
Eladash 1fd5fb2f7e Savestates: Fix minor race with LV2 timers 2022-07-08 12:57:43 +03:00
Eladash d8f3029952 Log LV2 periodic timers 2022-07-06 19:43:25 +03:00
Eladash 09c28f75b3 Savestates: Fix LV2 timers (fixes audio in some games) 2022-07-06 19:43:25 +03:00
Elad Ashkenazi fcd297ffb2
Savestates Support For PS3 Emulation (#10478) 2022-07-04 16:02:17 +03:00
Eladash 24e4a43ec4
lv2_timer: manage timers by separate thread (#10445)
Substitutes missing abort op for lv2_obj manager.
2021-06-15 15:04:51 +03:00
Nekotekina 2491aad6f2 types.hpp: implement min_v<>, max_v<>, SignedInt, UnsignedInt, FPInt concepts
Restrict smax to only work with signed values for consistency.
Cleanup <climits> includes.
Cleanup <limits> includes.
2021-05-23 19:43:51 +03:00
Eladash 2e28e2d293 lv2: Fix overflows of periodic timers 2021-05-17 13:17:45 +03:00
Eladash 8bd58b1ad4 Remove lv2_event_queue::check(weak_ptr) 2021-05-15 00:31:14 +03:00
Eladash 33580e0aa1 sys_timer: weak_ptr -> shared_ptr 2021-05-15 00:31:14 +03:00
Nekotekina b3fb6d7d18 Add and fix -Wredundant-decls (GCC) 2021-03-23 22:48:57 +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 34fa010601 Improve cond_var notifiers
But nobody uses it anyway, so clean up includes.
2020-11-06 00:10:16 +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 6892399699 kernel_explorer: More Improvements 2020-06-12 09:28:23 +02:00
Eladash 2b75df22d9 sys_event_queue: Fix ports disconnection after queue destruction 2020-04-30 18:58:42 +03:00
Eladash 50f51be06a
Improve sys_timer_get_information (#7638)
* Improve sys_timer_get_information

* sys_timer_disconnect_event_queue sets STATE_STOP regardless of port connection status.
* sys_timer_get_information sets 0 for period and next_expire if the timer is stopped.

* Fix two minor races in lv2_timer thread

* If the timer thread is about to fire an event of queue x, then another thread disconnects the queue, then restarts the timer and connects the event queue, then the timer thread sends an event - event data combination (source, data1, data2, next) may be inaccurate.

* If the timer thread is about to send an event (periodically), then another thread stops the timer and starts it again with sys_timer_start_periodic_absolute, timer.expire in info->timer_state in sys_timer_get_information may be inaccurate.
2020-02-29 17:15:25 +03:00
Eladash 5a73943be6 Fix sys_timer_destroy
Also some cleanup.
2020-02-29 13:06:14 +03:00
Nekotekina b59bb16fad Threads: removed outdated on_abort detection deemed unnecessary
May cause regressions.
2020-02-25 15:48:25 +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
Eladash 72fb3ba794 perf hotfix for sys_timer_usleep 2019-08-01 23:38:09 +03:00
Eladash 85b1152e29 Timers scaling and fixes 2019-07-23 00:09:01 +01:00
Nekotekina 1a1eff66bc sys_timer: add vm::temporary_unlock 2019-07-14 18:21:56 +03:00
Malcolm Jestadt 31afd046b0 lv2: sys_timer_usleep improvements for linux
-The minimum quantum on linux appears to be 50 microseconds by default, not 100
-Do not wait for the last quantum to avoid sleeping too long
2019-06-25 20:20:05 +01:00
Lassi Hämäläinen c963c51a60 Remove unnecessary header includes
- Manually removed lot of unneeded #includes to clean code and reduce
  compilation time
- Reordered some of the #includes to be in more logical order
2019-06-25 17:11:10 +03:00
eladash 3c0564c9b7 Fix timer state after event queue was destroyed
* Hw tests show state is unaffected by external destruction of the event queue

* Minor race regarding state check fixed (can result in an undestroyable state)
2019-03-31 14:57:21 +03:00
eladash 90490f775d Fix sys_timer_usleep specifically with 0 sleep time
Remove context switch, replace it with host yield() for giving some cpu time for SPUs ans RSX
2019-03-31 14:57:21 +03:00
Nekotekina 1b37e775be Migration to named_thread<>
Add atomic_t<>::try_dec instead of fetch_dec_sat
Add atomic_t<>::try_inc
GDBDebugServer is broken (needs rewrite)
Removed old_thread class (former named_thread)
Removed storing/rethrowing exceptions from thread
Emu.Stop doesn't inject an exception anymore
task_stack helper class removed
thread_base simplified (no shared_from_this)
thread_ctrl::spawn simplified (creates detached thread)
Implemented overrideable thread detaching logic
Disabled cellAdec, cellDmux, cellFsAio
SPUThread renamed to spu_thread
RawSPUThread removed, spu_thread used instead
Disabled deriving from ppu_thread
Partial support for thread renaming
lv2_timer... simplified, screw it
idm/fxm: butchered support for on_stop/on_init
vm: improved allocation structure (added size)
2018-10-19 22:22:35 +03:00
Nekotekina ca5158a03e Cleanup semaphore<> (sema.h) and mutex.h (shared_mutex)
Remove semaphore_lock and writer_lock classes, replace with std::lock_guard
Change semaphore<> interface to Lockable (+ exotic try_unlock method)
2018-09-03 23:00:36 +03:00
Nekotekina 363811981d Reintroduce LOG_CHANNEL
Groundwork for further improvements
2018-08-25 15:39:00 +03:00
eladash f349695a75 Rsx: rewrite address translation 2018-08-13 16:16:34 +03:00
Nekotekina df489d786a sys_timer_usleep: give Linux a partial exemption 2018-06-05 12:35:26 +03:00
kd-11 d48f391b41 lv2: Ease the pain of lower end CPUs
- Avoid busy waiting in usleep code as much as possible, instead yield
- Also avoid busy_wait for SPU concurrency choker
2018-05-29 13:54:30 +03:00
kd-11 be13a776f4 lv2: Reimplement sys_timer_usleep
- Matches ps3 accuracy for all tested values with few exceptions
- Do not enter the host OS kernel if waiting for less than 500us to avoid scheduler issues
2018-05-29 13:54:30 +03:00
Nekotekina cce0ad0c35 Clean vm::ps3 namespace use 2018-02-09 17:49:37 +03:00
Nekotekina 88fef183a3 config.yml: Log section optimized 2017-05-15 14:37:05 +03:00
Nekotekina 4739eb3601 Reservation fix 2017-03-11 15:48:43 +03:00
Nekotekina 9000407a77 cpu_thread::test_state added
lv2_obj::sleep adjustment
synchronization fixes
2017-02-22 13:23:21 +03:00
Nekotekina 598c90f376 PPU thread scheduler 2017-02-13 22:26:11 +03:00
Nekotekina 11b0b6958f sys_spu diag 2017-02-05 15:48:11 +03:00
Nekotekina e3e4decabf sys_timer... 2017-02-04 20:39:04 +03:00
Nekotekina 6537909fd2 sys_event_queue... 2017-02-04 20:39:04 +03:00
Nekotekina b21fce4d6f IdManager improved
lv2_obj for kernel objects
Simple lookup (vector)
Another idm API refactoring
2017-01-29 21:37:04 +03:00
Nekotekina a5a2d43d7c Thread.cpp refinement
Hide thread mutex
Safe notify() method
Other refactoring
2017-01-29 19:52:19 +03:00