Revert "drm/amd/display: dynamically allocate dml2_configuration_options structures"
Subsystems (3)
PATCH 1/1 Revert "drm/amd/display: dynamically allocate dml2_configuration_options structures"
This reverts commit 416b5c5eec9e708b31c68f00cb79130f2cfaf7ed.
This patch caused a regression on DCN 3.2 on the IGT test assr-links-suspend, with the dmesg warning:
BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 449, name: kworker/u64:8preempt_count: 2, expected: 0
RCU nest depth: 0, expected: 0
Preemption disabled at:ffffffffc0ce1580>] dc_fpu_begin+0x30/0xd0 [amdgpu]
CPU: 5 PID: 449 Comm: kworker/u64:8 Tainted: G W 6.8.0+ #35 Hardware name: System manufacturer System Product Name/ROG STRIX X570-E GAMING WIFI II, BIOS 4204 02/24/2022 Workqueue: events_unbound async_run_entry_fn
Reverting this patch will re-introduce stack size warnings.
--- .../display/dc/resource/dcn32/dcn32_resource.c | 16 +++++----------- .../display/dc/resource/dcn321/dcn321_resource.c | 16 +++++----------- 2 files changed, 10 insertions(+), 22 deletions(-)
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c +5 -11
@@ -2007,27 +2007,21 @@ void dcn32_calculate_wm_and_dlg(struct dc *dc, struct dc_state *context,static void dcn32_update_bw_bounding_box (struct dc *dc,struct clk_bw_params *bw_params) { -struct dml2_configuration_options *dml2_opt; - - dml2_opt =kmemdup (&dc->dml2_options,sizeof (dc->dml2_options),GFP_KERNEL ); -if (!dml2_opt) -return ; +struct dml2_configuration_options dml2_opt = dc->dml2_options;DC_FP_START ();dcn32_update_bw_bounding_box_fpu (dc, bw_params); - dml2_opt->use_clock_dc_limits = false; + dml2_opt.use_clock_dc_limits = false;if (dc->debug.using_dml2 && dc->current_state && dc->current_state->bw_ctx.dml2) -dml2_reinit (dc, dml2_opt, &dc->current_state->bw_ctx.dml2); +dml2_reinit (dc, &dml2_opt, &dc->current_state->bw_ctx.dml2); - dml2_opt->use_clock_dc_limits = true; + dml2_opt.use_clock_dc_limits = true;if (dc->debug.using_dml2 && dc->current_state && dc->current_state->bw_ctx.dml2_dc_power_source) -dml2_reinit (dc, dml2_opt, &dc->current_state->bw_ctx.dml2_dc_power_source); +dml2_reinit (dc, &dml2_opt, &dc->current_state->bw_ctx.dml2_dc_power_source);DC_FP_END (); - -kfree (dml2_opt); }static struct resource_funcs dcn32_res_pool_funcs = {
drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c +5 -11
@@ -1581,27 +1581,21 @@ static struct dc_cap_funcs cap_funcs = {static void dcn321_update_bw_bounding_box (struct dc *dc,struct clk_bw_params *bw_params) { -struct dml2_configuration_options *dml2_opt; - - dml2_opt =kmemdup (&dc->dml2_options,sizeof (dc->dml2_options),GFP_KERNEL ); -if (!dml2_opt) -return ; +struct dml2_configuration_options dml2_opt = dc->dml2_options;DC_FP_START ();dcn321_update_bw_bounding_box_fpu (dc, bw_params); - dml2_opt->use_clock_dc_limits = false; + dml2_opt.use_clock_dc_limits = false;if (dc->debug.using_dml2 && dc->current_state && dc->current_state->bw_ctx.dml2) -dml2_reinit (dc, dml2_opt, &dc->current_state->bw_ctx.dml2); +dml2_reinit (dc, &dml2_opt, &dc->current_state->bw_ctx.dml2); - dml2_opt->use_clock_dc_limits = true; + dml2_opt.use_clock_dc_limits = true;if (dc->debug.using_dml2 && dc->current_state && dc->current_state->bw_ctx.dml2_dc_power_source) -dml2_reinit (dc, dml2_opt, &dc->current_state->bw_ctx.dml2_dc_power_source); +dml2_reinit (dc, &dml2_opt, &dc->current_state->bw_ctx.dml2_dc_power_source);DC_FP_END (); - -kfree (dml2_opt); }static struct resource_funcs dcn321_res_pool_funcs = {
Signature · 1 line
2.34.1
Quoted 19 lines · George Zhang
This reverts commit
416b5c5eec9e708b31c68f00cb79130f2cfaf7ed.This patch caused a regression on DCN 3.2 on the IGT test assr-links-suspend, with
the dmesg warning:BUG: sleeping function called from invalid context at
include/linux/sched/mm.h:306in_atomic(): 1,irqs_disabled(): 0,non_block: 0, pid: 449, name:
kworker/u64:8static void dcn32_update_bw_bounding_box(struct dc *dc, struct
clk_bw_params*bw_params)
{drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c +0
-3-struct dml2_configuration_options *dml2_opt; - - dml2_opt = kmemdup(&dc->dml2_options, sizeof(dc->dml2_options),
GFP_KERNEL);
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c void dcn32_calculate_wm_and_dlg(struct dc *dc, struct dc_state *context, · line 2012
Quoted 5 lines
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c +1
-2-if (!dml2_opt) -return ; +struct dml2_configuration_options dml2_opt = dc->dml2_options;DC_FP_START ();
This means we also enable floating-point mode inside of an atomic section. Is that safe?
Arnd
Quoted 30 lines · George Zhang
This reverts commit
416b5c5eec9e708b31c68f00cb79130f2cfaf7ed.This patch caused a regression on DCN 3.2 on the IGT test assr-links-suspend, with the dmesg warning:
BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306
in_atomic(): 1,irqs_disabled(): 0,non_block: 0, pid: 449, name: kworker/u64:8preempt_count: 2, expected: 0
RCU nest depth: 0, expected: 0
Preemption disabled at:ffffffffc0ce1580>]dc_fpu_begin+0x30/0xd0[amdgpu]CPU: 5 PID: 449 Comm: kworker/u64:8 Tainted: G W 6.8.0+ #35 Hardware name: System manufacturer System Product Name/ROG STRIX X570-E GAMING WIFI II, BIOS 4204 02/24/2022 Workqueue: events_unbound async_run_entry_fnReverting this patch will re-introduce stack size warnings.
Cc Alex Deucher <[email protected]>Signed-off-by George Zhang <[email protected]>--- .../display/dc/resource/dcn32/dcn32_resource.c | 16 +++++----------- .../display/dc/resource/dcn321/dcn321_resource.c | 16 +++++----------- 2 files changed, 10 insertions(+), 22 deletions(-)drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c +0
-0
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c void dcn32_calculate_wm_and_dlg(struct dc *dc, struct dc_state *context, · line 2012
Quoted 6 lines
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c +0
-3@@ -2007,27 +2007,21 @@ void dcn32_calculate_wm_and_dlg(struct dc *dc, struct dc_state *context,static void dcn32_update_bw_bounding_box (struct dc *dc,struct clk_bw_params *bw_params) { -struct dml2_configuration_options *dml2_opt; - - dml2_opt =kmemdup (&dc->dml2_options,sizeof (dc->dml2_options),GFP_KERNEL );
Instead of reverting, you could change this from GFP_KERNEL to GFP_ATOMIC. This aligns with similar allocations in the other resource files. Same comment on the allocation below.
That said, to Arnd's point, I'm not sure about FP in atomic contexts.
Alex
Quoted 66 lines
drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c +5
-8-if (!dml2_opt) -return ; +struct dml2_configuration_options dml2_opt = dc->dml2_options;DC_FP_START ();dcn32_update_bw_bounding_box_fpu (dc, bw_params); - dml2_opt->use_clock_dc_limits = false; + dml2_opt.use_clock_dc_limits = false;if (dc->debug.using_dml2 && dc->current_state && dc->current_state->bw_ctx.dml2) -dml2_reinit (dc, dml2_opt, &dc->current_state->bw_ctx.dml2); +dml2_reinit (dc, &dml2_opt, &dc->current_state->bw_ctx.dml2); - dml2_opt->use_clock_dc_limits = true; + dml2_opt.use_clock_dc_limits = true;if (dc->debug.using_dml2 && dc->current_state && dc->current_state->bw_ctx.dml2_dc_power_source) -dml2_reinit (dc, dml2_opt, &dc->current_state->bw_ctx.dml2_dc_power_source); +dml2_reinit (dc, &dml2_opt, &dc->current_state->bw_ctx.dml2_dc_power_source);DC_FP_END (); - -kfree (dml2_opt); }static struct resource_funcs dcn32_res_pool_funcs = {drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c +5
-12@@ -1581,27 +1581,21 @@ static struct dc_cap_funcs cap_funcs = {static void dcn321_update_bw_bounding_box (struct dc *dc,struct clk_bw_params *bw_params) { -struct dml2_configuration_options *dml2_opt; - - dml2_opt =kmemdup (&dc->dml2_options,sizeof (dc->dml2_options),GFP_KERNEL ); -if (!dml2_opt) -return ; +struct dml2_configuration_options dml2_opt = dc->dml2_options;DC_FP_START ();dcn321_update_bw_bounding_box_fpu (dc, bw_params); - dml2_opt->use_clock_dc_limits = false; + dml2_opt.use_clock_dc_limits = false;if (dc->debug.using_dml2 && dc->current_state && dc->current_state->bw_ctx.dml2) -dml2_reinit (dc, dml2_opt, &dc->current_state->bw_ctx.dml2); +dml2_reinit (dc, &dml2_opt, &dc->current_state->bw_ctx.dml2); - dml2_opt->use_clock_dc_limits = true; + dml2_opt.use_clock_dc_limits = true;if (dc->debug.using_dml2 && dc->current_state && dc->current_state->bw_ctx.dml2_dc_power_source) -dml2_reinit (dc, dml2_opt, &dc->current_state->bw_ctx.dml2_dc_power_source); +dml2_reinit (dc, &dml2_opt, &dc->current_state->bw_ctx.dml2_dc_power_source);DC_FP_END (); - -kfree (dml2_opt); }static struct resource_funcs dcn321_res_pool_funcs = { --2.34.1