<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">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</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 Harry Wentland <harry.wentland@amd.com><br>
<b>Sent:</b> Friday, February 22, 2019 10:39 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> robdclark@gmail.com; Wentland, Harry; stable@vger.kernel.org<br>
<b>Subject:</b> [PATCH] drm/amd/display: don't call dm_pp_ function from an fpu block</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">Powerplay functions called from dm_pp_* functions tend to do a<br>
mutex_lock which isn't safe to do inside a kernel_fpu_begin/end block as<br>
those will disable/enable preemption.<br>
<br>
Rearrange the dm_pp_get_clock_levels_by_type_with_voltage calls to make<br>
sure they happen outside of kernel_fpu_begin/end.<br>
<br>
Cc: stable@vger.kernel.org<br>
Signed-off-by: Harry Wentland <harry.wentland@amd.com><br>
---<br>
 drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c | 8 ++++++--<br>
 1 file changed, 6 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c b/drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c<br>
index 2a807b9f77f7..5955634f6e27 100644<br>
--- a/drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c<br>
+++ b/drivers/gpu/drm/amd/display/dc/calcs/dcn_calcs.c<br>
@@ -1348,12 +1348,12 @@ void dcn_bw_update_from_pplib(struct dc *dc)<br>
         struct dm_pp_clock_levels_with_voltage fclks = {0}, dcfclks = {0};<br>
         bool res;<br>
 <br>
-       kernel_fpu_begin();<br>
-<br>
         /* TODO: This is not the proper way to obtain fabric_and_dram_bandwidth, should be min(fclk, memclk) */<br>
         res = dm_pp_get_clock_levels_by_type_with_voltage(<br>
                         ctx, DM_PP_CLOCK_TYPE_FCLK, &fclks);<br>
 <br>
+       kernel_fpu_begin();<br>
+<br>
         if (res)<br>
                 res = verify_clock_values(&fclks);<br>
 <br>
@@ -1372,9 +1372,13 @@ void dcn_bw_update_from_pplib(struct dc *dc)<br>
         } else<br>
                 BREAK_TO_DEBUGGER();<br>
 <br>
+       kernel_fpu_end();<br>
+<br>
         res = dm_pp_get_clock_levels_by_type_with_voltage(<br>
                         ctx, DM_PP_CLOCK_TYPE_DCFCLK, &dcfclks);<br>
 <br>
+       kernel_fpu_begin();<br>
+<br>
         if (res)<br>
                 res = verify_clock_values(&dcfclks);<br>
 <br>
-- <br>
2.19.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a></div>
</span></font></div>
</body>
</html>