diff options
| author | 2020-03-10 13:13:39 -0400 | |
|---|---|---|
| committer | 2020-06-27 11:35:45 -0400 | |
| commit | d494b074e8afd3aff7b65afc7b977496be06ccc9 (patch) | |
| tree | 002cc29d32a9b1e44e61fb1aae122715556b36c5 /src/core/hle/kernel/svc.cpp | |
| parent | CPU_Manager: Unload/Reload threads on preemption on SingleCore (diff) | |
| download | yuzu-d494b074e8afd3aff7b65afc7b977496be06ccc9.tar.gz yuzu-d494b074e8afd3aff7b65afc7b977496be06ccc9.tar.xz yuzu-d494b074e8afd3aff7b65afc7b977496be06ccc9.zip | |
Kernel: Preempt Single core on redudant yields.
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index aad2ac549..eca92b356 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp | |||
| @@ -19,6 +19,7 @@ | |||
| 19 | #include "core/core_manager.h" | 19 | #include "core/core_manager.h" |
| 20 | #include "core/core_timing.h" | 20 | #include "core/core_timing.h" |
| 21 | #include "core/core_timing_util.h" | 21 | #include "core/core_timing_util.h" |
| 22 | #include "core/cpu_manager.h" | ||
| 22 | #include "core/hle/kernel/address_arbiter.h" | 23 | #include "core/hle/kernel/address_arbiter.h" |
| 23 | #include "core/hle/kernel/client_port.h" | 24 | #include "core/hle/kernel/client_port.h" |
| 24 | #include "core/hle/kernel/client_session.h" | 25 | #include "core/hle/kernel/client_session.h" |
| @@ -1509,21 +1510,31 @@ static void SleepThread(Core::System& system, s64 nanoseconds) { | |||
| 1509 | 1510 | ||
| 1510 | if (nanoseconds <= 0) { | 1511 | if (nanoseconds <= 0) { |
| 1511 | switch (static_cast<SleepType>(nanoseconds)) { | 1512 | switch (static_cast<SleepType>(nanoseconds)) { |
| 1512 | case SleepType::YieldWithoutLoadBalancing: | 1513 | case SleepType::YieldWithoutLoadBalancing: { |
| 1513 | current_thread->YieldSimple(); | 1514 | auto pair = current_thread->YieldSimple(); |
| 1515 | is_redundant = pair.second; | ||
| 1514 | break; | 1516 | break; |
| 1515 | case SleepType::YieldWithLoadBalancing: | 1517 | } |
| 1516 | current_thread->YieldAndBalanceLoad(); | 1518 | case SleepType::YieldWithLoadBalancing: { |
| 1519 | auto pair = current_thread->YieldAndBalanceLoad(); | ||
| 1520 | is_redundant = pair.second; | ||
| 1517 | break; | 1521 | break; |
| 1518 | case SleepType::YieldAndWaitForLoadBalancing: | 1522 | } |
| 1519 | current_thread->YieldAndWaitForLoadBalancing(); | 1523 | case SleepType::YieldAndWaitForLoadBalancing: { |
| 1524 | auto pair = current_thread->YieldAndWaitForLoadBalancing(); | ||
| 1525 | is_redundant = pair.second; | ||
| 1520 | break; | 1526 | break; |
| 1527 | } | ||
| 1521 | default: | 1528 | default: |
| 1522 | UNREACHABLE_MSG("Unimplemented sleep yield type '{:016X}'!", nanoseconds); | 1529 | UNREACHABLE_MSG("Unimplemented sleep yield type '{:016X}'!", nanoseconds); |
| 1523 | } | 1530 | } |
| 1524 | } else { | 1531 | } else { |
| 1525 | current_thread->Sleep(nanoseconds); | 1532 | current_thread->Sleep(nanoseconds); |
| 1526 | } | 1533 | } |
| 1534 | |||
| 1535 | if (is_redundant && !system.Kernel().IsMulticore()) { | ||
| 1536 | system.GetCpuManager().PreemptSingleCore(); | ||
| 1537 | } | ||
| 1527 | } | 1538 | } |
| 1528 | 1539 | ||
| 1529 | /// Wait process wide key atomic | 1540 | /// Wait process wide key atomic |