Commit graph

237 commits

Author SHA1 Message Date
Nekotekina f0fd7e2e19 Atomics: use WaitOnAddress if available (Win8+) 2020-10-21 00:22:08 +03:00
Nekotekina a5eb11d79f Improve cpu_thread::suspend_all (TSX-FA)
Add prefetching of cpu->state fields.
2020-10-19 19:41:28 +03:00
Nekotekina 120849c734 Implement perf stat counter for PPU/SPU reservation ops
Adds Emu/perf_meter.hpp header file.
Uses RDTSC for speed.
Prints stats at exit.
2020-10-19 19:41:28 +03:00
Nekotekina adf50b7c4b Implement cpu_thread::if_suspended
Use it for opportunistic guaranteed GETLLAR execution (TSX-FA).
2020-10-18 20:10:48 +03:00
Nekotekina f5c575961f Implement priorities for cpu_thread::suspend_all tasks
Give PUTLLUC increased priority.
2020-10-18 20:10:48 +03:00
Nekotekina 1606f97177 CPU: print and reset suspend_all statistics 2020-10-13 00:33:20 +03:00
Nekotekina ec7d243ee9 More optimization for cpu_thread::suspend_all
Try to not pause inactive threads.
2020-10-10 14:22:12 +03:00
Nekotekina b74c5e04f5 Optimize cpu_thread::suspend_all
Reduce internal thread status polling.
Refactor utility functions.
2020-10-10 14:12:49 +03:00
Nekotekina 050c3e1d6b Rewrite cpu_thread::suspend_all
Now it's a function of higher order.
Make only one thread do the hard work of thread pausing.
2020-10-10 13:58:48 +03:00
Nekotekina 346a1d4433 vm: rewrite reservation bits
Implement classic unique/shared locking concept.
Implement vm::reservation_light_op.
2020-10-10 13:58:48 +03:00
Eladash bcddbc15f0 Debugger: Fix PPU stepping on non-TSX 2020-08-19 19:48:35 +01:00
Eladash 82068cf802
SPU: Fix spu_thread::cpu_stop() missed executions (#8656) 2020-07-30 10:07:18 +01:00
Eladash d9750e8f9f SPU/PPU reservations: Optimizations for reservation locks and check_state() (non-TSX) 2020-07-09 03:17:35 +01:00
Eladash dc25a3fa2a PPU debugger: Show stack address of each function 2020-07-06 18:58:16 +02:00
sampletext32 437f374bae Fix some checks 2020-06-04 19:48:08 +03:00
Eladash b38580bf32 SPU: Use optimized PPU signaling to SPU on reservation pause 2020-05-13 11:10:13 +01:00
Nekotekina 19acf260d8 SPU DMA: Fix PUTLLUC (TSX)
Prevent edge case of missing store.
2020-04-29 15:40:41 +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 492a80f6c5 CPUThread.cpp: Minor indetation fixup 2020-04-13 04:34:10 +01:00
sampletext32 c69691f19b Fix various explicitness, laziness, hard codes 2020-04-12 17:29:42 +03:00
Nick Renieris 1231274e0f CPUThread: Split dump() info to separate methods 2020-04-03 01:36:35 +01:00
Nekotekina 20f7544a8a SPU profiler: minor change
Use std::greater to sort
2020-03-18 18:28:46 +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 9dca2887d8 Fixup for Emu.Pause()
Remove some reduntant calls.
Don't pause on unknown sys_fs_fcntl operation.
2020-03-08 22:03:16 +03:00
Nekotekina 07e1766a7c Implement thread_ctrl::emergency_exit()
Replace exception throws with this.
2020-03-08 15:11:02 +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 b59bb16fad Threads: removed outdated on_abort detection deemed unnecessary
May cause regressions.
2020-02-25 15:48:25 +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
Megamouse fe75311be2 move config structs to own files and clean up some headers 2020-02-17 15:08:17 +03:00
Nekotekina c0f80cfe7a Use attributes for LIKELY/UNLIKELY
Remove LIKELY/UNLIKELY macro.
2020-02-05 10:42:34 +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 1d0f359406 logs: add more log channels instead of GENERAL 2020-01-31 16:44:48 +03:00
Eladash b59a825e48 Minor fixup after #6894 2019-12-30 23:46:45 +03:00
Markus Stockhausen a36f0497ce Improve approximate xfloat
- Disable denormals for SPU threads
- Add clamping helpers
2019-12-22 01:26:34 +03:00
Nekotekina ccac9d4777 Remove throwing and catching cpu_flag::stop
Since there is spu_runtime::g_escape function now.
2019-11-08 19:27:11 +03:00
Nekotekina 9ac6ef6494 SPU: cleanup former OOM handling
Remove cpu_flag::jit_return.
It's obsolete now, and worked only in SPU ASMJIT anyway.
2019-10-26 21:24:12 +03:00
Nekotekina c69fe0f664 SPU Profiler preview
Add option "SPU Profiler" (disabled by default).
Works only with SPU recompilers.
Results are flushed on pausing.
2019-10-15 17:42:57 +03:00
Nekotekina 16dd72b3e3 Replace some uses of Emu.IsStopped()
Poll thread state instead.
2019-10-12 21:12:47 +03:00
Nekotekina a29d4150df GDB Server: fix and cleanup
Move source files to Emu/GDB.cpp, GDB.h
Remove "WITH_GDB" option, enable GDB Server by default.
Change class name to gdb_thread.
Alias for external access gdb_server.
Change config option name to "GDB Server"
Bind on 127.0.0.1 by default.
2019-10-09 00:11:44 +03:00
Nekotekina c7c12941bc Fix wrong comments in CPUThread.h
It's not an upcast.
2019-09-28 15:39:50 +03:00
Eladash 399ea2edb2 dont escape from check_state() before ensuring signal is resetted. 2019-09-21 19:55:10 +03:00
Nekotekina 223319dd2e Abort named_thread in cpu_thread::stop_all 2019-09-13 15:53:38 +03:00
Nekotekina 798434aada Remove spin wait loop in cpu_thread::check_state
It was mostly dead code.
lock_unlock() method already has spin waiting logic.
2019-09-08 14:50:50 +03:00
Eladash 10c81fbdf9 Fix passive reservation locks checking at Emu.Stop() (#6482) 2019-09-07 20:43:16 +03:00
Nekotekina 2882220cbd Implement cpu_thread::stop_all() 2019-08-22 02:13:39 +03:00
RipleyTom 05813c7e90 Fixes suspend+stop threads not stopping 2019-08-04 21:16:19 +03:00
Nekotekina 090c71aa7c TSX: Improve cpu_thread::suspend_all implementation
Implement low_lock and vip_lock (for shared_mutex).
Try to simplify suspend_all implementation with updated shared_mutex.
2019-07-24 17:25:52 +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
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
Lassi Hämäläinen 499035512b Split Emu/Memory into more logical headers
- Add vm_locking.h and vm_reservation.h and move relevant functions
  and types to these headers.
- Change include order and make vm_ptr.h, vm_var.h and vm_ref.h headers
  usable invidually and them including vm.h instead of other way around
- Because usage of vm::ptr now requires including vm_ptr.h instead of
  vm.h updated multiple #includes
- Added additional #includes to vm_reservation.h and vm_locking to
  where vm::reservation_* and locking related functions are used
2019-06-25 17:11:10 +03: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
Nekotekina 3794f65bb6 Add cpu_flag::jit_return 2019-03-23 02:43:41 +03:00
elad fc92ae4085 SPU/PPU atomics performance and LR event fixes (#5435)
* Fix SPU LR event setting in atomic commands according to hw test
* MFC: increment timestamp for PUT cmd in non-tsx path
* MFC: fix reservation lost test on non-tsx path in regard to the lock bit
* Reservation notification moved out of writer_lock scope to reduce its lifetime
* Use passive_lock/unlock in ppu atomic inctrustions to reduce redundancy
* Lock only once for dma transfers (non-TSX)
* Don't use RDTSC in reservation update logic
* Remove MFC cmd args passing to process_mfc_cmd
* Reorder check_state cpu_flag::memory check for faster unlocking
* Specialization for 128-byte data copy in SPU dma transfers
* Implement memory range locks and isolate PPU and SPU passive lock logic
2019-01-15 18:31: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 8abe6489ed Mega-cleanup for atomic_t<> and named bit-sets bs_t<>
Remove "atomic operator" classes
Remove test, test_and_set, test_and_reset, test_and_complement global functions
Simplify atomic_t<> with constexpr if, remove some garbage
Redesign bs_t<> to use class, mark its methods constexpr
Implement atomic_bs_t<> for optimizations
Remove unused __bitwise_ops concept (should be in other header anyway)
Bitsets can now be tested via safe bool conversion
2018-09-03 21:40:36 +03:00
Nekotekina d392379c7a Use vm::passive_lock for SPU threads 2018-04-06 15:47:00 +03:00
Andrey e0f53ace19 Improve GDB debug server (#4027)
* Made GDB debugger working with IDA

* Added async interrupts support

* Report proper thread after pausing

* Support attaching debugger before running app
2018-02-28 19:31:39 +04:00
Nekotekina 837c5dddee Add <typeinfo> 2017-09-19 15:07:07 +03:00
Nekotekina 6561ddae41 PPU LLVM: multithread compilation 2017-06-24 19:12:19 +03:00
Nekotekina f010b5b235 Configuration simplified 2017-05-20 16:01:48 +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
Andrey 215a9f9e11 Gdb debug server (#2542) 2017-04-02 21:10:06 +03:00
Nekotekina 8590b66b4b Fix cpu_thread pause 2017-03-27 01:15:41 +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 257b9a2015 Debugger fix
Crash fixes
GUI fixes
Debug enhancements
2017-02-10 16:33:22 +03:00
Nekotekina 246b9f3182 CHECK_EMU_STATUS removal 2017-02-05 17:35:27 +03:00
Nekotekina a5a2d43d7c Thread.cpp refinement
Hide thread mutex
Safe notify() method
Other refactoring
2017-01-29 19:52:19 +03:00
Nekotekina 591a6c8671 IdManager improved 2017-01-25 23:29:36 +03:00
Nekotekina 9232ddf0ab Minor changes 2017-01-25 04:43:12 +03:00
Nekotekina 05fb57baff VERIFY macro removed 2016-08-15 03:13:31 +03:00
Nekotekina 5e0489dcc0 cpu_init removed 2016-08-14 18:07:34 +03:00
Nekotekina bdeccd889f cpu_type removed, system_type added
cpu_state -> cpu_flag
vm::stack_allocator template improved
ppu_cmd type changed to enum, cmd64 type added
2016-08-09 17:14:41 +03:00
Nekotekina 46735d6b3d New bitsets (experimental) 2016-08-08 16:29:37 +03:00
Nekotekina 5a36c57c57 Formatting system improved
`unveil<>` renamed to `fmt_unveil<>`, now packs args to u64 imitating va_args
`bijective...` removed, `cfg::enum_entry` now uses formatting system
`fmt_class_string<>` added, providing type-specific "%s" handler function
Added `fmt::append`, removed `fmt::narrow` (too obscure)
Utilities/cfmt.h: C-style format template function (WIP)
Minor formatting fixes and cleanup
2016-08-04 21:34:00 +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 7a921cbdf9 cpu_thread compressed 2016-06-27 16:43:57 +03:00
Nekotekina 266db1336d The rest 2016-05-23 16:22:25 +03:00
Ivan aafcf44581 Header optimizations (#1684)
Shouldn't break anything. I hope.
2016-04-27 01:27:24 +03:00
Ivan da7472fe81 Optimizations (#1680)
* Optimizations

1) Some headers simplified for better compilation time
2) Some templates simplified for smaller executable size
3) Eliminate std::future to fix compilation for mingw64
4) PKG installation can be cancelled now
5) cellGame fixes
6) XAudio2 fix for mingw64
7) PPUInterpreter bug fixed (Clang)

