From 0ea02f2d56eb55eb8eabdf6884a61787659f7dc5 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Tue, 2 Mar 2021 15:19:13 +0530 Subject: [PATCH] Fix Non-Cooperative Core Migration + Fix `yieldWithCoreMigration` + Improve Mutex Locking in `ConditionalVariableWait` The case of a thread not being in the core queue during a non-cooperative core affinity change would break things as the thread was non-conditionally removed and inserted, this has been fixed by adding a check to see if the thread exists in the core's queue prior to migration. In addition, `yieldWithCoreMigration` was broken by the previous commit as the fallthrough was intentional and removing it cause core migration without a yield which led to breakage in certain circumstances. The mutex locking logic was also improved in `ConditionalVariableWait` to use atomics in a more effective manner with less atomic operations being performed overall. --- .idea/inspectionProfiles/Project_Default.xml | 2 +- app/src/main/cpp/skyline/kernel/scheduler.cpp | 44 +++++++++++-------- app/src/main/cpp/skyline/kernel/scheduler.h | 6 +++ app/src/main/cpp/skyline/kernel/svc.cpp | 10 ++--- .../cpp/skyline/kernel/types/KProcess.cpp | 24 +++++----- 5 files changed, 47 insertions(+), 39 deletions(-) diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index ef2d25b4..dfe4c22f 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -171,7 +171,7 @@ -