From 1279d236f3cd7a2b7344e17aca7121c18bca0eec Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Tue, 21 Feb 2023 10:58:02 -0700 Subject: [PATCH] kern: remove unnecessary interrupt disables from arbiter/condvar --- libraries/libmesosphere/source/kern_k_address_arbiter.cpp | 8 ++++++-- .../libmesosphere/source/kern_k_condition_variable.cpp | 3 ++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libraries/libmesosphere/source/kern_k_address_arbiter.cpp b/libraries/libmesosphere/source/kern_k_address_arbiter.cpp index 8ac08e067..c084c9053 100644 --- a/libraries/libmesosphere/source/kern_k_address_arbiter.cpp +++ b/libraries/libmesosphere/source/kern_k_address_arbiter.cpp @@ -24,7 +24,9 @@ namespace ams::kern { } ALWAYS_INLINE bool DecrementIfLessThan(s32 *out, KProcessAddress address, s32 value) { - KScopedInterruptDisable di; + /* NOTE: If scheduler lock is not held here, interrupt disable is required. */ + /* KScopedInterruptDisable di; */ + MESOSPHERE_ASSERT(KScheduler::IsSchedulerLockedByCurrentThread()); if (!cpu::CanAccessAtomic(address)) { return false; @@ -34,7 +36,9 @@ namespace ams::kern { } ALWAYS_INLINE bool UpdateIfEqual(s32 *out, KProcessAddress address, s32 value, s32 new_value) { - KScopedInterruptDisable di; + /* NOTE: If scheduler lock is not held here, interrupt disable is required. */ + /* KScopedInterruptDisable di; */ + MESOSPHERE_ASSERT(KScheduler::IsSchedulerLockedByCurrentThread()); if (!cpu::CanAccessAtomic(address)) { return false; diff --git a/libraries/libmesosphere/source/kern_k_condition_variable.cpp b/libraries/libmesosphere/source/kern_k_condition_variable.cpp index 138602cfb..59ed56362 100644 --- a/libraries/libmesosphere/source/kern_k_condition_variable.cpp +++ b/libraries/libmesosphere/source/kern_k_condition_variable.cpp @@ -158,7 +158,8 @@ namespace ams::kern { u32 prev_tag; bool can_access; { - KScopedInterruptDisable di; + /* NOTE: If scheduler lock is not held here, interrupt disable is required. */ + /* KScopedInterruptDisable di; */ can_access = cpu::CanAccessAtomic(address); if (AMS_LIKELY(can_access)) {