[PATCH] drm/amd/display: Disable migration to ensure consistency of per-CPU variable

Yin, Tianci (Rico) Tianci.Yin at amd.com
Mon Feb 6 08:08:17 UTC 2023


[AMD Official Use Only - General]

Loop  Charlie.

Thanks,
Rico

Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows

From: Tianci Yin<mailto:tianci.yin at amd.com>
Sent: Monday, February 6, 2023 3:59 PM
To: amd-gfx at lists.freedesktop.org<mailto:amd-gfx at lists.freedesktop.org>
Cc: Wentland, Harry<mailto:Harry.Wentland at amd.com>; Siqueira, Rodrigo<mailto:Rodrigo.Siqueira at amd.com>; Pillai, Aurabindo<mailto:Aurabindo.Pillai at amd.com>; Yin, Tianci (Rico)<mailto:Tianci.Yin at amd.com>
Subject: [PATCH] drm/amd/display: Disable migration to ensure consistency of per-CPU variable

From: tiancyin <tianci.yin at amd.com>

[why]
Since the variable fpu_recursion_depth is per-CPU type, it has one copy
on each CPU, thread migration causes data consistency issue, then the
call trace shows up. And preemption disabling can't prevent migration.

[how]
Disable migration to ensure consistency of fpu_recursion_depth.

Signed-off-by: tiancyin <tianci.yin at amd.com>
---
 amdgpu_dm/dc_fpu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/amdgpu_dm/dc_fpu.c b/amdgpu_dm/dc_fpu.c
index 1743ca0a36..c42aa947c9 100644
--- a/amdgpu_dm/dc_fpu.c
+++ b/amdgpu_dm/dc_fpu.c
@@ -89,6 +89,7 @@ void dc_fpu_begin(const char *function_name, const int line)

         if (*pcpu == 1) {
 #if defined(CONFIG_X86)
+               migrate_disable();
                 kernel_fpu_begin();
 #elif defined(CONFIG_PPC64)
                 if (cpu_has_feature(CPU_FTR_VSX_COMP)) {
@@ -129,6 +130,7 @@ void dc_fpu_end(const char *function_name, const int line)
         if (*pcpu <= 0) {
 #if defined(CONFIG_X86)
                 kernel_fpu_end();
+               migrate_enable();
 #elif defined(CONFIG_PPC64)
                 if (cpu_has_feature(CPU_FTR_VSX_COMP)) {
                         disable_kernel_vsx();
--
2.34.1

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20230206/626e3f07/attachment.htm>


More information about the amd-gfx mailing list