Commit Graph

118 Commits

Author SHA1 Message Date
RipleyTom 10820fa135
Implement sceNpSignaling & signaling improvements (#8836) 2020-09-07 22:50:17 +01:00
Eladash a029a94c73 SPU: Use waitable atomics for SPU channels interface 2020-07-23 13:45:58 +03:00
Nekotekina f6200ba635 Implement thread_ctrl::get_process_affinity_mask() 2020-05-01 22:00:56 +03:00
Nekotekina 76294beae1 Implement thread_ctrl::get_thread_affinity_mask() 2020-04-29 00:09:40 +03:00
Nekotekina aae338a91c named_thread_group: add a default constructor 2020-03-28 17:17:51 +03:00
Nekotekina 49d8731c1c Thread.h: fix warning 2020-03-21 13:49:41 +03:00
Nekotekina c577bd2111 Implement thread_state::errored
State after calling thread emergency_exit() function.
Also default-construct thread result in this case.
2020-03-20 21:31:27 +03:00
Nekotekina 04dedb17eb Disable exception handling.
Use -fno-exceptions in cmake.
On MSVC, enable _HAS_EXCEPTION=0.
Cleanup throw/catch from the source.
Create yaml.cpp enclave because it needs exception to work.
Disable thread_local optimizations in logs.cpp (TODO).
Implement cpu_counter for cpu_threads (moved globals).
2020-03-12 16:03:08 +03:00
Nekotekina 07e1766a7c Implement thread_ctrl::emergency_exit()
Replace exception throws with this.
2020-03-08 15:11:02 +03:00
Nekotekina 8d847d6f1c Thread: internal cleanup
Use different, simpler algorithm in wait_for.
Although the very idea of such notifications was rotten.
2020-03-03 20:26:37 +03:00
Nekotekina d594490329 Thread: removed unused wait() with predicate.
It doesn't work this way anyway.
2020-03-03 18:33:02 +03:00
Nekotekina 6c66153372 Threads: move linux m_timer to static thread_local variable
Allows lazy allocation of the timer handle.
2020-03-03 18:33:02 +03:00
Nekotekina f72971f19f Implement named_thread_group 2020-02-29 16:55:25 +03:00
Nekotekina 799c3f9708 Remove global thread counter (again)
Seems fine without it now.
2020-02-28 21:50:19 +03:00
Nekotekina 490f58ff3c Try to purge thread_state::detached
It's rarely necessary, but can cause unexpected problems.
2020-02-28 21:11:13 +03:00
Nekotekina 65eeee0f4c Remove cancerous lf_value<>
Replace thread names (generic, PPU, SPU) with new shared pointers.
Devirtualize cpu_thread::get_name (used in single case).
2020-02-28 18:54:46 +03:00
Nekotekina a0d2bc9769 named_thread: allow default constructor only with thread_name
In C++20, lambdas may be default-constructible allowing nasty stuff.
2020-02-26 21:23:30 +03:00
Nekotekina b083edccd3 Threads: remove some unused code (remnants from thread spawn) 2020-02-25 15:57:57 +03:00
Nekotekina b59bb16fad Threads: removed outdated on_abort detection deemed unnecessary
May cause regressions.
2020-02-25 15:48:25 +03:00
Nekotekina 3f943945a7 Threads: Remove unused on_wait() detection to simplify code 2020-02-25 15:36:08 +03:00
Nekotekina 7eebe06931 Restore thread counter (world may be not ready yet)
Remove dumb 1300ms timeout.
2020-02-25 11:51:19 +03:00
Nekotekina 8b4b859091 Remove "thread_ctrl::spawn" 2020-02-23 15:03:38 +03:00
Nekotekina 6a443c0fbd Deprecate thread_ctrl::spawn 2019-10-12 19:14:50 +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 50fc5dfde5 Use g_fxo for rsx::rsx_replay_thread 2019-09-26 23:26:36 +03:00
Nekotekina 75941e62a8 named_thread: implement default thread name support 2019-09-17 02:46:34 +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
Nekotekina f63e89f9b4 Implement waitable atomics
Moved Atomic.h to util/atomic.hpp
List source files in CMakeLists.txt
2019-07-29 03:04:55 +03:00
Nekotekina 4e4c896136 Expand thread affinity mask to u64
Also fix and note __APPLE__ path.
2019-07-20 15:58:28 +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 4bef0f8dab Rename thread_abort (name conflict) 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
Nekotekina a605dd0a3f Add missing deleted operators 2018-09-27 12:16:43 +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 99ffc3fca9 Use std::invoke_result_t
Also simplify idm code
2018-09-08 00:32:04 +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 cbc8bf01a1 cell/scheduler: Manage thread placement depending on cpu hardware 2018-01-19 12:03:57 +03:00
Nekotekina 7d3a528871 Use Qt for error reports 2017-11-23 20:36:21 +03:00
Nekotekina 6561ddae41 PPU LLVM: multithread compilation 2017-06-24 19:12:19 +03:00
kd-11 df7b466656 spu: Speed hacks - Do not starve PPU threads
optionally hint to the OS scheduler to give less attention to SPUs

ui: Add speed 'hacks' as configurable options
2017-05-10 21:50:14 +03:00
Nekotekina 436c245d13 Remove unused code 2017-02-13 18:33:31 +03:00
Nekotekina a5a2d43d7c Thread.cpp refinement
Hide thread mutex
Safe notify() method
Other refactoring
2017-01-29 19:52:19 +03:00
Nekotekina 0f87c4485d Silly macro removed-2 2016-08-14 18:19:42 +03:00
Nekotekina f8719c1230 PPUThread refactoring
`CallbackManager` removed, added _gcm_intr_thread for cellGcmSys
`PPUThread` renamed to `ppu_thread`, inheritance allowed
Added lightweight command queue for `ppu_thread`
Implemented call stack dump for PPU
`get_current_thread_mutex` removed
`thread_ctrl::spawn`: minor initialization fix
`thread_ctrl::wait_for` added
`named_thread`: some methods added
`cpu_thread::run` added
Some bugs fixes, including SPU channels
2016-07-30 16:35:02 +03:00
Nekotekina a026d35c97 sys_interrupt_thread_eoi fixed
thread_ctrl::interrupt improved
BIND_FUNC improved: preparations
2016-07-24 21:06:07 +03:00
Nekotekina 7ccdea7822 Removed std::enable_shared_from_this
Minor ID manager refactoring
2016-07-24 21:06:05 +03:00