The Linux kernel provides many mechanisms to diagnose issues including tracing, BPF, and profiling. Most of these techniques are available in the Generic Kernel Image (GKI) binary kernel. When developing products, there are many more tools that are integrated into the development or integration processes, some of which require kernel features that aren't part of GKI. As with most GKI features, we encourage you to work with upstream maintainers to add these features to Linux.
Downstream debug features in vendor modules
Debugging features are similar in scope to other kinds of features and must follow the same processes as described in Android-specific patches.
Intrusive downstream debug features
Some useful debug features require special configuration options that are
disabled in GKI and therefore require a special build of the kernel. These
features might be disabled due to performance penalties or unsuitability for
production use, but are indispensable for debugging certain
types of issues. Examples of such tools include sanitizers (KASAN, UBSAN),
debugfs, and other partner-specific features and tools.
It's up to you to determine how you manage special debug-enabled kernels that impact the Kernel Module Interface (KMI). A common practice is to have an internal debug build and deliver the resulting artifacts to internal customers or downstream development partners. We recommend continuing to isolate such features into modules as partner-specific debug features can't be accepted into the GKI kernel beyond the guidelines described in Android-specific patches.