summaryrefslogtreecommitdiff
path: root/Kernel/PerformanceEventBuffer.cpp
AgeCommit message (Collapse)Author
2023-06-04Kernel: Move Performance-measurement code to the Tasks subdirectoryLiav A
2023-06-04Everywhere: Move global Kernel pattern code to Kernel/Library directoryLiav A
This has KString, KBuffer, DoubleBuffer, KBufferBuilder, IOWindow, UserOrKernelBuffer and ScopedCritical classes being moved to the Kernel/Library subdirectory. Also, move the panic and assertions handling code to that directory.
2023-06-04Kernel: Move all tasks-related code to the Tasks subdirectoryLiav A
2023-02-24AK+Kernel: Add includes before removing Kernel/ProcessExposed.hLiav A
Apparently without this file, we won't be able to compile due to missing includes to TimeManagement and KBufferBuilder.
2023-02-10Everywhere: Remove needless copies of Error / ErrorOr instancesTimothy Flynn
Either take the underlying objects with release_* methods or move() the instances around.
2023-02-06Kernel: Protect Process::m_name with a spinlockSam Atkins
This also lets us remove the `get_process_name` and `set_process_name` syscalls from the big lock. :^)
2022-08-24Kernel: Don't wrap AddressSpace's RegionTree in SpinlockProtectedAndreas Kling
Now that AddressSpace itself is always SpinlockProtected, we don't need to also wrap the RegionTree. Whoever has the AddressSpace locked is free to poke around its tree.
2022-08-24Kernel: Wrap process address spaces in SpinlockProtectedAndreas Kling
This forces anyone who wants to look into and/or manipulate an address space to lock it. And this replaces the previous, more flimsy, manual spinlock use. Note that pointers *into* the address space are not safe to use after you unlock the space. We've got many issues like this, and we'll have to track those down as wlel.
2022-08-24Kernel: Wrap RegionTree objects in SpinlockProtectedAndreas Kling
This makes locking them much more straightforward, and we can remove a bunch of confusing use of AddressSpace::m_lock. That lock will also be converted to use of SpinlockProtected in a subsequent patch.
2022-08-22Kernel: Use Process::credentials() and remove user ID/group ID helpersAnthony Iacono
Move away from using the group ID/user ID helpers in the process to allow for us to take advantage of the immutable credentials instead.
2022-07-12Everywhere: Use default StringView constructor over nullptrsin-ack
While null StringViews are just as bad, these prevent the removal of StringView(char const*) as that constructor accepts a nullptr. No functional changes.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-07-12Kernel: Annotate all `KBuffer` and `DoubleBuffer` with a custom nameTim Schumacher
2022-05-03Kernel: Move Kernel/Arch/x86/SafeMem.h to Kernel/Arch/SafeMem.hTimon Kruiper
The file does not contain any specific architectural code, thus it can be moved to the Kernel/Arch directory.
2022-05-03Kernel: Fetch the frame pointer using __builtin_frame_address()Timon Kruiper
This compiler builtin abstracts away the specifics of fetching the frame pointer. This will allow the KSyms.cpp to be build for the aarch64 target. While we're here, lets also change the PerformanceEventBuffer.cpp to not rely on x86_64 specifics.
2022-04-03Kernel: Store AddressSpace memory regions in an IntrusiveRedBlackTreeAndreas Kling
This means we never need to allocate when inserting/removing regions from the address space.
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-03Kernel: Fixed behavior of repeated calls to register_stringJakub Berkop
Previously register_string would return incorrect values when called multiple times with the same input. This patch makes this function return the same index, identical strings. This change was required, as this functionality is now being used with read syscall profiling, (#12465), which uses 'register_string' to registers file path on every read syscall.
2022-02-27Everywhere: Make JSON serialization fallibleIdan Horowitz
This allows us to eliminate a major source of infallible allocation in the Kernel, as well as lay down the groundwork for OOM fallibility in userland.
2022-02-14Kernel/Profiling: Add profiling to read syscallJakub Berkop
Syscalls to read can now be profiled, allowing us to monitor filesystem usage by different applications.
2022-01-30Kernel: Remove unnecessary includes from Thread.hAndreas Kling
...and deal with the fallout by adding missing includes everywhere.
2022-01-12Kernel: Make PerformanceEventBuffer::add_process fallible with ErrorOrIdan Horowitz
2022-01-12Kernel: Use try_serialize_absolute_path in PerformanceEventBufferIdan Horowitz
This only moves the issue, as PerformanceEventBuffer::add_process can't fail yet, but this will allow us to remove the non-failable Custody::absolute_path API.
2022-01-05Kernel: Use unchecked_append in PerformanceEventBuffer `raw_backtrace()`Brian Gianforcaro
We always validate the size before we append, so there is no reason to use the checked append.
2021-12-30Kernel: Add some implied auto qualifiersHendiadyoin1
2021-12-19Kernel: Mask kernel addresses in perf event streams for non-superuserAndreas Kling
We now turn kernel addresses into 0xdeadc0de, same as /proc/PID/stacks/
2021-12-19Kernel: Don't include kmalloc perf events in JSON for non-superuserAndreas Kling
These events contain sensitive kernel information and should not be available to regular users.
2021-12-19Kernel: Stop perf event stack walk on bogus userspace->kernel traversalAndreas Kling
When walking the stack to generate a perf_event sample, we now check if a userspace stack frame points back into kernel memory. It was possible to use this as an arbitrary kernel memory read. :^)
2021-12-18Kernel: Start perf event stack capture at RBP, not EBP on x86_64Andreas Kling
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-11-11AK: Make HashTable and HashMap try_* functions return ErrorOr<T>Andreas Kling
This allows us to use TRY() and MUST() with them.
2021-11-08Kernel: Replace KResult and KResultOr<T> with Error and ErrorOr<T>Andreas Kling
We now use AK::Error and AK::ErrorOr<T> in both kernel and userspace! This was a slightly tedious refactoring that took a long time, so it's not unlikely that some bugs crept in. Nevertheless, it does pass basic functionality testing, and it's just real nice to finally see the same pattern in all contexts. :^)
2021-10-15Kernel: Add cross platform RegisterState header and Aarch64 versionJames Mintram
A new RegisterState header includes the platform specific RegisterState header based on the platform being compiled. The Aarch64 RegisterState header contains stubs for Debug
2021-10-15Kernel: Split SmapDisabler so header is platform independentJames Mintram
A new header file has been created in the Arch/ folder while the implementation has been moved into a CPP living in the X86 folder.
2021-10-12Kernel: Pass RegisterState by ref to event bufferJames Mintram
2021-10-12Kernel: Accept RegisterState in append_with_ip_and_bpJames Mintram
2021-09-13Kernel: Deduplicate signpost perf event stringsAli Mohammad Pur
2021-09-07Kernel: Make PerformanceEventBuffer::to_json() return a KResultAndreas Kling
There's a ton of things inside to_json() that could go wrong but we don't know about it yet. One step at a time.
2021-09-07Kernel: Make KBuffer::try_create_with_size() return KResultOrAndreas Kling
This allows us to use TRY() in a lot of new places.
2021-08-22Kernel: Rename ScopedSpinlock => SpinlockLockerAndreas Kling
This matches MutexLocker, and doesn't sound like it's a lock itself.
2021-08-22Kernel: Rename SpinLock => SpinlockAndreas Kling
2021-08-12Kernel: Make sys$perf_register_string() generate the string ID'sAndreas Kling
Making userspace provide a global string ID was silly, and made the API extremely difficult to use correctly in a global profiling context. Instead, simply make the kernel do the string ID allocation for us. This also allows us to convert the string storage to a Vector in the kernel (and an array in the JSON profile data.)
2021-08-12Kernel+LibC: Add sys$perf_register_string()Andreas Kling
This syscall allows userspace to register a keyed string that appears in a new "strings" JSON object in profile output. This will be used to add custom strings to profile signposts. :^)
2021-08-12Kernel+LibC: Add PERF_EVENT_SIGNPOSTAndreas Kling
This event will be used by userspace programs wanting to mark interesting high-level events in the profile. :^)
2021-08-10Kernel: Add syscall performance event typeJean-Baptiste Boric
This allows tracing the syscalls made by a thread through the kernel's performance event framework, which is similar in principle to strace. Currently, this merely logs a stack backtrace to the current thread's performance event buffer whenever a syscall is made, if profiling is enabled. Future improvements could include tracing the arguments and the return value, for example.
2021-08-06Kernel: Add convenience values to the Memory::Region::Access enumAndreas Kling
Instead of `Memory::Region::Access::Read | Memory::Region::AccessWrite` you can now say `Memory::Region::Access::ReadWrite`.
2021-08-06Kernel: Rename Process::space() => Process::address_space()Andreas Kling
We commonly talk about "a process's address space" so let's nudge the code towards matching how we talk about it. :^)
2021-08-06Kernel: Move Kernel/Memory/ code into Kernel::Memory namespaceAndreas Kling
2021-07-19Kernel: Rename PerformanceEvent methods to be more ARCH independentBrian Gianforcaro
2021-06-29Kernel: Remove some unnecessary JSON related includesAndreas Kling