summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Bowman <sam@sambowman.tech>2022-08-26 22:01:25 -0400
committerAndreas Kling <kling@serenityos.org>2023-04-28 09:27:55 +0200
commitfc1fd907b4fa21331a2f6b364b5fff351bf513a3 (patch)
tree36b12839e97ec960e5a3bedb2d1f0a6057c889a1
parent897c4e5145474d55b247a4a3b5e6bf5420279e2f (diff)
downloadserenity-fc1fd907b4fa21331a2f6b364b5fff351bf513a3.zip
Kernel: Create all kernel processes before enabling boot profiling
Process created performance events for kernel processes are only ever emitted for the kernel processes that exist when profiling is enabled. Any new kernel processes created after profiling is enabled will not have corresponding process created performance events, so all kernel processes should be created before enabling profiling. NetworkTask was the only kernel process being created after enabling profiling, so we now just create it before enabling profiling. This fixes an issue where Profiler was failing to parse boot profiles as a result of NetworkTask not having a process created event.
-rw-r--r--Kernel/Arch/init.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/Kernel/Arch/init.cpp b/Kernel/Arch/init.cpp
index f11a61a4dd..6b2d785af1 100644
--- a/Kernel/Arch/init.cpp
+++ b/Kernel/Arch/init.cpp
@@ -420,6 +420,10 @@ void init_stage2(void*)
g_init_pid = init_process->pid();
init_thread->set_priority(THREAD_PRIORITY_HIGH);
+ NetworkTask::spawn();
+
+ // NOTE: All kernel processes must be created before enabling boot profiling.
+ // This is so profiling_enable() can emit process created performance events for them.
if (boot_profiling) {
dbgln("Starting full system boot profiling");
MutexLocker mutex_locker(Process::current().big_lock());
@@ -428,8 +432,6 @@ void init_stage2(void*)
VERIFY(!result.is_error());
}
- NetworkTask::spawn();
-
Process::current().sys$exit(0);
VERIFY_NOT_REACHED();
}