Skip to contentSkip to conversation

drm: amd: dc: don't use FP math when Kcov is enabled

PATCH In review Arnd Bergmann 2 participants 5 messages Dec 4, 2017 – Jan 16, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: amd: dc: don't use FP math when Kcov is enabled

Building the DCN 1.0 Raven display driver with CONFIG_KCOV_INSTRUMENT_ALL=y and CONFIG_KCOV_ENABLE_COMPARISONS=y results in warnings about many functions that do a comparison of floating-point variables:

drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `dcn_bw_calc_rq_dlg_ttu':
dcn_calcs.c:(.text+0x263): undefined reference to `__sanitizer_cov_trace_cmpf'
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `hack_force_pipe_split':
dcn_calcs.c:(.text+0x155b): undefined reference to `__sanitizer_cov_trace_cmpf'
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `dcn_find_dcfclk_suits_all':
dcn_calcs.c:(.text+0x190e): undefined reference to `__sanitizer_cov_trace_cmpf'
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `dcn_validate_bandwidth':
dcn_calcs.c:(.text+0xe121): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_mod':
dcn_calc_math.c:(.text+0x22): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_min2':
dcn_calc_math.c:(.text+0xb2): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_ceil2':
dcn_calc_math.c:(.text+0x2a0): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_max3':
dcn_calc_math.c:(.text+0x325): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_max5':
dcn_calc_math.c:(.text+0x3c3): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_log':
dcn_calc_math.c:(.text+0x54e): undefined reference to `__sanitizer_cov_trace_cmpd'
dcn_calc_math.c:(.text+0x57c): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function scaler_settings_calculation':
dcn_calc_auto.c:(.text+0x5c5): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0x137c): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0x9233): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0xb70f): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0x121fd): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function display_pipe_configuration':
dcn_calc_auto.c:(.text+0x15a2f): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x17c2d): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x19362): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x25575): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x27f33): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_calc.o: In function get_refcyc_per_delivery':
display_rq_dlg_calc.c:(.text+0xb5): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_calc.o: In function calculate_ttu_cursor.isra.1':
display_rq_dlg_calc.c:(.text+0x9f6): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_calc.o: In function dml_rq_dlg_get_dlg_params':
display_rq_dlg_calc.c:(.text+0x82cc): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function get_refcyc_per_delivery.isra.0':
dml1_display_rq_dlg_calc.c:(.text+0x6c4): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function get_vratio_pre.isra.2':
dml1_display_rq_dlg_calc.c:(.text+0x957): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function get_swath_need.isra.3':
dml1_display_rq_dlg_calc.c:(.text+0xc8e): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function dml1_extract_rq_regs':
dml1_display_rq_dlg_calc.c:(.text+0x30a8): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function dml1_rq_dlg_get_dlg_params':
dml1_display_rq_dlg_calc.c:(.text+0x41ee): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function dml1_rq_dlg_get_dlg_params':
dml1_display_rq_dlg_calc.c:(.text+0x8f95): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.o: In function dml_round':
dml_common_defs.c:(.text+0x77): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.o: In function adjust_ReturnBW':
display_mode_vba.c:(.text+0x4490): undefined reference to `__sanitizer_cov_trace_cmpd'

We already prevent the driver from being built on non-x86 architectures because of its use of floating-point arithmetic, this extends the dependency to also cover Kcov-enabled builds, which arguably is a much more severe limitation.

I tried implementing the two functions in KCOV: __sanitizer_cov_trace_cmpd and __sanitizer_cov_trace_cmpf, but that fails to build on architectures that do not support any floating-point functions, or would require making that code x86 specific as well. I also looked at what it would take to convert the code to fixed-point arithmetic, but quickly gave up. This is probably the right approach, but it requires a non-trivial amount of work and certainly won't be appropriate as a bugfix.

Fixes bf2e2e2e0ea9 ("drm/amd/display: Limit DCN to x86 arch")
---
 drivers/gpu/drm/amd/display/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/Kconfig +2 -0
index ec3285f65517..5cd5906c9bee 100644
@@ -30,6 +30,8 @@ config DRM_AMD_DC_FBC
 config DRM_AMD_DC_DCN1_0
 	bool "DCN 1.0 Raven family"
 	depends on DRM_AMD_DC && X86
+	# x86 floating point math here breaks with KCOV:
+	depends on !(KCOV_INSTRUMENT_ALL && KCOV_ENABLE_COMPARISONS) || BROKEN
 	help
 	  Choose this option if you want to have
 	  RV family for display engine
Signature · 6 lines
2.9.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer
#1 lore raw
Quoted 59 lines · Arnd Bergmann

Building the DCN 1.0 Raven display driver with CONFIG_KCOV_INSTRUMENT_ALL=y and CONFIG_KCOV_ENABLE_COMPARISONS=y results in warnings about many functions that do a comparison of floating-point variables:

drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `dcn_bw_calc_rq_dlg_ttu':
dcn_calcs.c:(.text+0x263): undefined reference to `__sanitizer_cov_trace_cmpf'
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `hack_force_pipe_split':
dcn_calcs.c:(.text+0x155b): undefined reference to `__sanitizer_cov_trace_cmpf'
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `dcn_find_dcfclk_suits_all':
dcn_calcs.c:(.text+0x190e): undefined reference to `__sanitizer_cov_trace_cmpf'
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `dcn_validate_bandwidth':
dcn_calcs.c:(.text+0xe121): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_mod':
dcn_calc_math.c:(.text+0x22): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_min2':
dcn_calc_math.c:(.text+0xb2): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_ceil2':
dcn_calc_math.c:(.text+0x2a0): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_max3':
dcn_calc_math.c:(.text+0x325): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_max5':
dcn_calc_math.c:(.text+0x3c3): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_log':
dcn_calc_math.c:(.text+0x54e): undefined reference to `__sanitizer_cov_trace_cmpd'
dcn_calc_math.c:(.text+0x57c): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function scaler_settings_calculation':
dcn_calc_auto.c:(.text+0x5c5): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0x137c): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0x9233): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0xb70f): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0x121fd): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function display_pipe_configuration':
dcn_calc_auto.c:(.text+0x15a2f): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x17c2d): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x19362): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x25575): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x27f33): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_calc.o: In function get_refcyc_per_delivery':
display_rq_dlg_calc.c:(.text+0xb5): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_calc.o: In function calculate_ttu_cursor.isra.1':
display_rq_dlg_calc.c:(.text+0x9f6): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_calc.o: In function dml_rq_dlg_get_dlg_params':
display_rq_dlg_calc.c:(.text+0x82cc): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function get_refcyc_per_delivery.isra.0':
dml1_display_rq_dlg_calc.c:(.text+0x6c4): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function get_vratio_pre.isra.2':
dml1_display_rq_dlg_calc.c:(.text+0x957): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function get_swath_need.isra.3':
dml1_display_rq_dlg_calc.c:(.text+0xc8e): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function dml1_extract_rq_regs':
dml1_display_rq_dlg_calc.c:(.text+0x30a8): undefined reference to `__sanitizer_cov_trace_cmpd'

