From 46c992729420f537b34fdc710685cc5bcb8d2e97 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Wed, 5 Jan 2022 14:41:15 +0100 Subject: [PATCH] foc: disable thread execution time readout Issue #4357 --- repos/base-foc/src/core/platform_thread.cc | 3 +++ repos/base-foc/src/core/thread_start.cc | 18 +++++++++++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/repos/base-foc/src/core/platform_thread.cc b/repos/base-foc/src/core/platform_thread.cc index 05567cf851..cc613b95e6 100644 --- a/repos/base-foc/src/core/platform_thread.cc +++ b/repos/base-foc/src/core/platform_thread.cc @@ -32,7 +32,10 @@ using namespace Foc; Trace::Execution_time Platform_thread::execution_time() const { Foc::l4_kernel_clock_t us = 0; + /* syscall does not return ever, if thread is on remote cpu, + see issue #4357 l4_thread_stats_time(_thread.local.data()->kcap(), &us); + */ return { us, 0, 10000 /* quantum readable ?*/, _prio }; } diff --git a/repos/base-foc/src/core/thread_start.cc b/repos/base-foc/src/core/thread_start.cc index 7c3fc17a19..4e14b56af3 100644 --- a/repos/base-foc/src/core/thread_start.cc +++ b/repos/base-foc/src/core/thread_start.cc @@ -78,14 +78,22 @@ void Thread::start() Info trace_source_info() const override { uint64_t const sc_time = 0; - addr_t const kcap = (addr_t) platform_thread.pager_object_badge(); using namespace Foc; l4_kernel_clock_t ec_time = 0; - l4_msgtag_t res = l4_thread_stats_time(kcap, &ec_time); - if (l4_error(res)) - Genode::error("cpu time for ", thread.name(), - " is not available ", l4_error(res)); + + /* + * The 'l4_thread_stats_time' syscall does not always return if + * the thread is on remote CPU. Disable the feature to keep core + * safe (see issue #4357). + */ + if (0) { + addr_t const kcap = (addr_t) platform_thread.pager_object_badge(); + l4_msgtag_t res = l4_thread_stats_time(kcap, &ec_time); + if (l4_error(res)) + Genode::error("cpu time for ", thread.name(), + " is not available ", l4_error(res)); + } return { Session_label("core"), thread.name(), Trace::Execution_time(ec_time, sc_time, 10000,