bunnei
1b8ed3a76d
hle: kernel: KScheduler: Fix deadlock with core waiting for a thread lock that has migrated.
...
- Previously, it was possible for a thread migration to occur from core A to core B.
- Next, core B waits on a guest lock that must be released by a thread queued for core A.
- Meanwhile, core A is still waiting on the core B's current thread lock - resulting in a deadlock.
- Fix this by try-locking the thread lock.
- Fixes softlocks in FF8 and Pokemon Legends Arceus.
2022-01-27 12:17:14 -08:00
bunnei
b3f8d2491d
hle: kernel: KThread: Ensure host (dummy) threads block on locking.
...
- But do not enter the priority queue, as otherwise they will be scheduled.
- Allows dummy threads to use guest synchronization primitives.
2022-01-21 17:12:06 -08:00
bunnei
668af26696
hle: kernel: KThread: Decrease DummyThread priority to ensure it is never scheduled.
2022-01-20 17:08:00 -08:00
bunnei
f1e06f984d
hle: kernel: KScheduler: Ensure dummy threads are never scheduled.
...
- These are only used by host threads for locking.
2022-01-20 17:08:00 -08:00
Valeri
01852ee857
hle: remove no-op code
...
Found by static analysis with PVS-Studio. Nobody seems to really know what was it doing there.
2022-01-17 13:51:12 +03:00
bunnei
b12695ddc4
core: hle: kernel: Implement thread pinning.
...
- We largely had the mechanics in place for thread pinning, this change hooks these up.
- Validated with tests https://github.com/Atmosphere-NX/Atmosphere/blob/master/tests/TestSvc/source/test_thread_pinning.cpp .
2021-12-30 15:50:45 -08:00
bunnei
5788e077cd
hle: kernel k_scheduler: EnableScheduling: Remove redundant GetCurrentThreadPointer calls.
2021-12-06 16:39:18 -08:00
FernandoS27
2a7b4489a0
hle: kernel: fix scheduling ops from HLE host thread.
2021-12-06 16:39:17 -08:00
bunnei
58da4d5a6e
hle: kernel: Add a flag for indicating that the kernel is currently shutting down.
2021-12-06 16:39:17 -08:00
bunnei
d31fc39e05
core: hle: kernel: k_scheduler: Improve DisableScheduling and EnableScheduling.
2021-12-06 16:39:16 -08:00
bunnei
1e03387d98
core: hle: kernel: k_scheduler: Remove unnecessary MakeCurrentProcess.
2021-12-06 16:39:16 -08:00
bunnei
454970983d
core: hle: kernel: k_scheduler: Improve ScheduleImpl.
2021-12-06 16:39:16 -08:00
bunnei
90310b9c03
core: hle: kernel: k_scheduler: Improve Unload.
2021-12-06 16:39:16 -08:00
bunnei
fa26f905c8
core: hle: kernel: Ensure idle threads are closed before destroying scheduler.
2021-12-06 16:39:16 -08:00
bunnei
5e600cba3a
Revert "kernel: Various improvements to scheduler"
2021-08-25 20:59:28 -07:00
bunnei
19457823ea
core: hle: kernel: k_scheduler: Improve DisableScheduling and EnableScheduling.
2021-08-07 12:18:47 -07:00
bunnei
aedc599224
core: hle: kernel: k_scheduler: Remove unnecessary MakeCurrentProcess.
2021-08-07 12:18:47 -07:00
bunnei
edba87b96d
core: hle: kernel: k_scheduler: Improve ScheduleImpl.
2021-08-07 12:18:47 -07:00
bunnei
0d22a55e01
core: hle: kernel: k_scheduler: Improve Unload.
2021-08-07 12:18:47 -07:00
bunnei
43fcb97ef3
core: hle: kernel: Ensure idle threads are closed before destroying scheduler.
2021-08-07 12:18:47 -07:00
Markus Wick
c9f9e77be3
core/arm_interface: Call SVC after end of dynarmic block.
...
So we can modify all of dynarmic states within SVC without ExceptionalExit.
Especially as the ExceptionalExit hack is dropped on upstream dynarmic.
2021-05-27 23:23:23 +02:00
Lioncash
eeae5217ba
core: Make variable shadowing a compile-time error
...
Now that we have most of core free of shadowing, we can enable the
warning as an error to catch anything that may be remaining and also
eliminate this class of logic bug entirely.
2021-05-16 03:43:16 -04:00
Lioncash
e019da0487
kernel: Eliminate variable shadowing
...
Now that the large kernel refactor is merged, we can eliminate the
remaining variable shadowing cases.
2021-05-08 12:33:26 -04:00
bunnei
ad048de3d6
hle: kernel: Rename Process to KProcess.
2021-05-05 16:40:52 -07:00
bunnei
715978756e
hle: kernel: Refactor several threads/events/sharedmemory to use slab heaps.
2021-05-05 16:40:51 -07:00
bunnei
2cb4c9d7b2
hle: kernel: Move slab heap management to KernelCore.
2021-05-05 16:40:51 -07:00
bunnei
9f82c577d0
hle: kernel: Ensure all kernel objects with KAutoObject are properly created.
2021-05-05 16:40:51 -07:00
bunnei
773580b9f7
hle: kernel: Migrate idle threads.
2021-05-05 16:40:50 -07:00
bunnei
0aac780e5d
hle: kernel: Migrate some code from Common::SpinLock to KSpinLock.
2021-03-21 14:45:02 -07:00
bunnei
e4b692bd16
common: Fiber: use a reference for YieldTo.
...
- Fixes another small leak.
2021-03-07 13:46:53 -08:00
bunnei
75519d107f
hle: kernel: KThread: Rework dummy threads & fix memory leak.
...
- Dummy threads are created on thread local storage for all host threads.
- Fixes a leak by removing creation of fibers, which are not applicable here.
2021-03-05 17:10:57 -08:00
bunnei
845a217d5e
Revert "core: Switch to unique_ptr for usage of Common::Fiber."
2021-03-05 17:08:17 -08:00
bunnei
3322f10f84
core: Switch to unique_ptr for usage of Common::Fiber.
...
- With using unique_ptr instead of shared_ptr, we have more explicit ownership of the context.
- Fixes a memory leak due to circular reference of the shared pointer.
2021-02-27 11:56:04 -08:00
bunnei
cf3a05cf8c
hle: kernel: Allocate a dummy KThread for each host thread, and use it for scheduling.
2021-01-28 21:42:26 -08:00
bunnei
0b307a12f3
hle: kernel: k_scheduler: Use atomics for current_thread, etc.
2021-01-28 21:42:26 -08:00
bunnei
9b0a981710
hle: kernel: k_scheduler: Fix for single core mode.
2021-01-28 21:42:26 -08:00
bunnei
177b4da4e7
hle: kernel: KScheduler: Introduce thread context_guard.
2021-01-28 21:42:26 -08:00
bunnei
f34dd04d09
hle: kernel: Recode implementation of KThread to be more accurate.
2021-01-28 21:42:26 -08:00
bunnei
4ba9d6f969
hle: kernel: KThread: Clean up thread priorities.
2021-01-28 21:42:25 -08:00
bunnei
0ae0bc4340
hle: kernel: KThread: Reorganize thread priority defaults.
2021-01-28 21:42:25 -08:00
bunnei
eb396cd021
hle: kernel: KThread: Fix ThreadType definition.
2021-01-28 21:42:25 -08:00
bunnei
e74f682506
hle: kernel: KThread: Remove thread types that do not exist.
2021-01-28 21:42:25 -08:00
bunnei
3d70b4a4ea
core: hle: kernel: Rename Thread to KThread.
2021-01-28 21:42:25 -08:00
Lioncash
d5bff783bd
common/bit_util: Replace CLZ/CTZ operations with standardized ones
...
Makes for less code that we need to maintain.
2021-01-15 02:15:32 -05:00
bunnei
99a3953705
hle: kernel: k_scheduler: Cleanup OnThreadPriorityChanged.
2021-01-11 14:23:16 -08:00
bunnei
9744afa8b1
hle: kernel: thread: Replace ThreadStatus/ThreadSchedStatus with a single ThreadState.
...
- This is how the real kernel works, and is more accurate and simpler.
2021-01-11 14:23:16 -08:00
bunnei
2feb4d56e9
core: hle: kernel: Update KSynchronizationObject.
2021-01-11 14:23:16 -08:00
bunnei
2033f0a1a3
hle: kernel: KScheduler: Various style fixes based on code review feedback.
2020-12-06 00:27:13 -08:00
bunnei
ea30e22ef1
hle: kernel: Use C++ style comments in KScheduler, etc.
2020-12-06 00:03:24 -08:00
bunnei
de522657dd
hle: kernel: Migrate to KScopedSchedulerLock.
2020-12-06 00:03:24 -08:00