1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 02:32:36 +01:00
Commit Graph

217 Commits

Author SHA1 Message Date
Eladash
5631382623 sys_spu: Fix SPU Thread Id
* Removed wrong code in sys_spu_thread_group_terminate.
* SPU Thread ID is accurate, including 5th thread id "rule".
* Fixed possible use-after-free access of spu_thread::group member.
* RawSPU ID management simplified.
2019-12-06 19:59:29 +03:00
Eladash
c3862b74b1 Compilation fix for NetBSD (#7067) 2019-12-05 11:28:00 +03:00
Nekotekina
835892aa51 C-style cast cleanup VII 2019-12-05 02:10:15 +03:00
Nekotekina
5b9df53c13 C-style cast cleanup (partial)
Replace C-style casts with C++ casts.
2019-11-29 00:35:23 +03:00
MSuih
f3ed26e9db Small warnings cleanup (#6671)
* Ignore more warnings

These are intentional

* Signed/unsigned mismatch when comparing

* Explictly cast values

* Intentionally discard a nodiscard value

* Change ppu_tid to u32

* Do not use POSIX function name on Windows

* Qt: Use horizontalAdvance instead of width

* Change progress variables to u32
2019-10-25 13:32:21 +03:00
Nekotekina
8e21f4d5d4 Remove g_thread_count
Unnecessary global which is bad to reason about.
Possibly fix a but in SPRX loader.
2019-10-12 16:45:41 +03:00
plappermaul
925f2ce02f Use Linux timers for sleeps up to 1ms (#6697)
* Use Linux timers for sleeps up to 1ms (v3)
The current sleep timer implementation basically offers two variants. Either
wait the specified time exactly with a condition variable (as host) or use a
combination of it with a thread yielding busy loop afterwards (usleep timer).

While the second one is very precise it consumes CPU loops for each wait call
below 50us. Games like Bomberman Ultra spam 30us waits and the emulator hogs
low power CPUs. Switching to host mode reduces CPU consumption but gives a
~50us penalty for each wait call. Thus extending all sleeps by a factor of
more than two.

The following bugfix tries to improve the system timer for Linux by using
Linux native timers for small wait calls below 1ms. This has two effects.

- Host wait setting has much less wait overhead
- usleep wait setting produces lower CPU overhead
2019-10-09 20:03:34 +03:00
Nekotekina
8031180373 Add dummy alert param to thread_ctrl::wait API 2019-10-06 16:03:10 +03:00
Nekotekina
c1b0934f72 Simplify thread_base::join()
Use waitable atomics
2019-09-10 19:25:39 +03:00
Nekotekina
d13ff285d1 Rewrite cond_variable to use waitable atomics
Increase max_timeout and fix max_timeout usage
2019-09-10 19:25:39 +03:00
Nekotekina
faba366f89 named_thread: install atomic wait callback 2019-09-10 18:48:46 +03:00
Jan Beich
53e7f6c5a5 Thread: drop is_leaf_function after 5e3bacbd9b 2019-09-10 17:41:15 +03:00
Nekotekina
2740fafa64 Use g_fxo for page_fault_notification_entries 2019-08-22 02:13:39 +03:00
Nekotekina
a85a8796d3 Use g_fxo for page_fault_event_entries 2019-08-22 02:13:39 +03:00
Nekotekina
f8f3067deb Always check page_allocated in vm::check_addr 2019-08-14 20:28:34 +03:00
Eladash
997e3046e3 vm/sys_overlay Improvements
- Implement sys_overlay_load_module_by_fd.
- Implement special segment allocation when ppc_seg flag is specified.
2019-07-28 14:23:58 +03:00
Zangetsu38
a98a2b79d0 thread scheduler: Add scheduler for zen2 and refactor for zen(+). 2019-07-21 23:02:11 +03:00
Nekotekina
4e4c896136 Expand thread affinity mask to u64
Also fix and note __APPLE__ path.
2019-07-20 15:58:28 +03:00
Eladash
c727760537 Fix g_exec_addr addres check for access violations 2019-07-13 16:59:58 +03:00
Eladash
537d3f2548 Log last function on debug pause or exception, dump cpu_thread state on access violation 2019-07-10 17:35:39 +03:00
eladash
0979207cc6 Log currently PPU HLE function executed after access violation
old functionality retrieved
2019-07-10 17:35:39 +03:00
JohnHolmesII
232a35b6fc Various small warning fixes
-Indentation warnings
-prevent shift overflow
-This was declared extern in all contexts. Remove this for initialization
-Fix main return types. OH CANADA!
-Silence extraneos 'unused expression' warning
-Force use return value (warning)
-Remove tautological compare copy-pasta (char always < 256)
2019-06-28 01:45:29 +03:00
JohnHolmesII
be521ff0ab Fix warnings related to parentheses 2019-06-25 20:36:32 -07:00
Nekotekina
5d45a3e47d Implement cpu_thread::suspend_all
Remove Accurate PUTLLC option.
Implement fallback path for SPU transactions.
2019-06-19 20:36:12 +03:00
eladash
a3f65084df Fix sys_process_exit2 when SPUs are at av handler 2019-03-31 14:57:21 +03:00
eladash
16f86b2458 Fix page fault area range check
Range end check was bugged (always true), also rewrite it so vm::get would be called only once
2019-03-31 14:57:21 +03:00
Jan Beich
1a13d3ae4e OpenBSD doesn't have mcontext_t
`<signal.h>` provides `typedef struct sigcontext ucontext_t`
2019-03-19 22:24:49 +03:00
eladash
4a28319edf Implement SPU page faults notifications
* Implement both RawSPU and threaded SPU page fault recovery
* Guard page_fault_notification_entries access with a mutex
* Add missing lock in sys_ppu_thread_recover_page_fault/get_page_fault_context
* Fix EINVAL check in sys_ppu_thread_recover_page_fault, previously when the event was not found begin() was erased and
CELL_OK was returned.
* Fixed page fault recovery waiting logic:
- Do not rely on a single thread_ctrl notification (unsafe)
- Avoided a race where ::awake(ppu) can be called before ::sleep(ppu) therefore nop-ing out the notification
* Avoid inconsistencies with vm flags on page fault cause detection
* Fix sys_mmapper_enable_page_fault_notification EBUSY check
from RE it's allowed to register the same queue twice (on a different area) but not to enable page fault notifications twice
2019-03-12 13:28:31 +03:00
eladash
25aa5f80a6 Fix access violations reporting on RSX
and on other threads that do not have cpu_thread handler
2019-01-30 18:44:29 +03:00
eladash
b61492ca30 Dont call std::terminate() after normal access violation handling 2019-01-30 18:44:29 +03:00
JohnHolmesII
be75a564ca Fix builds with musl c 2018-12-30 21:31:06 +03:00
msuih
dbd4814584 Disable thread assignment for Intel 2018-12-24 19:33:08 +00:00
msuih
1dd3a4b3f0 Detect hyperthreading on Windows 2018-12-24 19:33:08 +00:00
vit9696
634a5fa31c Fix macOS compilation 2018-11-19 14:39:33 +03:00
Dennis Luxen
36d4614d12 Fix a warning that shift overflows data type width (#5116) 2018-10-23 18:49:01 +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
8ca6c9fff0 Fix thread_base::get_cycles (Linux/POSIX) 2018-10-19 22:22:35 +03:00
Nekotekina
bc87c5808c Add cond_variable::wait_unlock 2018-10-02 23:26:54 +03:00
Nekotekina
3359e9a51b Minor thread fixes
Call thread result destructor
2018-10-02 02:22:26 +03:00
Nekotekina
306f95a9ae New named_thread template (preview)
Old class named_thread renamed to old_thread
It's too hard to move in a single commit
2018-09-27 14:04:16 +03:00
Rui Pinheiro
13faf4e816 Avoid silent failures in RSX violation handler 2018-09-24 15:26:40 +03:00
Nekotekina
c5676e5649 Remove thread_ctrl::atexit
It was only a workaround for poor C++11 thread_local support
2018-09-15 17:09:56 +03:00
Nekotekina
d750e955c3 Use std::uncaught_exceptions()
Also remove wrong attributes
2018-09-08 00:32:04 +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
eladash
f349695a75 Rsx: rewrite address translation 2018-08-13 16:16:34 +03:00
VelocityRa
8981227644 util/thread_ctrl: Method for measuring cycles a thread has run for
Also add a getter for the native thread handle.
2018-05-30 12:35:41 +03:00
kd-11
824340363d disable thread scheduler on intel 2018-05-29 13:54:30 +03:00
Jan Beich
e487480ca9 Thread: unbreak build on BSDs after ac82ecf387
Utilities/Thread.cpp:1644:2: error: use of undeclared identifier 'pthread_setname_np'; did you mean 'pthread_set_name_np'?
        pthread_setname_np(pthread_self(), m_name.substr(0, 15).c_str());
        ^~~~~~~~~~~~~~~~~~
        pthread_set_name_np
/usr/include/pthread_np.h:58:6: note: 'pthread_set_name_np' declared here
void pthread_set_name_np(pthread_t, const char *);
     ^
2018-03-13 12:51:22 +04:00
Nekotekina
ac82ecf387 Use pthread_setname_np (Linux, GDB) 2018-03-11 19:33:02 +03:00
Nekotekina
4b1c052030 Fix crash on exit after access violation 2018-03-11 19:33:02 +03:00