Quoted 9 lines

drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function `dml1_rq_dlg_get_dlg_params':
dml1_display_rq_dlg_calc.c:(.text+0x41ee): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function dml1_rq_dlg_get_dlg_params':
dml1_display_rq_dlg_calc.c:(.text+0x8f95): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.o: In function dml_round':
dml_common_defs.c:(.text+0x77): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.o: In function adjust_ReturnBW':
display_mode_vba.c:(.text+0x4490): undefined reference to `__sanitizer_cov_trace_cmpd'

Is this with clang? I don't seem to get these with gcc.

Quoted 24 lines

We already prevent the driver from being built on non-x86 architectures because of its use of floating-point arithmetic, this extends the dependency to also cover Kcov-enabled builds, which arguably is a much more severe limitation.

I tried implementing the two functions in KCOV: __sanitizer_cov_trace_cmpd and __sanitizer_cov_trace_cmpf, but that fails to build on architectures that do not support any floating-point functions, or would require making that code x86 specific as well. I also looked at what it would take to convert the code to fixed-point arithmetic, but quickly gave up. This is probably the right approach, but it requires a non-trivial amount of work and certainly won't be appropriate as a bugfix.

Fixes bf2e2e2e0ea9 ("drm/amd/display: Limit DCN to x86 arch")
---
 drivers/gpu/drm/amd/display/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/amd/display/Kconfig +0 -0
