Commit Graph

256 Commits

Author SHA1 Message Date
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 d0c199d455 Replace utils::cnttz{32,64} with std::countr_{zero,one}
Make #include <bit> mandatory.
2020-04-14 16:05:58 +03:00
Eladash c3a4e57efe Reduce log level of page fault notifications
Log current hle function.
2020-04-12 10:30:38 +01:00
Nick Renieris 1231274e0f CPUThread: Split dump() info to separate methods 2020-04-03 01:36:35 +01:00
Megamouse a76a4d8136 change sig_log to SIG 2020-03-31 18:06:37 +02:00
Jan Beich 777f0a7c82
Implement IsDebuggerPresent on BSDs (#7880) 2020-03-28 01:57:41 +00:00
Nekotekina 7f5dd1dd62 Fix thread_base::join 2020-03-21 10:36:04 +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
Eladash cb4192bce9 vm: Log all guest memory bases at startup 2020-03-14 18:30:14 +02: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 6bd96a4590 Fix thread_base::finalize (and emergency_exit, collaterally)
Forgot to reset futex callback. Could cause crashes.
2020-03-10 23:23:32 +03:00
Nekotekina 1678b37aa0 Use TRAP on segfault with debugger (Linux) 2020-03-10 14:06:06 +03:00
Nekotekina adfd8ab43c Break in the debugger in thread_ctrl::emergency_exit
Implement IsDebuggerPresent analog for non-Windows systems.
2020-03-10 13:28:24 +03:00
Nekotekina 87d4b14ca9 Pause only on fatal messages
Also make some access violation an error since we don't pause on it.
2020-03-10 11:26:42 +03:00
Nekotekina 07e1766a7c Implement thread_ctrl::emergency_exit()
Replace exception throws with this.
2020-03-08 15:11:02 +03:00
Nekotekina e4a81b1d13 Move Log.h to util/logs.hpp 2020-03-07 12:29:23 +03:00
Nekotekina 7a8772dafa Replace std::string::npos with umax 2020-03-05 14:05:23 +03:00
Eladash bb1b4bac9b Update thread_base::notify_abort() 2020-03-04 14:39:41 +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 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 cb252b1ce2 Partial revert of 5871c4e93f 2020-02-29 18:39:15 +03:00
Eladash 5871c4e93f Segfault/exceptions reports: Get rid of unhandled exeption handler, log memory bases
* Getting rid of handled exception handler fixes 2 things:
- Visual Studio debugger won't force it's own handler on unhandled exception.
- SPU segfaults in recompiler can now be reported.

* Log vm memory bases.
2020-02-29 17:16:36 +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 7eebe06931 Restore thread counter (world may be not ready yet)
Remove dumb 1300ms timeout.
2020-02-25 11:51:19 +03:00
Nekotekina e772dde3cc Add more thread information (context switch, page faults).
Only implemented on Linux, possibly works on some BSD.
2020-02-23 16:21:26 +03:00
Eladash 6bb083a77c
Add more information for segfault reports (#7538) 2020-02-22 10:58:42 +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
Eladash 606693a9f7 Avoid closing the emulator after access violation 2020-02-13 14:14:28 +03:00
Eladash 639245c071 Make handle_access_violation noexcept 2020-02-10 17:27:34 +03:00
Nekotekina 1a78e0e80c Make RPCS3 compile in C++2a mode 2020-02-04 23:43:55 +03:00
Nekotekina 327bb2d8f0 Modernize PPU logging (ppu_log variable) 2020-02-01 11:52:24 +03:00
Nekotekina 15391f45d0 Modernize RSX logging (rsx_log variable) 2020-02-01 11:52:22 +03:00
Nekotekina 3c0bd821c8 Give log channels fancier names
Improve LOG_CHANNEL macro to accept custom name.
2020-02-01 10:43:43 +03:00
Nekotekina 26cccead6e logs: remove legacy MEMORY channel
Add channels vm_log, sig_log.
2020-01-31 16:44:48 +03:00
Nekotekina 69e81da57b Fix some warnings 2019-12-13 02:08:52 +03:00
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