* FAILED: patch "[PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12" failed to apply to 6.13-stable tree
@ 2025-02-18 11:26 gregkh
2025-02-21 18:09 ` [PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler Lancelot SIX
0 siblings, 1 reply; 7+ messages in thread
From: gregkh @ 2025-02-18 11:26 UTC (permalink / raw)
To: lancelot.six, alexander.deucher, jay.cornwall; +Cc: stable
The patch below does not apply to the 6.13-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.13.y
git checkout FETCH_HEAD
git cherry-pick -x d584198a6fe4c51f4aa88ad72f258f8961a0f11c
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025021802-scrimmage-oppressor-8e61@gregkh' --subject-prefix 'PATCH 6.13.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From d584198a6fe4c51f4aa88ad72f258f8961a0f11c Mon Sep 17 00:00:00 2001
From: Lancelot SIX <lancelot.six@amd.com>
Date: Tue, 28 Jan 2025 19:16:49 +0000
Subject: [PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12
trap handler
It is possible for some waves in a workgroup to finish their save
sequence before the group leader has had time to capture the workgroup
barrier state. When this happens, having those waves exit do impact the
barrier state. As a consequence, the state captured by the group leader
is invalid, and is eventually incorrectly restored.
This patch proposes to have all waves in a workgroup wait for each other
at the end of their save sequence (just before calling s_endpgm_saved).
Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
Reviewed-by: Jay Cornwall <jay.cornwall@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org # 6.12.x
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
index 984f0e705078..651660958e5b 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
@@ -4121,7 +4121,8 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0x0000ffff, 0x8bfe7e7e,
0x8bea6a6a, 0xb97af804,
0xbe804ec2, 0xbf94fffe,
- 0xbe804a6c, 0xbfb10000,
+ 0xbe804a6c, 0xbe804ec2,
+ 0xbf94fffe, 0xbfb10000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm
index 1740e98c6719..7b9d36e5fa43 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm
@@ -1049,6 +1049,10 @@ L_SKIP_BARRIER_RESTORE:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
s_endpgm_saved
end
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler
2025-02-18 11:26 FAILED: patch "[PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12" failed to apply to 6.12-stable tree gregkh
@ 2025-02-21 18:08 ` Lancelot SIX
2025-02-22 15:53 ` Sasha Levin
2025-02-24 14:04 ` Greg KH
0 siblings, 2 replies; 7+ messages in thread
From: Lancelot SIX @ 2025-02-21 18:08 UTC (permalink / raw)
To: stable; +Cc: Lancelot SIX, Jay Cornwall, Alex Deucher
It is possible for some waves in a workgroup to finish their save
sequence before the group leader has had time to capture the workgroup
barrier state. When this happens, having those waves exit do impact the
barrier state. As a consequence, the state captured by the group leader
is invalid, and is eventually incorrectly restored.
This patch proposes to have all waves in a workgroup wait for each other
at the end of their save sequence (just before calling s_endpgm_saved).
This is a cherry-pick. The cwsr_trap_handler.h part of the original
part was valid and applied cleanly. The part of the patch that applied
to cwsr_trap_handler_gfx12.asm did not apply cleanly since
80ae55e6115ef "drm/amdkfd: Move gfx12 trap handler to separate file" is
not part of this branch. Instead, I ported the change to
cwsr_trap_handler_gfx10.asm, and guarded it with "ASIC_FAMILY >=
CHIP_GFX12".
Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
Reviewed-by: Jay Cornwall <jay.cornwall@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org # 6.12.x
(cherry picked from commit d584198a6fe4c51f4aa88ad72f258f8961a0f11c)
Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
---
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h | 3 ++-
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm | 6 ++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
index 02f7ba8c93cd4..7062f12b5b751 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
@@ -4117,7 +4117,8 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0x0000ffff, 0x8bfe7e7e,
0x8bea6a6a, 0xb97af804,
0xbe804ec2, 0xbf94fffe,
- 0xbe804a6c, 0xbfb10000,
+ 0xbe804a6c, 0xbe804ec2,
+ 0xbf94fffe, 0xbfb10000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
index 44772eec9ef4d..3ef294ead56c5 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
@@ -1463,6 +1463,12 @@ L_RETURN_WITHOUT_PRIV:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
+#if ASIC_FAMILY >= CHIP_GFX12
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
+#endif
s_endpgm_saved
end
base-commit: 984391de59a1d6918ac9ba63c095decbcfc85c71
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler
2025-02-18 11:26 FAILED: patch "[PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12" failed to apply to 6.13-stable tree gregkh
@ 2025-02-21 18:09 ` Lancelot SIX
2025-02-22 15:53 ` Sasha Levin
2025-02-24 14:04 ` Greg KH
0 siblings, 2 replies; 7+ messages in thread
From: Lancelot SIX @ 2025-02-21 18:09 UTC (permalink / raw)
To: stable; +Cc: Lancelot SIX, Jay Cornwall, Alex Deucher
It is possible for some waves in a workgroup to finish their save
sequence before the group leader has had time to capture the workgroup
barrier state. When this happens, having those waves exit do impact the
barrier state. As a consequence, the state captured by the group leader
is invalid, and is eventually incorrectly restored.
This patch proposes to have all waves in a workgroup wait for each other
at the end of their save sequence (just before calling s_endpgm_saved).
This is a cherry-pick. The cwsr_trap_handler.h part of the original
part was valid and applied cleanly. The part of the patch that applied
to cwsr_trap_handler_gfx12.asm did not apply cleanly since
80ae55e6115ef "drm/amdkfd: Move gfx12 trap handler to separate file" is
not part of this branch. Instead, I ported the change to
cwsr_trap_handler_gfx10.asm, and guarded it with "ASIC_FAMILY >=
CHIP_GFX12".
Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
Reviewed-by: Jay Cornwall <jay.cornwall@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org # 6.12.x
(cherry picked from commit d584198a6fe4c51f4aa88ad72f258f8961a0f11c)
Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
---
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h | 3 ++-
drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm | 6 ++++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
index 02f7ba8c93cd4..7062f12b5b751 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h
@@ -4117,7 +4117,8 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0x0000ffff, 0x8bfe7e7e,
0x8bea6a6a, 0xb97af804,
0xbe804ec2, 0xbf94fffe,
- 0xbe804a6c, 0xbfb10000,
+ 0xbe804a6c, 0xbe804ec2,
+ 0xbf94fffe, 0xbfb10000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
diff --git a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
index 44772eec9ef4d..8fd7f17df494c 100644
--- a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
+++ b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm
@@ -1463,6 +1463,12 @@ L_RETURN_WITHOUT_PRIV:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
+#if ASIC_FAMILY >= CHIP_GFX12
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
+#endif
s_endpgm_saved
end
base-commit: 4e3ac4150cbd02585dc5cd1b4a25b8519a57c6a2
--
2.43.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler
2025-02-21 18:08 ` [PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler Lancelot SIX
@ 2025-02-22 15:53 ` Sasha Levin
2025-02-24 14:04 ` Greg KH
1 sibling, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2025-02-22 15:53 UTC (permalink / raw)
To: stable, lancelot.six; +Cc: Sasha Levin
[ Sasha's backport helper bot ]
Hi,
Summary of potential issues:
❌ Build failures detected
⚠️ Found matching upstream commit but patch is missing proper reference to it
Found matching upstream commit: d584198a6fe4c51f4aa88ad72f258f8961a0f11c
Status in newer kernel trees:
6.6.y | Not found
Note: The patch differs from the upstream commit:
---
1: d584198a6fe4c ! 1: 1ba3cbf705dfa drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler
@@ Commit message
This patch proposes to have all waves in a workgroup wait for each other
at the end of their save sequence (just before calling s_endpgm_saved).
+ This is a cherry-pick. The cwsr_trap_handler.h part of the original
+ part was valid and applied cleanly. The part of the patch that applied
+ to cwsr_trap_handler_gfx12.asm did not apply cleanly since
+ 80ae55e6115ef "drm/amdkfd: Move gfx12 trap handler to separate file" is
+ not part of this branch. Instead, I ported the change to
+ cwsr_trap_handler_gfx10.asm, and guarded it with "ASIC_FAMILY >=
+ CHIP_GFX12".
+
Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
Reviewed-by: Jay Cornwall <jay.cornwall@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org # 6.12.x
+ (cherry picked from commit d584198a6fe4c51f4aa88ad72f258f8961a0f11c)
+ Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
## drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h ##
@@ drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h: static const uint32_t cwsr_trap_gfx12_hex[] = {
@@ drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h: static const uint32_t cwsr_trap_
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
- ## drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm ##
-@@ drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm: L_SKIP_BARRIER_RESTORE:
+ ## drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm ##
+@@ drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm: L_RETURN_WITHOUT_PRIV:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
++#if ASIC_FAMILY >= CHIP_GFX12
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
++#endif
s_endpgm_saved
end
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.13.y | Success | Success |
| stable/linux-6.12.y | Success | Success |
| stable/linux-6.6.y | Failed | N/A |
| stable/linux-6.1.y | Failed | N/A |
| stable/linux-5.15.y | Failed | N/A |
| stable/linux-5.10.y | Failed | N/A |
| stable/linux-5.4.y | Failed | N/A |
Build Errors:
Patch failed to apply on stable/linux-6.6.y. Reject:
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h (rejected hunks)
@@ -4117,7 +4117,8 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0x0000ffff, 0x8bfe7e7e,
0x8bea6a6a, 0xb97af804,
0xbe804ec2, 0xbf94fffe,
- 0xbe804a6c, 0xbfb10000,
+ 0xbe804a6c, 0xbe804ec2,
+ 0xbf94fffe, 0xbfb10000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm (rejected hunks)
@@ -1463,6 +1463,12 @@ L_RETURN_WITHOUT_PRIV:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
+#if ASIC_FAMILY >= CHIP_GFX12
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
+#endif
s_endpgm_saved
end
Patch failed to apply on stable/linux-6.1.y. Reject:
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h (rejected hunks)
@@ -4117,7 +4117,8 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0x0000ffff, 0x8bfe7e7e,
0x8bea6a6a, 0xb97af804,
0xbe804ec2, 0xbf94fffe,
- 0xbe804a6c, 0xbfb10000,
+ 0xbe804a6c, 0xbe804ec2,
+ 0xbf94fffe, 0xbfb10000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm (rejected hunks)
@@ -1463,6 +1463,12 @@ L_RETURN_WITHOUT_PRIV:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
+#if ASIC_FAMILY >= CHIP_GFX12
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
+#endif
s_endpgm_saved
end
Patch failed to apply on stable/linux-5.15.y. Reject:
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h (rejected hunks)
@@ -4117,7 +4117,8 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0x0000ffff, 0x8bfe7e7e,
0x8bea6a6a, 0xb97af804,
0xbe804ec2, 0xbf94fffe,
- 0xbe804a6c, 0xbfb10000,
+ 0xbe804a6c, 0xbe804ec2,
+ 0xbf94fffe, 0xbfb10000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm (rejected hunks)
@@ -1463,6 +1463,12 @@ L_RETURN_WITHOUT_PRIV:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
+#if ASIC_FAMILY >= CHIP_GFX12
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
+#endif
s_endpgm_saved
end
Patch failed to apply on stable/linux-5.10.y. Reject:
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h (rejected hunks)
@@ -4117,7 +4117,8 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0x0000ffff, 0x8bfe7e7e,
0x8bea6a6a, 0xb97af804,
0xbe804ec2, 0xbf94fffe,
- 0xbe804a6c, 0xbfb10000,
+ 0xbe804a6c, 0xbe804ec2,
+ 0xbf94fffe, 0xbfb10000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm (rejected hunks)
@@ -1463,6 +1463,12 @@ L_RETURN_WITHOUT_PRIV:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
+#if ASIC_FAMILY >= CHIP_GFX12
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
+#endif
s_endpgm_saved
end
Patch failed to apply on stable/linux-5.4.y. Reject:
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h (rejected hunks)
@@ -4117,7 +4117,8 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0x0000ffff, 0x8bfe7e7e,
0x8bea6a6a, 0xb97af804,
0xbe804ec2, 0xbf94fffe,
- 0xbe804a6c, 0xbfb10000,
+ 0xbe804a6c, 0xbe804ec2,
+ 0xbf94fffe, 0xbfb10000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm (rejected hunks)
@@ -1463,6 +1463,12 @@ L_RETURN_WITHOUT_PRIV:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
+#if ASIC_FAMILY >= CHIP_GFX12
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
+#endif
s_endpgm_saved
end
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler
2025-02-21 18:09 ` [PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler Lancelot SIX
@ 2025-02-22 15:53 ` Sasha Levin
2025-02-24 14:04 ` Greg KH
1 sibling, 0 replies; 7+ messages in thread
From: Sasha Levin @ 2025-02-22 15:53 UTC (permalink / raw)
To: stable, lancelot.six; +Cc: Sasha Levin
[ Sasha's backport helper bot ]
Hi,
Summary of potential issues:
❌ Build failures detected
⚠️ Found matching upstream commit but patch is missing proper reference to it
Found matching upstream commit: d584198a6fe4c51f4aa88ad72f258f8961a0f11c
Status in newer kernel trees:
6.6.y | Not found
Note: The patch differs from the upstream commit:
---
1: d584198a6fe4c ! 1: 4d030c400adf7 drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler
@@ Commit message
This patch proposes to have all waves in a workgroup wait for each other
at the end of their save sequence (just before calling s_endpgm_saved).
+ This is a cherry-pick. The cwsr_trap_handler.h part of the original
+ part was valid and applied cleanly. The part of the patch that applied
+ to cwsr_trap_handler_gfx12.asm did not apply cleanly since
+ 80ae55e6115ef "drm/amdkfd: Move gfx12 trap handler to separate file" is
+ not part of this branch. Instead, I ported the change to
+ cwsr_trap_handler_gfx10.asm, and guarded it with "ASIC_FAMILY >=
+ CHIP_GFX12".
+
Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
Reviewed-by: Jay Cornwall <jay.cornwall@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org # 6.12.x
+ (cherry picked from commit d584198a6fe4c51f4aa88ad72f258f8961a0f11c)
+ Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
## drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h ##
@@ drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h: static const uint32_t cwsr_trap_gfx12_hex[] = {
@@ drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h: static const uint32_t cwsr_trap_
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
- ## drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm ##
-@@ drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx12.asm: L_SKIP_BARRIER_RESTORE:
+ ## drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm ##
+@@ drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm: L_RETURN_WITHOUT_PRIV:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
++#if ASIC_FAMILY >= CHIP_GFX12
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
++#endif
s_endpgm_saved
end
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.13.y | Success | Success |
| stable/linux-6.12.y | Success | Success |
| stable/linux-6.6.y | Failed | N/A |
| stable/linux-6.1.y | Failed | N/A |
| stable/linux-5.15.y | Failed | N/A |
| stable/linux-5.10.y | Failed | N/A |
| stable/linux-5.4.y | Failed | N/A |
Build Errors:
Patch failed to apply on stable/linux-6.6.y. Reject:
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h (rejected hunks)
@@ -4117,7 +4117,8 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0x0000ffff, 0x8bfe7e7e,
0x8bea6a6a, 0xb97af804,
0xbe804ec2, 0xbf94fffe,
- 0xbe804a6c, 0xbfb10000,
+ 0xbe804a6c, 0xbe804ec2,
+ 0xbf94fffe, 0xbfb10000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm (rejected hunks)
@@ -1463,6 +1463,12 @@ L_RETURN_WITHOUT_PRIV:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
+#if ASIC_FAMILY >= CHIP_GFX12
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
+#endif
s_endpgm_saved
end
Patch failed to apply on stable/linux-6.1.y. Reject:
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h (rejected hunks)
@@ -4117,7 +4117,8 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0x0000ffff, 0x8bfe7e7e,
0x8bea6a6a, 0xb97af804,
0xbe804ec2, 0xbf94fffe,
- 0xbe804a6c, 0xbfb10000,
+ 0xbe804a6c, 0xbe804ec2,
+ 0xbf94fffe, 0xbfb10000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm (rejected hunks)
@@ -1463,6 +1463,12 @@ L_RETURN_WITHOUT_PRIV:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
+#if ASIC_FAMILY >= CHIP_GFX12
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
+#endif
s_endpgm_saved
end
Patch failed to apply on stable/linux-5.15.y. Reject:
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h (rejected hunks)
@@ -4117,7 +4117,8 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0x0000ffff, 0x8bfe7e7e,
0x8bea6a6a, 0xb97af804,
0xbe804ec2, 0xbf94fffe,
- 0xbe804a6c, 0xbfb10000,
+ 0xbe804a6c, 0xbe804ec2,
+ 0xbf94fffe, 0xbfb10000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm (rejected hunks)
@@ -1463,6 +1463,12 @@ L_RETURN_WITHOUT_PRIV:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
+#if ASIC_FAMILY >= CHIP_GFX12
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
+#endif
s_endpgm_saved
end
Patch failed to apply on stable/linux-5.10.y. Reject:
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h (rejected hunks)
@@ -4117,7 +4117,8 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0x0000ffff, 0x8bfe7e7e,
0x8bea6a6a, 0xb97af804,
0xbe804ec2, 0xbf94fffe,
- 0xbe804a6c, 0xbfb10000,
+ 0xbe804a6c, 0xbe804ec2,
+ 0xbf94fffe, 0xbfb10000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm (rejected hunks)
@@ -1463,6 +1463,12 @@ L_RETURN_WITHOUT_PRIV:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
+#if ASIC_FAMILY >= CHIP_GFX12
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
+#endif
s_endpgm_saved
end
Patch failed to apply on stable/linux-5.4.y. Reject:
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h (rejected hunks)
@@ -4117,7 +4117,8 @@ static const uint32_t cwsr_trap_gfx12_hex[] = {
0x0000ffff, 0x8bfe7e7e,
0x8bea6a6a, 0xb97af804,
0xbe804ec2, 0xbf94fffe,
- 0xbe804a6c, 0xbfb10000,
+ 0xbe804a6c, 0xbe804ec2,
+ 0xbf94fffe, 0xbfb10000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0xbf9f0000,
0xbf9f0000, 0x00000000,
diff a/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm b/drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm (rejected hunks)
@@ -1463,6 +1463,12 @@ L_RETURN_WITHOUT_PRIV:
s_rfe_b64 s_restore_pc_lo //Return to the main shader program and resume execution
L_END_PGM:
+#if ASIC_FAMILY >= CHIP_GFX12
+ // Make sure that no wave of the workgroup can exit the trap handler
+ // before the workgroup barrier state is saved.
+ s_barrier_signal -2
+ s_barrier_wait -2
+#endif
s_endpgm_saved
end
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler
2025-02-21 18:08 ` [PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler Lancelot SIX
2025-02-22 15:53 ` Sasha Levin
@ 2025-02-24 14:04 ` Greg KH
1 sibling, 0 replies; 7+ messages in thread
From: Greg KH @ 2025-02-24 14:04 UTC (permalink / raw)
To: Lancelot SIX; +Cc: stable, Jay Cornwall, Alex Deucher
On Fri, Feb 21, 2025 at 06:08:52PM +0000, Lancelot SIX wrote:
> It is possible for some waves in a workgroup to finish their save
> sequence before the group leader has had time to capture the workgroup
> barrier state. When this happens, having those waves exit do impact the
> barrier state. As a consequence, the state captured by the group leader
> is invalid, and is eventually incorrectly restored.
>
> This patch proposes to have all waves in a workgroup wait for each other
> at the end of their save sequence (just before calling s_endpgm_saved).
>
> This is a cherry-pick. The cwsr_trap_handler.h part of the original
> part was valid and applied cleanly. The part of the patch that applied
> to cwsr_trap_handler_gfx12.asm did not apply cleanly since
> 80ae55e6115ef "drm/amdkfd: Move gfx12 trap handler to separate file" is
> not part of this branch. Instead, I ported the change to
> cwsr_trap_handler_gfx10.asm, and guarded it with "ASIC_FAMILY >=
> CHIP_GFX12".
>
> Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
> Reviewed-by: Jay Cornwall <jay.cornwall@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Cc: stable@vger.kernel.org # 6.12.x
> (cherry picked from commit d584198a6fe4c51f4aa88ad72f258f8961a0f11c)
> Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
> ---
> drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h | 3 ++-
> drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm | 6 ++++++
> 2 files changed, 8 insertions(+), 1 deletion(-)
What stable branch is this to be applied to?
thanks,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler
2025-02-21 18:09 ` [PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler Lancelot SIX
2025-02-22 15:53 ` Sasha Levin
@ 2025-02-24 14:04 ` Greg KH
1 sibling, 0 replies; 7+ messages in thread
From: Greg KH @ 2025-02-24 14:04 UTC (permalink / raw)
To: Lancelot SIX; +Cc: stable, Jay Cornwall, Alex Deucher
On Fri, Feb 21, 2025 at 06:09:28PM +0000, Lancelot SIX wrote:
> It is possible for some waves in a workgroup to finish their save
> sequence before the group leader has had time to capture the workgroup
> barrier state. When this happens, having those waves exit do impact the
> barrier state. As a consequence, the state captured by the group leader
> is invalid, and is eventually incorrectly restored.
>
> This patch proposes to have all waves in a workgroup wait for each other
> at the end of their save sequence (just before calling s_endpgm_saved).
>
> This is a cherry-pick. The cwsr_trap_handler.h part of the original
> part was valid and applied cleanly. The part of the patch that applied
> to cwsr_trap_handler_gfx12.asm did not apply cleanly since
> 80ae55e6115ef "drm/amdkfd: Move gfx12 trap handler to separate file" is
> not part of this branch. Instead, I ported the change to
> cwsr_trap_handler_gfx10.asm, and guarded it with "ASIC_FAMILY >=
> CHIP_GFX12".
>
> Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
> Reviewed-by: Jay Cornwall <jay.cornwall@amd.com>
> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Cc: stable@vger.kernel.org # 6.12.x
> (cherry picked from commit d584198a6fe4c51f4aa88ad72f258f8961a0f11c)
> Signed-off-by: Lancelot SIX <lancelot.six@amd.com>
> ---
> drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler.h | 3 ++-
> drivers/gpu/drm/amd/amdkfd/cwsr_trap_handler_gfx10.asm | 6 ++++++
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
You sent this twice, right? What branch is this for?
confused,
greg k-h
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-02-24 14:04 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-18 11:26 FAILED: patch "[PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12" failed to apply to 6.13-stable tree gregkh
2025-02-21 18:09 ` [PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler Lancelot SIX
2025-02-22 15:53 ` Sasha Levin
2025-02-24 14:04 ` Greg KH
-- strict thread matches above, loose matches on Subject: below --
2025-02-18 11:26 FAILED: patch "[PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12" failed to apply to 6.12-stable tree gregkh
2025-02-21 18:08 ` [PATCH] drm/amdkfd: Ensure consistent barrier state saved in gfx12 trap handler Lancelot SIX
2025-02-22 15:53 ` Sasha Levin
2025-02-24 14:04 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox