mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:17:44 +00:00
Kernel: Make sure we only log profiling events when m_profiling is true
Previously the process' m_profiling flag was ignored for all event types other than CPU samples. The kfree tracing code relies on temporarily disabling tracing during exec. This didn't work for per-process profiles and would instead panic. This updates the profiling code so that the m_profiling flag isn't ignored.
This commit is contained in:
parent
a8ca4751b9
commit
0688e02339
4 changed files with 15 additions and 16 deletions
|
@ -506,6 +506,7 @@ KResult Process::do_exec(NonnullRefPtr<FileDescription> main_program_description
|
|||
Locker ptrace_locker(ptrace_lock());
|
||||
|
||||
// Disable profiling temporarily in case it's running on this process.
|
||||
auto was_profiling = m_profiling;
|
||||
TemporaryChange profiling_disabler(m_profiling, false);
|
||||
|
||||
kill_threads_except_self();
|
||||
|
@ -645,7 +646,10 @@ KResult Process::do_exec(NonnullRefPtr<FileDescription> main_program_description
|
|||
tss.cr3 = space().page_directory().cr3();
|
||||
tss.ss2 = pid().value();
|
||||
|
||||
PerformanceManager::add_process_exec_event(*this);
|
||||
{
|
||||
TemporaryChange profiling_disabler(m_profiling, was_profiling);
|
||||
PerformanceManager::add_process_exec_event(*this);
|
||||
}
|
||||
|
||||
{
|
||||
ScopedSpinLock lock(g_scheduler_lock);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue