[PATCH v12 64/69] drm-dyndbg: restore CONFIG_DRM_USE_DYNAMIC_DEBUG un-BROKEN

Jim Cromie posted 69 patches 1 week ago
[PATCH v12 64/69] drm-dyndbg: restore CONFIG_DRM_USE_DYNAMIC_DEBUG un-BROKEN
Posted by Jim Cromie 1 week ago
Time for some thorough CI.

NOTE: the previous ~18 1-liner patches adding DRM_CLASSMAP_USE, can be
replaced by a single call to DYNAMIC_DEBUG_CLASSMAP_USE, from a source
file linked into all drm drivers & helpers.

Heres how it works:

1- drm/drm_dyndbg_classmap_user.h calls the macro.
   This is a weird header, since it declares a record (inside an ifdef).

2. drm/Makefile: ccflags-subdir-$(DRM_USE_DYNAMIC_DEBUG)
   adds -include $(drm-src)/drm_dyndbg_classmap_user.h
   This "header" is compiled into every object file in every module

3. the DYNAMIC_DEBUG_CLASSMAP_USE macro is altered to declare the
   classmap-user records as __weak, and to place them into the
   .gnu.linkonce.d.__dyndbg_class_user.* section.  This allows
   multiple declarations in a module to collapse to 1 record.

4. dyndbg.lds.h's MOD_DYNDBG_SECTIONS() renames the section, stripping
   the .gnu.linkonce.d prefix, so kernel/module/main can find the
   section and dyndbg can process it as before.

5. drm/Makefile: adds several ccflags-$(MODNAME)-DRM_DYNDBG_USER_SKIP
   definitions, this is one of the ifdefs in [1].  Its needed to break
   the dependency loop that is created when drm.ko depends upon
   itself, or when drm-quirks that it depends upon also depend on it.

So this works, but it is weird (horrible, hacky, obscure, marvelous),
and I dont have asbestos underwear.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 drivers/gpu/drm/Kconfig.debug | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/Kconfig.debug b/drivers/gpu/drm/Kconfig.debug
index 05dc43c0b8c5..6c83b1276870 100644
--- a/drivers/gpu/drm/Kconfig.debug
+++ b/drivers/gpu/drm/Kconfig.debug
@@ -1,7 +1,6 @@
 config DRM_USE_DYNAMIC_DEBUG
 	bool "use dynamic debug to implement drm.debug"
 	default n
-	depends on BROKEN
 	depends on DRM
 	depends on DYNAMIC_DEBUG || DYNAMIC_DEBUG_CORE
 	depends on JUMP_LABEL
-- 
2.53.0