index ec3285f65517..5cd5906c9bee 100644

drivers/gpu/drm/amd/display/Kconfig config DRM_AMD_DC_FBC · line 34

Quoted 5 lines
drivers/gpu/drm/amd/display/Kconfig +2 -0
@@ -30,6 +30,8 @@ config DRM_AMD_DC_FBC
 config DRM_AMD_DC_DCN1_0
 	bool "DCN 1.0 Raven family"
 	depends on DRM_AMD_DC && X86
+	# x86 floating point math here breaks with KCOV:
+	depends on !(KCOV_INSTRUMENT_ALL && KCOV_ENABLE_COMPARISONS) || BROKEN

I don't think it makes sense to make this depend on BROKEN as it works and is quite useful to people with Raven systems.

Harry

drivers/gpu/drm/amd/display/Kconfig config DRM_AMD_DC_FBC · line 37

Quoted 4 lines
drivers/gpu/drm/amd/display/Kconfig +0 -0
 	help
 	  Choose this option if you want to have
 	  RV family for display engine

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#2 lore raw
Quoted 70 lines · Harry Wentland
Quoted 59 lines · Arnd Bergmann

Building the DCN 1.0 Raven display driver with CONFIG_KCOV_INSTRUMENT_ALL=y and CONFIG_KCOV_ENABLE_COMPARISONS=y results in warnings about many functions that do a comparison of floating-point variables:

drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `dcn_bw_calc_rq_dlg_ttu':
dcn_calcs.c:(.text+0x263): undefined reference to `__sanitizer_cov_trace_cmpf'
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `hack_force_pipe_split':
dcn_calcs.c:(.text+0x155b): undefined reference to `__sanitizer_cov_trace_cmpf'
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `dcn_find_dcfclk_suits_all':
dcn_calcs.c:(.text+0x190e): undefined reference to `__sanitizer_cov_trace_cmpf'
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `dcn_validate_bandwidth':
dcn_calcs.c:(.text+0xe121): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_mod':
dcn_calc_math.c:(.text+0x22): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_min2':
dcn_calc_math.c:(.text+0xb2): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_ceil2':
dcn_calc_math.c:(.text+0x2a0): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_max3':
dcn_calc_math.c:(.text+0x325): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_max5':
dcn_calc_math.c:(.text+0x3c3): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_log':
dcn_calc_math.c:(.text+0x54e): undefined reference to `__sanitizer_cov_trace_cmpd'
dcn_calc_math.c:(.text+0x57c): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function scaler_settings_calculation':
dcn_calc_auto.c:(.text+0x5c5): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0x137c): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0x9233): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0xb70f): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0x121fd): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function display_pipe_configuration':
dcn_calc_auto.c:(.text+0x15a2f): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x17c2d): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x19362): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x25575): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x27f33): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_calc.o: In function get_refcyc_per_delivery':
display_rq_dlg_calc.c:(.text+0xb5): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_calc.o: In function calculate_ttu_cursor.isra.1':
display_rq_dlg_calc.c:(.text+0x9f6): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_calc.o: In function dml_rq_dlg_get_dlg_params':
display_rq_dlg_calc.c:(.text+0x82cc): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function get_refcyc_per_delivery.isra.0':
dml1_display_rq_dlg_calc.c:(.text+0x6c4): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function get_vratio_pre.isra.2':
dml1_display_rq_dlg_calc.c:(.text+0x957): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function get_swath_need.isra.3':
dml1_display_rq_dlg_calc.c:(.text+0xc8e): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function dml1_extract_rq_regs':
dml1_display_rq_dlg_calc.c:(.text+0x30a8): undefined reference to `__sanitizer_cov_trace_cmpd'

Quoted 9 lines

drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function `dml1_rq_dlg_get_dlg_params':
dml1_display_rq_dlg_calc.c:(.text+0x41ee): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function dml1_rq_dlg_get_dlg_params':
dml1_display_rq_dlg_calc.c:(.text+0x8f95): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.o: In function dml_round':
dml_common_defs.c:(.text+0x77): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.o: In function adjust_ReturnBW':
display_mode_vba.c:(.text+0x4490): undefined reference to `__sanitizer_cov_trace_cmpd'

Quoted 1 line

Is this with clang? I don't seem to get these with gcc.

This was with gcc-8. I just tried other versions and found that gcc-7 and earlier
(i.e. all released versions) don't support CONFIG_KCOV_ENABLE_COMPARISONS and won't be affected by this.

I've also tried building it with clang-5, but that rejects the -mpreferred-stack-boundary=4
argument and (once I fixed that) did not have the issue either. Presumably, clang-6
will do the same thing as gcc-8, but I haven't built a clang-6 snapshot yet.

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/display/Kconfig +0 -0
index ec3285f65517..5cd5906c9bee 100644
@@ -30,6 +30,8 @@ config DRM_AMD_DC_FBC
Quoted 8 lines

drivers/gpu/drm/amd/display/Kconfig config DRM_AMD_DC_FBC · line 34

Quoted 5 lines
drivers/gpu/drm/amd/display/Kconfig +2 -0
 config DRM_AMD_DC_DCN1_0
      bool "DCN 1.0 Raven family"
      depends on DRM_AMD_DC && X86
+     # x86 floating point math here breaks with KCOV:
+     depends on !(KCOV_INSTRUMENT_ALL && KCOV_ENABLE_COMPARISONS) || BROKEN

I don't think it makes sense to make this depend on BROKEN as it works and is quite useful to people with Raven systems.

Well, it's clearly broken when using with CONFIG_KCOV_ENABLE_COMPARISONS. Fortunately that option doesn't do anything unless used with gcc-8, which won't be released until next spring, so that leaves some time to change the code into fixed-point arithmetic or find a different workaround.

Arnd
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#3 lore raw
Quoted 98 lines · Arnd Bergmann
Quoted 70 lines · Harry Wentland
Quoted 59 lines · Arnd Bergmann

Building the DCN 1.0 Raven display driver with CONFIG_KCOV_INSTRUMENT_ALL=y and CONFIG_KCOV_ENABLE_COMPARISONS=y results in warnings about many functions that do a comparison of floating-point variables:

drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `dcn_bw_calc_rq_dlg_ttu':
dcn_calcs.c:(.text+0x263): undefined reference to `__sanitizer_cov_trace_cmpf'
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `hack_force_pipe_split':
dcn_calcs.c:(.text+0x155b): undefined reference to `__sanitizer_cov_trace_cmpf'
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `dcn_find_dcfclk_suits_all':
dcn_calcs.c:(.text+0x190e): undefined reference to `__sanitizer_cov_trace_cmpf'
drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.o: In function `dcn_validate_bandwidth':
dcn_calcs.c:(.text+0xe121): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_mod':
dcn_calc_math.c:(.text+0x22): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_min2':
dcn_calc_math.c:(.text+0xb2): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_ceil2':
dcn_calc_math.c:(.text+0x2a0): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_max3':
dcn_calc_math.c:(.text+0x325): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_max5':
dcn_calc_math.c:(.text+0x3c3): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_math.o: In function dcn_bw_log':
dcn_calc_math.c:(.text+0x54e): undefined reference to `__sanitizer_cov_trace_cmpd'
dcn_calc_math.c:(.text+0x57c): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function scaler_settings_calculation':
dcn_calc_auto.c:(.text+0x5c5): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0x137c): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0x9233): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0xb70f): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function mode_support_and_system_configuration':
dcn_calc_auto.c:(.text+0x121fd): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function display_pipe_configuration':
dcn_calc_auto.c:(.text+0x15a2f): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x17c2d): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x19362): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x25575): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/calcs/dcn_calc_auto.o: In function dispclkdppclkdcfclk_deep_sleep_prefetch_parameters_watermarks_and_performance_calculation':
dcn_calc_auto.c:(.text+0x27f33): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_calc.o: In function get_refcyc_per_delivery':
display_rq_dlg_calc.c:(.text+0xb5): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_calc.o: In function calculate_ttu_cursor.isra.1':
display_rq_dlg_calc.c:(.text+0x9f6): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_rq_dlg_calc.o: In function dml_rq_dlg_get_dlg_params':
display_rq_dlg_calc.c:(.text+0x82cc): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function get_refcyc_per_delivery.isra.0':
dml1_display_rq_dlg_calc.c:(.text+0x6c4): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function get_vratio_pre.isra.2':
dml1_display_rq_dlg_calc.c:(.text+0x957): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function get_swath_need.isra.3':
dml1_display_rq_dlg_calc.c:(.text+0xc8e): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function dml1_extract_rq_regs':
dml1_display_rq_dlg_calc.c:(.text+0x30a8): undefined reference to `__sanitizer_cov_trace_cmpd'