* any_pod<> implemented

Aliases: any16, any32, any64
rsx::make_command fixed
2016-04-25 13:49:12 +03:00
Nekotekina f8f067ca7c Partial commit: Emu (the rest) 2016-04-15 19:22:49 +03:00
Nekotekina 38531459df Logging system rewritten
GUI doesn't freeze anymore
Some things simplified
2016-01-13 18:54:57 +03:00
Nekotekina 3ed603074c Changes done by [DH] rewritten
Added rsx_program_decompiler submodule
Added fs::dir iterator
Added fmt::match
2015-12-22 23:11:20 +03:00
Nekotekina ca6783ba9a Threads improved, ID manager improved 2015-12-04 23:37:34 +03:00
O1L fd13a495de Replace remained old ini-manager calls 2015-11-14 23:59:46 +04:00
Nekotekina a974ee009e vm::var improved, cleanup
Mostly vm::var initialization introduced.
Added vm::make_var function.
2015-10-14 18:17:37 +03:00
Nekotekina 8ae3401ffa Some things improved
shared_mutex_t implemented
GUI Emu Callbacks rewritten
fxm::import, fxm::import_always implemented
cellMsgDialog rewritten
Emu.CallAfter improved (returns std::future)
2015-09-22 16:48:21 +03:00
Nekotekina 5e14310071 noexcept usage fixed
thread_t renamed to named_thread_t
2015-08-24 21:22:48 +03:00
Nekotekina c2897cddd6 id_traits, idm::get_last_id() added
id_traits for file/dir descriptors
idm::get_current_id() removed, thread-local last ID
2015-08-24 21:22:38 +03:00
Nekotekina d9403c2ed2 thread_t cleanup 2015-08-24 21:22:37 +03:00
Nekotekina be9a599beb PPU Decoder Cache improved 2015-08-24 21:22:35 +03:00
Nekotekina dd665e7363 ID manager simplified
ID manager refactoring, redundant "type" information removed
2015-08-24 21:22:19 +03:00
Nekotekina 2f7fe35f5c Minor style change 2015-07-21 23:14:31 +03:00
Nekotekina 8175630619 sys_cond/sys_mutex improved 2015-07-21 23:14:29 +03:00
Nekotekina 9913c9059c Very bugfix
I reverted cellSaveData changes since they were relying on the
uninitialized local variable `save_entry` and thus were almost
completely wrong.
2015-07-21 23:14:26 +03:00
Nekotekina 82781e620a Small fixes 2015-07-10 04:31:36 +03:00
Nekotekina c0f13f7084 sleep_queue_t rewritten, used in sys_cond/sys_mutex
Some synchronization fixes
2015-07-10 04:31:34 +03:00
Nekotekina eafddd9e33 CPUThread fixes, thread_t cleanup 2015-07-10 04:31:32 +03:00