<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<p style="font-family:Calibri;font-size:10pt;color:#0000FF;margin:5pt;font-style:normal;font-weight:normal;text-decoration:none;" align="Left">
[AMD Official Use Only - AMD Internal Distribution Only]<br>
</p>
<br>
<div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Alex,</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I'll a hunk for fixing DCN401 as well to this and resend it later today.<br>
<br>
</div>
<div class="elementToProof" style="font-family: Aptos, Aptos_EmbeddedFont, Aptos_MSFontService, Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div id="Signature" style="color: inherit;">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
--</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Jay<br>
</div>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Zhang, George <George.Zhang@amd.com><br>
<b>Sent:</b> Tuesday, June 4, 2024 12:49 PM<br>
<b>To:</b> Deucher, Alexander <Alexander.Deucher@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org><br>
<b>Cc:</b> Mahfooz, Hamza <Hamza.Mahfooz@amd.com>; Arnd Bergmann <arnd@arndb.de>; Wentland, Harry <Harry.Wentland@amd.com>; Li, Sun peng (Leo) <Sunpeng.Li@amd.com>; Siqueira, Rodrigo <Rodrigo.Siqueira@amd.com><br>
<b>Subject:</b> RE: [PATCH] drm/amd/display: use pre-allocated temp structure for bounding box</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">[AMD Official Use Only - AMD Internal Distribution Only]<br>
<br>
[AMD Official Use Only - AMD Internal Distribution Only]<br>
<br>
Tested-by: George Zhang <George.zhang@amd.com><br>
<br>
Thanks,<br>
George<br>
-----Original Message-----<br>
From: Deucher, Alexander <Alexander.Deucher@amd.com><br>
Sent: Tuesday, June 4, 2024 11:50 AM<br>
To: amd-gfx@lists.freedesktop.org<br>
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Mahfooz, Hamza <Hamza.Mahfooz@amd.com>; Zhang, George <George.Zhang@amd.com>; Arnd Bergmann <arnd@arndb.de>; Wentland, Harry <Harry.Wentland@amd.com>; Li, Sun peng (Leo) <Sunpeng.Li@amd.com>; Siqueira, Rodrigo
<Rodrigo.Siqueira@amd.com><br>
Subject: [PATCH] drm/amd/display: use pre-allocated temp structure for bounding box<br>
<br>
This mirrors what the driver does for older DCN generations.<br>
<br>
Should fix:<br>
<br>
BUG: sleeping function called from invalid context at include/linux/sched/mm.h:306<br>
in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 449, name: kworker/u64:8<br>
preempt_count: 2, expected: 0<br>
RCU nest depth: 0, expected: 0<br>
Preemption disabled at:<br>
ffffffffc0ce1580>] dc_fpu_begin+0x30/0xd0 [amdgpu]<br>
CPU: 5 PID: 449 Comm: kworker/u64:8 Tainted: G W 6.8.0+ #35<br>
Hardware name: System manufacturer System Product Name/ROG STRIX X570-E GAMING WIFI II, BIOS 4204 02/24/2022<br>
Workqueue: events_unbound async_run_entry_fn<br>
<br>
Fixes: 88c61827cedc ("drm/amd/display: dynamically allocate dml2_configuration_options structures")<br>
Suggested-by: Hamza Mahfooz <hamza.mahfooz@amd.com><br>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com><br>
Cc: George Zhang <george.zhang@amd.com><br>
Cc: Arnd Bergmann <arnd@arndb.de><br>
Cc: harry.wentland@amd.com<br>
Cc: sunpeng.li@amd.com<br>
Cc: Rodrigo.Siqueira@amd.com<br>
---<br>
drivers/gpu/drm/amd/display/dc/dc.h | 1 +<br>
.../drm/amd/display/dc/resource/dcn32/dcn32_resource.c | 8 +++-----<br>
.../drm/amd/display/dc/resource/dcn321/dcn321_resource.c | 8 +++-----<br>
3 files changed, 7 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h<br>
index d0ed01ac460d..d843933ad731 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/dc.h<br>
+++ b/drivers/gpu/drm/amd/display/dc/dc.h<br>
@@ -1444,6 +1444,7 @@ struct dc {<br>
} scratch;<br>
<br>
struct dml2_configuration_options dml2_options;<br>
+ struct dml2_configuration_options dml2_tmp;<br>
enum dc_acpi_cm_power_state power_state;<br>
<br>
};<br>
diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c<br>
index 0f11d7c8791c..7a8aa9396dea 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c<br>
+++ b/drivers/gpu/drm/amd/display/dc/resource/dcn32/dcn32_resource.c<br>
@@ -2007,11 +2007,9 @@ void dcn32_calculate_wm_and_dlg(struct dc *dc, struct dc_state *context,<br>
<br>
static void dcn32_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params)<br>
{<br>
- struct dml2_configuration_options *dml2_opt;<br>
+ struct dml2_configuration_options *dml2_opt = &dc->dml2_tmp;<br>
<br>
- dml2_opt = kmemdup(&dc->dml2_options, sizeof(dc->dml2_options), GFP_KERNEL);<br>
- if (!dml2_opt)<br>
- return;<br>
+ memcpy(dml2_opt, &dc->dml2_options, sizeof(dc->dml2_options));<br>
<br>
DC_FP_START();<br>
<br>
@@ -2027,7 +2025,7 @@ static void dcn32_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw<br>
<br>
DC_FP_END();<br>
<br>
- kfree(dml2_opt);<br>
+ memcpy(&dc->dml2_options, dml2_opt, sizeof(dc->dml2_options));<br>
}<br>
<br>
static struct resource_funcs dcn32_res_pool_funcs = {<br>
diff --git a/drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c b/drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c<br>
index 07ca6f58447d..ef30e8632607 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c<br>
+++ b/drivers/gpu/drm/amd/display/dc/resource/dcn321/dcn321_resource.c<br>
@@ -1581,11 +1581,9 @@ static struct dc_cap_funcs cap_funcs = {<br>
<br>
static void dcn321_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *bw_params)<br>
{<br>
- struct dml2_configuration_options *dml2_opt;<br>
+ struct dml2_configuration_options *dml2_opt = &dc->dml2_tmp;<br>
<br>
- dml2_opt = kmemdup(&dc->dml2_options, sizeof(dc->dml2_options), GFP_KERNEL);<br>
- if (!dml2_opt)<br>
- return;<br>
+ memcpy(dml2_opt, &dc->dml2_options, sizeof(dc->dml2_options));<br>
<br>
DC_FP_START();<br>
<br>
@@ -1601,7 +1599,7 @@ static void dcn321_update_bw_bounding_box(struct dc *dc, struct clk_bw_params *b<br>
<br>
DC_FP_END();<br>
<br>
- kfree(dml2_opt);<br>
+ memcpy(&dc->dml2_options, dml2_opt, sizeof(dc->dml2_options));<br>
}<br>
<br>
static struct resource_funcs dcn321_res_pool_funcs = {<br>
--<br>
2.45.1<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>