Commit Graph

42 Commits (fd5e1e80dac515ecb4a1cf9a12665b6645349370)

Author SHA1 Message Date
lat9nq 6bcbbb29e7 k_thread: Fix data race
TSan reports a data race between writing at cpp:1162 and reading at
h:262. Make the thread_state atomic to prevent this.
4 years ago
bunnei 25c0acc388 core: hle: kernel: k_thread: Update to reflect tree changes. 4 years ago
bunnei 615fb40416 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.
4 years ago
bunnei 46a620f9d7 hle: kernel: KThread: Decrease DummyThread priority to ensure it is never scheduled. 4 years ago
bunnei f6cbb14dce hle: kernel: KThread: Rename thread_type_for_debugging -> thread_type.
- This will be used to ensure that we do not schedule dummy threads.
4 years ago
bunnei f499c8177e core: hle: kernel: KThread: Integrate with KWorkerTask and implement DoWorkerTaskImpl.
- This is used to terminate a thread asynchronously after it has been exited.
- This fixes a crash that can occur in Pokemon Sword/Shield because a thread is incorrectly closed on svcExitThread, then, the thread is destroyed on svcCloseHandle while it is still scheduled.
- Instead, we now wait for the thread to no longer be scheduled on all cores before destroying it from KWorkerTaskManager, which is accurate to HOS behavior.
4 years ago
bunnei 03884b7ea6 core: hle: kernel: KThread: Replace Suspend with UpdateState & various updates.
- This makes our implementations of these more closely match HOS.
4 years ago
bunnei 3a89723d97 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.
4 years ago
bunnei 42697527ba hle: kernel: k_thread: Rename sleeping_queue -> wait_queue. 4 years ago
bunnei 0d9afdedc4 hle: kernel: k_thread: Treat dummy threads as a special type. 4 years ago
bunnei abbea575cf hle: kernel: Add a flag for indicating that the kernel is currently shutting down. 4 years ago
bunnei 8f4ff06c4c hle: kernel: Cleanup to match coding style. 4 years ago
bunnei b0671c7cfa hle: kernel: KThread: Migrate to updated KThreadQueue (part 1). 4 years ago
bunnei 2f89456041 hle: kernel: KThread: Remove tracking of sync object from threads. 4 years ago
bunnei bc1399204b hle: kernel: Update KThreadQueue and migrate KSynchronizationObject. 4 years ago
bunnei 3dc803a430 core: hle: kernel: Disable dispatch count tracking on single core.
- This would have limited value, and would be a mess to handle properly.
4 years ago
bunnei d14b8fc747 core: hle: kernel: k_thread: Mark KScopedDisableDispatch as nodiscard. 4 years ago
bunnei 04daefa488 core: hle: kernel: k_thread: Add KScopedDisableDispatch. 4 years ago
bunnei 0c8594b225
Revert "kernel: Various improvements to scheduler" 4 years ago
bunnei aef0ca6f0d core: hle: kernel: Disable dispatch count tracking on single core.
- This would have limited value, and would be a mess to handle properly.
4 years ago
bunnei 5060a97210 core: hle: kernel: k_thread: Mark KScopedDisableDispatch as nodiscard. 4 years ago
bunnei 01af2f4162 core: hle: kernel: k_thread: Add KScopedDisableDispatch. 4 years ago
Morph 12c1766997 general: Replace RESULT_SUCCESS with ResultSuccess
Transition to PascalCase for result names.
5 years ago
Lioncash 7b2917b4e1 kernel: Add missing override specifiers
Over the course of the kernel refactoring a tiny bit of missing
overrides slipped through review, so we can add these.

While we're at it, we can remove redundant virtual keywords where
applicable as well.
5 years ago
Lioncash 2f62bae9e3 kernel: Eliminate variable shadowing
Now that the large kernel refactor is merged, we can eliminate the
remaining variable shadowing cases.
5 years ago
bunnei 2a7eff57a8 hle: kernel: Rename Process to KProcess. 5 years ago
bunnei bf380b8584 hle: kernel: Remove deprecated Object class. 5 years ago
bunnei 479bd50b96 hle: kernel: Migrate KThread to KAutoObject. 5 years ago
Lioncash 0fb3773924 k_thread: Remove [[nodiscard]] attribute from ClearWaitCancelled()
This function has a void return value, so this attribute doesn't apply
to it.
5 years ago
bunnei 5872561077 hle: kernel: Migrate some code from Common::SpinLock to KSpinLock. 5 years ago
bunnei 47af34003b 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.
5 years ago
bunnei a5ab85ac37
Revert "core: Switch to unique_ptr for usage of Common::Fiber." 5 years ago
bunnei 51fb0a6f96 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.
5 years ago
bunnei 10738839ad yuzu: debugger: Ignore HLE threads. 5 years ago
bunnei ca78f77827 hle: kernel: KScheduler: Introduce thread context_guard. 5 years ago
bunnei cdd14b03e5 hle: kernel: Recode implementation of KThread to be more accurate. 5 years ago
bunnei 4dbf3f4880 hle: kernel: KThread: Clean up thread priorities. 5 years ago
bunnei 1e55498110 hle: kernel: KThread: Reorganize thread priority defaults. 5 years ago
bunnei 0530292b97 hle: kernel: KThread: Fix ThreadType definition. 5 years ago
bunnei 4782985013 hle: kernel: Move single core "phantom mode" out of KThread.
- This is a workaround that does not belong in a kernel primitive.
5 years ago
bunnei eea346ba8e hle: kernel: KThread: Remove thread types that do not exist. 5 years ago
bunnei c0d3aef28c core: hle: kernel: Rename Thread to KThread. 5 years ago