Commit graph

166 commits

Author SHA1 Message Date
Elad Ashkenazi 1bd4565186 Implement thread_ctrl::wait_until() 2024-08-17 06:38:49 +03:00
Elad Ashkenazi d0ebba6c5e CELL: New reservation notifications mechanism 2024-08-14 11:53:00 +03:00
Megamouse e0fce6cc5b Fix some warnings 2024-07-20 07:37:17 +03:00
Elad Ashkenazi f948a80242 CELL: More efficient reservation notificatins 2024-06-30 07:46:14 +03:00
Eladash 71dd22a55d SPU LLVM: Avoid notifications in cellSync SPU functions
Identify them using their unique error codes.
2024-05-21 16:37:54 +03:00
Megamouse dfee5b9a6c threads: replace magic number id_type with thread_class 2024-05-18 16:16:08 +02:00
Ani 39e946630d syscall: Register syscall 149 sys_time_get_system_time 2024-04-29 10:25:21 -07:00
capriots 56692e23f5 lv2: stub sys_time syscalls, add error code to sys_ss 2024-04-27 13:33:09 +02:00
Eladash 2023057fbb Savestates: Reduce logging 2024-03-27 19:59:22 +02:00
Eladash 68349e48cd Savestates: Save PPU running order 2024-03-26 21:35:53 +02:00
Elad.Ash 4cfdb71d3a
LV2: Longer thread creation delay for low prio threads 2024-03-09 23:37:35 +02:00
Eladash f40602cc59 cellGame: Fix PPU deadlocks on concurrent execution 2024-03-06 09:45:37 +02:00
Eladash 94239f5526 Fixup HW thread switch delay condition for performance 2024-02-11 23:01:40 +02:00
Elad.Ash 148edc005a Improve cpu_flag::yield handling 2024-02-11 20:09:01 +02:00
Elad Ashkenazi ec59f4d37e PPU/LV2: Implement HW threads switching delay when signaling higher priority threads
In real PS3 (it seems), when a thread with a higher priority than the caller is signaled and that there is available space on the running queue for the other hardware thread to start It prioritizes signaled thread caller's hardware thread switches instantly to the new thread code while signaling to the other hardware thread to execute the caller's code.
Resulting in a delay to the caller after such thread is signaled
2024-02-11 20:09:01 +02:00
Megamouse 59c58aa3cf fix some warnings 2023-12-30 19:07:35 +01:00
Eladash dddd12f66b CELL: Postponed address notifications 2023-08-17 09:02:28 +03:00
Whatcookie d4cf12bc17
LV2: Improve sys_timer_usleep by using CPU usermode waiting
* Linux: set timerslack to minimum value
- Linux delays the wakeup of threads to save power, this feature isn't needed for this application

* Utils: Add detection for waitpkg and monitorx extensions
- These instructions are used for user mode wait instructions

