From a85a87a90771bb6eda1d2502c78cac9c67e123dc Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Fri, 17 Sep 2021 15:34:24 -0700 Subject: [PATCH] kern: remove per-KInterruptEventTask locks --- .../mesosphere/kern_k_interrupt_event.hpp | 5 +---- .../source/kern_k_interrupt_event.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/libraries/libmesosphere/include/mesosphere/kern_k_interrupt_event.hpp b/libraries/libmesosphere/include/mesosphere/kern_k_interrupt_event.hpp index 0d641e585..d8d05ffd7 100644 --- a/libraries/libmesosphere/include/mesosphere/kern_k_interrupt_event.hpp +++ b/libraries/libmesosphere/include/mesosphere/kern_k_interrupt_event.hpp @@ -48,13 +48,10 @@ namespace ams::kern { class KInterruptEventTask : public KSlabAllocated, public KInterruptTask { private: KInterruptEvent *m_event; - KLightLock m_lock; public: - constexpr KInterruptEventTask() : m_event(nullptr), m_lock() { /* ... */ } + constexpr KInterruptEventTask() : m_event(nullptr) { /* ... */ } ~KInterruptEventTask() { /* ... */ } - KLightLock &GetLock() { return m_lock; } - virtual KInterruptTask *OnInterrupt(s32 interrupt_id) override; virtual void DoTask() override; diff --git a/libraries/libmesosphere/source/kern_k_interrupt_event.cpp b/libraries/libmesosphere/source/kern_k_interrupt_event.cpp index bb88a7d60..4d8cb011e 100644 --- a/libraries/libmesosphere/source/kern_k_interrupt_event.cpp +++ b/libraries/libmesosphere/source/kern_k_interrupt_event.cpp @@ -60,8 +60,8 @@ namespace ams::kern { Result KInterruptEvent::Reset() { MESOSPHERE_ASSERT_THIS(); - /* Lock the task. */ - KScopedLightLock lk(g_interrupt_event_task_table[m_interrupt_id]->GetLock()); + /* Lock the scheduler. */ + KScopedSchedulerLock sl; /* Clear the event. */ R_TRY(KReadableEvent::Reset()); @@ -95,8 +95,8 @@ namespace ams::kern { /* Register/bind the interrupt task. */ { - /* Acqquire exclusive access to the task. */ - KScopedLightLock tlk(task->m_lock); + /* Lock the scheduler. */ + KScopedSchedulerLock sl; /* Bind the interrupt handler. */ R_TRY(Kernel::GetInterruptManager().BindHandler(task, interrupt_id, core_id, KInterruptController::PriorityLevel_High, true, level)); @@ -121,8 +121,8 @@ namespace ams::kern { /* Lock the task table. */ KScopedLightLock lk(g_interrupt_event_lock); - /* Lock the task. */ - KScopedLightLock tlk(m_lock); + /* Lock the scheduler. */ + KScopedSchedulerLock sl; /* Ensure we can unregister. */ MESOSPHERE_ABORT_UNLESS(g_interrupt_event_task_table[interrupt_id] == this); @@ -142,8 +142,8 @@ namespace ams::kern { void KInterruptEventTask::DoTask() { MESOSPHERE_ASSERT_THIS(); - /* Lock the task table. */ - KScopedLightLock lk(m_lock); + /* Lock the scheduler. */ + KScopedSchedulerLock sl; if (m_event != nullptr) { m_event->Signal();