Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/display: Move dml2_destroy to non-FPU compilation unit

On PREEMPT_RT kernels, vfree() can sleep because spin_lock is
converted to rt_mutex. dml2_destroy() calls vfree() while inside
an FPU-guarded region (preempt_count=2), which is illegal.

dml2_wrapper_fpu.c is compiled with CC_FLAGS_FPU which defines
_LINUX_FPU_COMPILATION_UNIT, making DC_RUN_WITH_PREEMPTION_ENABLED()
resolve to a no-op. This prevents the macro from cycling FPU
context off/on around vfree().

Move dml2_destroy() to dml2_wrapper.c (non-FPU compilation unit)
where DC_RUN_WITH_PREEMPTION_ENABLED() properly cycles DC_FP_END/
DC_FP_START around vfree(). This pairs it with dml2_allocate_memory()
which already lives there.

Reviewed-by: Dillon Varone <dillon.varone@amd.com>
Signed-off-by: Rafal Ostrowski <rafal.ostrowski@amd.com>
Signed-off-by: Chenyu Chen <chen-yu.chen@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Rafal Ostrowski and committed by
Alex Deucher
8bf0cb97 07598c76

+13 -12
+2 -2
drivers/gpu/drm/amd/display/dc/dml2_0/dml21/dml21_wrapper.c
··· 58 58 59 59 void dml21_destroy(struct dml2_context *dml2) 60 60 { 61 - vfree(dml2->v21.dml_init.dml2_instance); 62 - vfree(dml2->v21.mode_programming.programming); 61 + DC_RUN_WITH_PREEMPTION_ENABLED(vfree(dml2->v21.dml_init.dml2_instance)); 62 + DC_RUN_WITH_PREEMPTION_ENABLED(vfree(dml2->v21.mode_programming.programming)); 63 63 } 64 64 65 65 void dml21_copy(struct dml2_context *dst_dml_ctx,
+11
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper.c
··· 108 108 return true; 109 109 } 110 110 111 + void dml2_destroy(struct dml2_context *dml2) 112 + { 113 + if (!dml2) 114 + return; 115 + 116 + if (dml2->architecture == dml2_architecture_21) 117 + dml21_destroy(dml2); 118 + 119 + DC_RUN_WITH_PREEMPTION_ENABLED(vfree(dml2)); 120 + } 121 + 111 122 void dml2_reinit(const struct dc *in_dc, 112 123 const struct dml2_configuration_options *config, 113 124 struct dml2_context **dml2)
-10
drivers/gpu/drm/amd/display/dc/dml2_0/dml2_wrapper_fpu.c
··· 548 548 } 549 549 } 550 550 551 - void dml2_destroy(struct dml2_context *dml2) 552 - { 553 - if (!dml2) 554 - return; 555 - 556 - if (dml2->architecture == dml2_architecture_21) 557 - dml21_destroy(dml2); 558 - vfree(dml2); 559 - } 560 - 561 551 void dml2_extract_dram_and_fclk_change_support(struct dml2_context *dml2, 562 552 unsigned int *fclk_change_support, unsigned int *dram_clk_change_support) 563 553 {