* lv2: Use user mode wait instructions instead of yielding when appropriate
2023-08-05 11:49:30 +03:00
Ivan Chikish d34287b2cc Linux: use futex_waitv syscall for atomic waiting
In order to make this possible, some unnecessary features were removed.
2023-08-02 21:46:06 +03:00
Megamouse 16f869fe5a logging: minor trace optimizations 2023-06-15 19:48:15 +02:00
Eladash 636bde6343 Logs: Fix trailing space, nbsp and unintended character 2023-06-06 09:48:27 +02:00
brian218 c85775922e sys_usbd: Implemented sys_usbd_unregister_extra_ldd() 2023-06-05 13:51:54 +03:00
Eladash b861a9c5d0 LV2: Implement set-priority thread requeue 2023-06-02 08:54:46 +03:00
Eladash 9828e6cafc LV2: Push other-than-this thread to the back on priority set 2023-06-02 08:54:46 +03:00
brian218 98c46f7eb0 sys_game: Fixed potential bugs in sys_game_get_system_sw_version()
sys_game: Implemented sys_game_set_system_sw_version()
2023-05-06 10:26:37 +03:00
Megamouse cd9ff08235 Decrease some include madness 2023-04-26 21:37:44 +02:00
Eladash 0beda6fa89 Savestates: Fix deadlock on savestate load 2023-03-18 12:07:17 +03:00
Margen67 5bb89328d0 Remove whitespace 2023-02-15 08:58:02 +01:00
brian218 53e906d0f3 sys_game: Implemented sys_game_board_storage_write() & Made it modifiable 2023-02-04 22:19:59 +01:00
Eladash 5aced2e44b Print LV2 Syscall Usage only if increased since last print 2023-01-28 17:21:45 +01:00
brian218 49455965c0 sys_game: Implemented sys_game_get_rtc_status() & Updated sys_game_board_storage_read() 2023-01-26 15:52:45 +01:00
Elad Ashkenazi 0946e5945f
VSH Improvements (#13172)
* sys_prx: Implement PRX LIB register syscall

* VSH: partial log spam fix

* sys_process reboot fix

* Implement sys_memory_container_destroy_parent_with_childs

* sys_net: Implement SO_RCVTIMEO/SO_SENDTIMEO

* VSH: Implement sys_rsx_context_free

* PPU LLVM: distinguish PPU cache exec also by address

Fixes referencing multiple PRX.

* UI: Do not report size of apps inside /dev_flash
2023-01-09 20:03:01 +03:00
brian218 65ae85061f
Misc and minor improvements of syscalls used by VSH (#13067) 2022-12-13 07:33:17 +01:00
brian218 3cb9cd7724
sys_fs: Minor fixup (#12913)
Stubbed sys_fs_newfs
2022-11-01 19:49:50 +03:00
brian218 61a371b106 Implemented sys_fs_mount() and sys_fs_unmount() 2022-10-28 08:51:41 +02:00
brian218 5c24009eb5 Implemented sys_game_watchdog syscalls 2022-10-17 20:32:01 +03:00
brian218 e839595053 Implemented sys_game_get_system_sw_version() 2022-10-11 08:32:49 +02:00
Eladash d25d1ecb3a LV2: Avoid using multi-variable atomic waiting on cpu_thread::state wait 2022-10-04 16:28:34 +03:00
Nekotekina b49a1f27eb Warning fixes 2022-09-17 16:35:02 +03:00
Eladash cf4da5c4d1 CPU preemption control: bugfixes 2022-09-16 18:57:55 +03:00
Eladash 9c5108c1ca CPU preemption control: Add one more debug variable 2022-09-16 18:57:55 +03:00
Eladash ec7b18dab5 Implement independent CPU preemptions 2022-09-13 19:28:20 +03:00
brian218 75efc79930 Implemented sys_game_board_storage_read() 2022-09-04 13:28:05 +03:00
Eladash f2997e4c00 LV2: Fix the most annoying race ever
Timeline of the race:
1. The PPU is in SLEEP state. state = suspend.
2. lv2_obj::awake is called on the traced thread and is now in ONPROC state, state = signal.
3. lv2_obj::awake is called by another thread externally with a priority higher than our traced thread and appends it to g_pending. state = suspend + signal.
4. lv2_obj::sleep/set_priority (higering priority) is called on any thread which is in ONPROC. Causing it to enter SLEEP or RUNNING state, while the traced thread is back in queue in ONPROC. state = suspend + signal.
5. The traced thread finally calls lv2_obj::awake on itself, g_pending decrements to 0 and we a have a rescheduling event, after XOR state = 0!!! (no signal)
6. In check_state: cpu_sleep_called is now true and remains this way.
7. Another thread with a higher prioty kicks in and appends the traced thread into g_pending. state = suspend.
8. The traced thread is at cpu_thread::cpu_wait(), and that's where it's gonna spend the rest of its life.
2022-08-11 12:44:40 +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 011aabe9ed LV2: Make sys_mutex and sys_lwmutex lock-free, add some busy waiting in sys_mutex_lock 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 dc851a729e LV2: Postpone thread notifications to afterward mutex ownership(s) 2022-08-07 20:23:54 +03:00