]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: add CONFIG_GCOV_PROFILE_AMDGPU Kconfig option
authorVitaly Prosyak <vitaly.prosyak@amd.com>
Tue, 24 Mar 2026 23:53:59 +0000 (19:53 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Fri, 3 Apr 2026 17:51:31 +0000 (13:51 -0400)
Add a Kconfig option to enable GCOV code coverage profiling for the
amdgpu driver, following the established upstream pattern used by
CONFIG_GCOV_PROFILE_FTRACE (kernel/trace), CONFIG_GCOV_PROFILE_RDS
(net/rds), and CONFIG_GCOV_PROFILE_URING (io_uring).

This allows CI systems to enable amdgpu code coverage entirely via
.config (e.g., scripts/config --enable GCOV_PROFILE_AMDGPU) without
manually editing the amdgpu Makefile. The option depends on both
DRM_AMDGPU and GCOV_KERNEL, defaults to n, and is therefore never
enabled in production or distro builds.

Cc: Christian König <christian.koenig@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Acked-by: Christian König <christian.koenig@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/Kconfig
drivers/gpu/drm/amd/amdgpu/Makefile

index 7f515be5185dcff6d919e89c56dd26fb666d6957..7fb0b93bc1caa5b5092b525e47904a23af11fe96 100644 (file)
@@ -103,6 +103,23 @@ config DRM_AMDGPU_WERROR
          Add -Werror to the build flags for amdgpu.ko.
          Only enable this if you are warning code for amdgpu.ko.
 
+
+config GCOV_PROFILE_AMDGPU
+       bool "Enable GCOV profiling on amdgpu"
+       depends on DRM_AMDGPU
+       depends on GCOV_KERNEL
+       default n
+       help
+         Enable GCOV profiling on the amdgpu driver for checking which
+         functions/lines are executed during testing. This adds compiler
+         instrumentation flags to all amdgpu source files, producing
+         .gcda/.gcno coverage data accessible via debugfs.
+
+         This increases the amdgpu module size by ~50% and adds ~2-5%
+         runtime overhead on GPU submission paths.
+
+         If unsure, say N.
+
 source "drivers/gpu/drm/amd/acp/Kconfig"
 source "drivers/gpu/drm/amd/display/Kconfig"
 source "drivers/gpu/drm/amd/amdkfd/Kconfig"
index 6a7e9bfec59eb05b2d13e8e679fd168095ef21f7..db66c6372199931e990e366c367efed184b208c0 100644 (file)
@@ -27,6 +27,10 @@ FULL_AMD_PATH=$(src)/..
 DISPLAY_FOLDER_NAME=display
 FULL_AMD_DISPLAY_PATH = $(FULL_AMD_PATH)/$(DISPLAY_FOLDER_NAME)
 
+ifdef CONFIG_GCOV_PROFILE_AMDGPU
+GCOV_PROFILE := y
+endif
+
 ccflags-y := -I$(FULL_AMD_PATH)/include/asic_reg \
        -I$(FULL_AMD_PATH)/include \
        -I$(FULL_AMD_PATH)/amdgpu \