Quoted 9 lines

drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function `dml1_rq_dlg_get_dlg_params':
dml1_display_rq_dlg_calc.c:(.text+0x41ee): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/dml1_display_rq_dlg_calc.o: In function dml1_rq_dlg_get_dlg_params':
dml1_display_rq_dlg_calc.c:(.text+0x8f95): undefined reference to __sanitizer_cov_trace_cmpf' drivers/gpu/drm/amd/display/dc/dml/dml_common_defs.o: In function dml_round':
dml_common_defs.c:(.text+0x77): undefined reference to __sanitizer_cov_trace_cmpd' drivers/gpu/drm/amd/display/dc/dml/display_mode_vba.o: In function adjust_ReturnBW':
display_mode_vba.c:(.text+0x4490): undefined reference to `__sanitizer_cov_trace_cmpd'

Quoted 1 line

Is this with clang? I don't seem to get these with gcc.

This was with gcc-8. I just tried other versions and found that gcc-7 and earlier
(i.e. all released versions) don't support CONFIG_KCOV_ENABLE_COMPARISONS and won't be affected by this.

I've also tried building it with clang-5, but that rejects the -mpreferred-stack-boundary=4
argument and (once I fixed that) did not have the issue either. Presumably, clang-6
will do the same thing as gcc-8, but I haven't built a clang-6 snapshot yet.

Quoted 5 lines
Quoted 5 lines
drivers/gpu/drm/amd/display/Kconfig +0 -0
index ec3285f65517..5cd5906c9bee 100644
@@ -30,6 +30,8 @@ config DRM_AMD_DC_FBC
Quoted 8 lines

drivers/gpu/drm/amd/display/Kconfig config DRM_AMD_DC_FBC · line 34

Quoted 5 lines
drivers/gpu/drm/amd/display/Kconfig +2 -0
 config DRM_AMD_DC_DCN1_0
      bool "DCN 1.0 Raven family"
      depends on DRM_AMD_DC && X86
+     # x86 floating point math here breaks with KCOV:
+     depends on !(KCOV_INSTRUMENT_ALL && KCOV_ENABLE_COMPARISONS) || BROKEN

I don't think it makes sense to make this depend on BROKEN as it works and is quite useful to people with Raven systems.

Quoted 5 lines

Well, it's clearly broken when using with CONFIG_KCOV_ENABLE_COMPARISONS. Fortunately that option doesn't do anything unless used with gcc-8, which won't be released until next spring, so that leaves some time to change the code into fixed-point arithmetic or find a different workaround.

Thanks, Arnd. This is what I was missing. I'll take another look.

It would still work without KCOV, although I agree that's not ideal by any means.

Harry

Quoted 2 lines

Arnd

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx