From 204336989d3c28c29fe3e04959911efaa926fe30 Mon Sep 17 00:00:00 2001 From: Ivan Chikish Date: Wed, 12 Jul 2023 17:23:59 +0300 Subject: [PATCH] [orbis-kernel] Trace sys_evf --- orbis-kernel/src/evf.cpp | 2 ++ orbis-kernel/src/sys/sys_sce.cpp | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/orbis-kernel/src/evf.cpp b/orbis-kernel/src/evf.cpp index e41441eb7..0634df182 100644 --- a/orbis-kernel/src/evf.cpp +++ b/orbis-kernel/src/evf.cpp @@ -133,6 +133,8 @@ std::size_t orbis::EventFlag::notify(NotifyType type, std::uint64_t bits) { } // TODO: update thread state + if (thread->mtx->is_free()) + std::abort(); thread->mtx->unlock(); // release wait on waiter thread waitingThreadsCount.fetch_sub(1, std::memory_order::relaxed); diff --git a/orbis-kernel/src/sys/sys_sce.cpp b/orbis-kernel/src/sys/sys_sce.cpp index c098bcdee..14c60453f 100644 --- a/orbis-kernel/src/sys/sys_sce.cpp +++ b/orbis-kernel/src/sys/sys_sce.cpp @@ -165,6 +165,7 @@ orbis::SysResult orbis::sys_evf_open(Thread *thread, ptr name) { return {}; } orbis::SysResult orbis::sys_evf_close(Thread *thread, sint id) { + ORBIS_LOG_WARNING(__FUNCTION__, thread, id); if (!thread->tproc->evfMap.close(id)) { return ErrorCode::SRCH; } @@ -175,6 +176,8 @@ orbis::SysResult orbis::sys_evf_wait(Thread *thread, sint id, uint64_t patternSet, uint64_t mode, ptr pPatternSet, ptr pTimeout) { + ORBIS_LOG_TRACE(__FUNCTION__, thread, id, patternSet, mode, pPatternSet, + pTimeout); if ((mode & (kEvfWaitModeAnd | kEvfWaitModeOr)) == 0 || (mode & ~(kEvfWaitModeAnd | kEvfWaitModeOr | kEvfWaitModeClearAll | kEvfWaitModeClearPat)) != 0 || @@ -194,6 +197,8 @@ orbis::SysResult orbis::sys_evf_wait(Thread *thread, sint id, pPatternSet != nullptr ? &resultPattern : nullptr, pTimeout != nullptr ? &resultTimeout : nullptr); + ORBIS_LOG_TRACE("sys_evf_wait wakeup", thread, resultPattern, resultTimeout); + if (pPatternSet != nullptr) { uwrite(pPatternSet, (uint64_t)resultPattern); } @@ -207,6 +212,7 @@ orbis::SysResult orbis::sys_evf_wait(Thread *thread, sint id, orbis::SysResult orbis::sys_evf_trywait(Thread *thread, sint id, uint64_t patternSet, uint64_t mode, ptr pPatternSet) { + ORBIS_LOG_TRACE(__FUNCTION__, thread, id, patternSet, mode, pPatternSet); if ((mode & (kEvfWaitModeAnd | kEvfWaitModeOr)) == 0 || (mode & ~(kEvfWaitModeAnd | kEvfWaitModeOr | kEvfWaitModeClearAll | kEvfWaitModeClearPat)) != 0 || @@ -231,6 +237,7 @@ orbis::SysResult orbis::sys_evf_trywait(Thread *thread, sint id, return result; } orbis::SysResult orbis::sys_evf_set(Thread *thread, sint id, uint64_t value) { + ORBIS_LOG_TRACE(__FUNCTION__, thread, id, value); Ref evf = thread->tproc->evfMap.get(id); if (evf == nullptr) { @@ -241,6 +248,7 @@ orbis::SysResult orbis::sys_evf_set(Thread *thread, sint id, uint64_t value) { return {}; } orbis::SysResult orbis::sys_evf_clear(Thread *thread, sint id, uint64_t value) { + ORBIS_LOG_TRACE(__FUNCTION__, thread, id, value); Ref evf = thread->tproc->evfMap.get(id); if (evf == nullptr) { @@ -252,6 +260,7 @@ orbis::SysResult orbis::sys_evf_clear(Thread *thread, sint id, uint64_t value) { } orbis::SysResult orbis::sys_evf_cancel(Thread *thread, sint id, uint64_t value, ptr pNumWaitThreads) { + ORBIS_LOG_TRACE(__FUNCTION__, thread, id, value, pNumWaitThreads); Ref evf = thread->tproc->evfMap.get(id); if (evf == nullptr) {