drm/amdgpu: fix gfx12 mes packet submission status check
Subsystems (2)
PATCH 1/1 drm/amdgpu: fix gfx12 mes packet submission status check
The driver currently only checks that the MES packet submission fence did not timeout but does not actually check if the fence return status matches the expected completion value it passed to MES prior to submission.
For example, this can result in REMOVE_QUEUE requests returning success to the driver when the queue actually failed to preempt.
Fix this by having the driver actually compare the completion status value to the expected success value.
--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1 -2
@@ -228,8 +228,7 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, pipe, x_pkt->header.opcode); r =amdgpu_fence_wait_polling (ring, seq, timeout); -if (r <1 || !*status_ptr) { - +if (r <1 || *status_ptr != api_status->api_completion_fence_value) {if (misc_op_str)dev_err (adev->dev,"MES(%d) failed to respond to msg=%s (%s)\n" , pipe, op_str, misc_op_str);
Signature · 1 line
2.34.1
Quoted 11 lines · Jonathan Kim
The driver currently only checks that the MES packet submission fence did not timeout but does not actually check if the fence return status matches the expected completion value it passed to MES prior to submission.
For example, this can result in
REMOVE_QUEUErequests returning success to the driver when the queue actually failed to preempt.Fix this by having the driver actually compare the completion status value to the expected success value.
This should be correct as is:
*status_ptr = 0;
...api_status->api_completion_fence_value = 1;
...
if (r < 1 || !*status_ptr) {
Alex
Quoted 23 lines
Signed-off-by Jonathan Kim <[email protected]>--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1
-3@@ -228,8 +228,7 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, pipe, x_pkt->header.opcode); r =amdgpu_fence_wait_polling (ring, seq, timeout); -if (r <1 || !*status_ptr) { - +if (r <1 || *status_ptr != api_status->api_completion_fence_value) {if (misc_op_str)dev_err (adev->dev,"MES(%d) failed to respond to msg=%s (%s)\n" , pipe, op_str, misc_op_str); --2.34.1
[Public]
Quoted 18 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 8, 2025 1:12 PM
To: Kim, Jonathan <[email protected]>
Cc: [email protected]; Liu, Shaoyun <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx12 mes packet submission status checkQuoted 9 lines · Jonathan Kim
The driver currently only checks that the MES packet submission fence did not timeout but does not actually check if the fence return status matches the expected completion value it passed to MES prior to submission.
For example, this can result in
REMOVE_QUEUErequests returning success to the driver when the queue actually failed to preempt.
Quoted 6 lines
Quoted 2 lines
Fix this by having the driver actually compare the completion status value to the expected success value.
This should be correct as is:
*status_ptr= 0;
That's not what I'm observing at the moment.amdgpu_fence_wait_polling can still return fine where status_ptr != 0 nor 1.
From what I've been told, only 0x1 == success (the completion fence value passed to MES).
Shaoyun can probably elaborate or correct me if I'm wrong.
It's pretty easy for me to put the HW in a bad state (dangling queues post remove) without the driver knowing in its current state.
Jon
Quoted 33 lines
...
api_status->api_completion_fence_value= 1;
...
if (r < 1 || !*status_ptr) {Alex
Review
Quoted 7 lines
Signed-off-by Jonathan Kim <[email protected]>--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.cdrivers/gpu/drm/amd/amdgpu/mes_v12_0.c static int
Quoted 4 lines
index
aff06f06aeee..58f61170cf85100644drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0
-0@@ -228,8 +228,7 @@ static intmes_v12_0_submit_pkt_and_poll_completion(struct
amdgpu_mes*mes,drivers/gpu/drm/amd/amdgpu/mes_v12_0.c static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1
-2pipe, x_pkt->header.opcode); r =amdgpu_fence_wait_polling (ring, seq, timeout); -if (r <1 || !*status_ptr) { - +if (r <1 || *status_ptr != api_status->api_completion_fence_value) {if (misc_op_str) dev_err(adev->dev, "MES(%d) failed to respond to msg=%s(%s)\n",
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0
-1pipe, op_str, misc_op_str); --2.34.1
Quoted 26 lines · Jonathan
[Public]
Quoted 23 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 8, 2025 1:12 PM
To: Kim, Jonathan <[email protected]>
Cc: [email protected]; Liu, Shaoyun <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx12 mes packet submission status checkQuoted 11 lines · Jonathan Kim
The driver currently only checks that the MES packet submission fence did not timeout but does not actually check if the fence return status matches the expected completion value it passed to MES prior to submission.
For example, this can result in
REMOVE_QUEUErequests returning success to the driver when the queue actually failed to preempt.Fix this by having the driver actually compare the completion status value to the expected success value.
This should be correct as is:
Quoted 7 lines
Quoted 1 line
*status_ptr= 0;That's not what I'm observing at the moment.
amdgpu_fence_wait_pollingcan still return fine wherestatus_ptr!= 0 nor 1.
From what I've been told, only0x1== success (the completion fence value passed to MES).
Shaoyun can probably elaborate or correct me if I'm wrong.
It's pretty easy for me to put the HW in a bad state (dangling queues post remove) without the driver knowing in its current state.
1 is just what the driver puts as the fence value to write:api_status->api_completion_fence_value = 1;
and the memory location is initialized to 0:*status_ptr = 0;
The firmware should either write 1 or nothing, writing a random value in there looks like memory corruption or a firmware bug. If it doesn't write the fence, the driver can assume the operation failed. If it writes random values, then we have no idea what's going on.
Alex
Quoted 36 lines
Jon
Quoted 33 lines
...
api_status->api_completion_fence_value= 1;
...
if (r < 1 || !*status_ptr) {Alex
Review
Quoted 7 lines
Signed-off-by Jonathan Kim <[email protected]>--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.cdrivers/gpu/drm/amd/amdgpu/mes_v12_0.c static int
Quoted 4 lines
index
aff06f06aeee..58f61170cf85100644drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0
-0@@ -228,8 +228,7 @@ static intmes_v12_0_submit_pkt_and_poll_completion(struct
amdgpu_mes*mes,drivers/gpu/drm/amd/amdgpu/mes_v12_0.c static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1
-2pipe, x_pkt->header.opcode); r =amdgpu_fence_wait_polling (ring, seq, timeout); -if (r <1 || !*status_ptr) { - +if (r <1 || *status_ptr != api_status->api_completion_fence_value) {if (misc_op_str) dev_err(adev->dev, "MES(%d) failed to respond to msg=%s(%s)\n",
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0
-1pipe, op_str, misc_op_str); --2.34.1
[Public]
Quoted 46 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 8, 2025 1:46 PM
To: Kim, Jonathan <[email protected]>
Cc: [email protected]; Liu, Shaoyun <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx12 mes packet submission status checkQuoted 9 lines · Jonathan
[Public]
Quoted 6 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 8, 2025 1:12 PM
To: Kim, Jonathan <[email protected]>
Cc: [email protected]; Liu, Shaoyun <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx12 mes packet submission statuscheck
Quoted 15 lines
Quoted 15 lines
Quoted 11 lines · Jonathan Kim
The driver currently only checks that the MES packet submission fence did not timeout but does not actually check if the fence return status matches the expected completion value it passed to MES prior to submission.
For example, this can result in
REMOVE_QUEUErequests returning success to the driver when the queue actually failed to preempt.Fix this by having the driver actually compare the completion status value to the expected success value.
Quoted 7 lines
Quoted 3 lines
This should be correct as is:
*status_ptr= 0;That's not what I'm observing at the moment.
amdgpu_fence_wait_pollingcan still return fine wherestatus_ptr!= 0 nor 1. From what I've been told, only0x1== success (the completion fence valuepassed to MES).
Quoted 2 lines
Shaoyun can probably elaborate or correct me if I'm wrong. It's pretty easy for me to put the HW in a bad state (dangling queues post
remove) without the driver knowing in its current state.
Quoted 8 lines
1 is just what the driver puts as the fence value to write:
api_status->api_completion_fence_value= 1;
and the memory location is initialized to 0:*status_ptr= 0;
The firmware should either write 1 or nothing, writing a random value in there looks like memory corruption or a firmware bug. If it doesn't write the fence, the driver can assume the operation failed. If it writes random values, then we have no idea what's going on.
FW writes high 32 bits to status_ptr for debug codes if low bits is 0. So we should probably only check the 32 lower bits then.
Jon
Quoted 39 lines
Alex
Quoted 36 lines
Jon
Quoted 33 lines
...
api_status->api_completion_fence_value= 1;
...
if (r < 1 || !*status_ptr) {Alex
Review
Quoted 7 lines
Signed-off-by Jonathan Kim <[email protected]>--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.cdrivers/gpu/drm/amd/amdgpu/mes_v12_0.c static int
Quoted 4 lines
index
aff06f06aeee..58f61170cf85100644drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0
-0@@ -228,8 +228,7 @@ static intmes_v12_0_submit_pkt_and_poll_completion(struct
amdgpu_mes*mes,drivers/gpu/drm/amd/amdgpu/mes_v12_0.c static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1
-2pipe, x_pkt->header.opcode); r =amdgpu_fence_wait_polling (ring, seq, timeout); -if (r <1 || !*status_ptr) { - +if (r <1 || *status_ptr != api_status->api_completion_fence_value) {if (misc_op_str) dev_err(adev->dev, "MES(%d) failed to respond to msg=%s(%s)\n",
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0
-1pipe, op_str, misc_op_str); --2.34.1
Quoted 58 lines · Jonathan
[Public]
Quoted 46 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 8, 2025 1:46 PM
To: Kim, Jonathan <[email protected]>
Cc: [email protected]; Liu, Shaoyun <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx12 mes packet submission status checkQuoted 9 lines · Jonathan
[Public]
Quoted 6 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 8, 2025 1:12 PM
To: Kim, Jonathan <[email protected]>
Cc: [email protected]; Liu, Shaoyun <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx12 mes packet submission statuscheck
Quoted 15 lines
Quoted 15 lines
Quoted 11 lines · Jonathan Kim
The driver currently only checks that the MES packet submission fence did not timeout but does not actually check if the fence return status matches the expected completion value it passed to MES prior to submission.
For example, this can result in
REMOVE_QUEUErequests returning success to the driver when the queue actually failed to preempt.Fix this by having the driver actually compare the completion status value to the expected success value.
Quoted 7 lines
Quoted 3 lines
This should be correct as is:
*status_ptr= 0;That's not what I'm observing at the moment.
amdgpu_fence_wait_pollingcan still return fine wherestatus_ptr!= 0 nor 1. From what I've been told, only0x1== success (the completion fence valuepassed to MES).
Quoted 2 lines
Shaoyun can probably elaborate or correct me if I'm wrong. It's pretty easy for me to put the HW in a bad state (dangling queues post
remove) without the driver knowing in its current state.
Quoted 8 lines
1 is just what the driver puts as the fence value to write:
api_status->api_completion_fence_value= 1;
and the memory location is initialized to 0:*status_ptr= 0;
The firmware should either write 1 or nothing, writing a random value in there looks like memory corruption or a firmware bug. If it doesn't write the fence, the driver can assume the operation failed. If it writes random values, then we have no idea what's going on.
Quoted 2 lines
FW writes high 32 bits to
status_ptrfor debug codes if low bits is 0. So we should probably only check the 32 lower bits then.
Thanks for clearing this up. Please check if mes_v11 needs a similar fix.
Alex
Quoted 42 lines
Jon
Quoted 39 lines
Alex
Quoted 36 lines
Jon
Quoted 33 lines
...
api_status->api_completion_fence_value= 1;
...
if (r < 1 || !*status_ptr) {Alex
Review
Quoted 7 lines
Signed-off-by Jonathan Kim <[email protected]>--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.cdrivers/gpu/drm/amd/amdgpu/mes_v12_0.c static int
Quoted 4 lines
index
aff06f06aeee..58f61170cf85100644drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0
-0@@ -228,8 +228,7 @@ static intmes_v12_0_submit_pkt_and_poll_completion(struct
amdgpu_mes*mes,drivers/gpu/drm/amd/amdgpu/mes_v12_0.c static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes,
Quoted 8 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1
-2pipe, x_pkt->header.opcode); r =amdgpu_fence_wait_polling (ring, seq, timeout); -if (r <1 || !*status_ptr) { - +if (r <1 || *status_ptr != api_status->api_completion_fence_value) {if (misc_op_str) dev_err(adev->dev, "MES(%d) failed to respond to msg=%s(%s)\n",
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0
-1pipe, op_str, misc_op_str); --2.34.1
[Public]
Quoted 71 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 8, 2025 4:16 PM
To: Kim, Jonathan <[email protected]>
Cc: [email protected]; Liu, Shaoyun <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx12 mes packet submission status checkQuoted 9 lines · Jonathan
[Public]
Quoted 6 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 8, 2025 1:46 PM
To: Kim, Jonathan <[email protected]>
Cc: [email protected]; Liu, Shaoyun <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx12 mes packet submission statuscheck
Quoted 11 lines
Quoted 11 lines
Quoted 8 lines · Jonathan
[Public]
Quoted 5 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 8, 2025 1:12 PM
To: Kim, Jonathan <[email protected]>
Cc: [email protected]; Liu, ShaoyunQuoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Subject: Re: [PATCH] drm/amdgpu: fix gfx12 mes packet submission status
check
Quoted 2 lines
Quoted 2 lines
On Wed, Oct 8, 2025 at 12:51 PM Jonathan Kim
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines · wrote:
The driver currently only checks that the MES packet submission fence did not timeout but does not actually check if the fence return status matches the expected completion value it passed to MES prior to submission.
For example, this can result in
REMOVE_QUEUErequests returningsuccess
Quoted 26 lines
Quoted 25 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
to the driver when the queue actually failed to preempt.
Fix this by having the driver actually compare the completion status value to the expected success value.
Quoted 7 lines
Quoted 3 lines
This should be correct as is:
*status_ptr= 0;That's not what I'm observing at the moment.
amdgpu_fence_wait_pollingcan still return fine wherestatus_ptr!= 0 nor 1. From what I've been told, only0x1== success (the completion fence valuepassed to MES).
Quoted 2 lines
Shaoyun can probably elaborate or correct me if I'm wrong. It's pretty easy for me to put the HW in a bad state (dangling queues post
remove) without the driver knowing in its current state.
1 is just what the driver puts as the fence value to write:
api_status->api_completion_fence_value= 1;
and the memory location is initialized to 0:*status_ptr= 0;
The firmware should either write 1 or nothing, writing a random value in there looks like memory corruption or a firmware bug. If it doesn't write the fence, the driver can assume the operation failed. If it writes random values, then we have no idea what's going on.
Quoted 4 lines
Quoted 2 lines
FW writes high 32 bits to
status_ptrfor debug codes if low bits is 0. So we should probably only check the 32 lower bits then.Thanks for clearing this up. Please check if
mes_v11needs a similar fix.
Looks like GFX11 is fine the way it is.
The hi/lo bit split in the status return only affects GFX12.
Jon
Quoted 46 lines
Alex
Quoted 35 lines
Jon
Quoted 32 lines
Alex
Quoted 29 lines
Jon
Quoted 26 lines
...
api_status->api_completion_fence_value= 1;
...
if (r < 1 || !*status_ptr) {Alex
Review
Quoted 7 lines
Signed-off-by Jonathan Kim <[email protected]>--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.cdrivers/gpu/drm/amd/amdgpu/mes_v12_0.c static int
Quoted 4 lines
index
aff06f06aeee..58f61170cf85100644drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0
-0@@ -228,8 +228,7 @@ static intmes_v12_0_submit_pkt_and_poll_completion(struct
amdgpu_mes*mes,Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1
-2pipe, x_pkt->header.opcode); r =amdgpu_fence_wait_polling (ring, seq, timeout); -if (r <1 || !*status_ptr) { - +if (r <1 || *status_ptr != api_status->api_completion_fence_value){
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c static int · line 233
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0
-0if (misc_op_str) dev_err(adev->dev, "MES(%d) failed to respond to msg=%s(%s)\n",
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0
-1pipe, op_str, misc_op_str); --2.34.1
Thanks for checking.
Alex
Quoted 130 lines · Jonathan
[Public]
Quoted 71 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 8, 2025 4:16 PM
To: Kim, Jonathan <[email protected]>
Cc: [email protected]; Liu, Shaoyun <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx12 mes packet submission status checkQuoted 9 lines · Jonathan
[Public]
Quoted 6 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 8, 2025 1:46 PM
To: Kim, Jonathan <[email protected]>
Cc: [email protected]; Liu, Shaoyun <[email protected]>
Subject: Re: [PATCH] drm/amdgpu: fix gfx12 mes packet submission statuscheck
Quoted 11 lines
Quoted 11 lines
Quoted 8 lines · Jonathan
[Public]
Quoted 5 lines
-----Original Message-----
From: Alex Deucher <[email protected]>
Sent: Wednesday, October 8, 2025 1:12 PM
To: Kim, Jonathan <[email protected]>
Cc: [email protected]; Liu, ShaoyunQuoted 4 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line
Subject: Re: [PATCH] drm/amdgpu: fix gfx12 mes packet submission status
check
Quoted 2 lines
Quoted 2 lines
On Wed, Oct 8, 2025 at 12:51 PM Jonathan Kim
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines · wrote:
The driver currently only checks that the MES packet submission fence did not timeout but does not actually check if the fence return status matches the expected completion value it passed to MES prior to submission.
For example, this can result in
REMOVE_QUEUErequests returningsuccess
Quoted 26 lines
Quoted 25 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines
to the driver when the queue actually failed to preempt.
Fix this by having the driver actually compare the completion status value to the expected success value.
Quoted 7 lines
Quoted 3 lines
This should be correct as is:
*status_ptr= 0;That's not what I'm observing at the moment.
amdgpu_fence_wait_pollingcan still return fine wherestatus_ptr!= 0 nor 1. From what I've been told, only0x1== success (the completion fence valuepassed to MES).
Quoted 2 lines
Shaoyun can probably elaborate or correct me if I'm wrong. It's pretty easy for me to put the HW in a bad state (dangling queues post
remove) without the driver knowing in its current state.
1 is just what the driver puts as the fence value to write:
api_status->api_completion_fence_value= 1;
and the memory location is initialized to 0:*status_ptr= 0;
The firmware should either write 1 or nothing, writing a random value in there looks like memory corruption or a firmware bug. If it doesn't write the fence, the driver can assume the operation failed. If it writes random values, then we have no idea what's going on.Quoted 4 lines
Quoted 2 lines
FW writes high 32 bits to
status_ptrfor debug codes if low bits is 0. So we should probably only check the 32 lower bits then.Thanks for clearing this up. Please check if
mes_v11needs a similar fix.Looks like GFX11 is fine the way it is.
The hi/lo bit split in the status return only affects GFX12.Jon
Quoted 46 lines
Alex
Quoted 35 lines
Jon
Quoted 32 lines
Alex
Quoted 29 lines
Jon
Quoted 26 lines
...
api_status->api_completion_fence_value= 1;
...
if (r < 1 || !*status_ptr) {Alex
Review
Quoted 7 lines
Signed-off-by Jonathan Kim <[email protected]>--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)(quoted diff) +0
-0
b/drivers/gpu/drm/amd/amdgpu/mes_v12_0.cdrivers/gpu/drm/amd/amdgpu/mes_v12_0.c static int
Quoted 4 lines
index
aff06f06aeee..58f61170cf85100644drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0
-0@@ -228,8 +228,7 @@ static intmes_v12_0_submit_pkt_and_poll_completion(struct
amdgpu_mes*mes,Quoted 6 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1
-2pipe, x_pkt->header.opcode); r =amdgpu_fence_wait_polling (ring, seq, timeout); -if (r <1 || !*status_ptr) { - +if (r <1 || *status_ptr != api_status->api_completion_fence_value){
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c static int · line 233
Quoted 2 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0
-0if (misc_op_str) dev_err(adev->dev, "MES(%d) failed to respond to msg=%s(%s)\n",
Quoted 4 lines
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +0
-1pipe, op_str, misc_op_str); --2.34.1
[AMD Official Use Only - AMD Internal Distribution Only]
Looks good to me .
-----Original Message-----
From: Kim, Jonathan <[email protected]>
Sent: Wednesday, October 8, 2025 12:44 PM
To: [email protected]
Cc: Liu, Shaoyun <[email protected]>; Kim, Jonathan <[email protected]>
Subject: [PATCH] drm/amdgpu: fix gfx12 mes packet submission status check
The driver currently only checks that the MES packet submission fence did not timeout but does not actually check if the fence return status matches the expected completion value it passed to MES prior to submission.
For example, this can result in REMOVE_QUEUE requests returning success to the driver when the queue actually failed to preempt.
Fix this by having the driver actually compare the completion status value to the expected success value.
--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1 -2
@@ -228,8 +228,7 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, pipe, x_pkt->header.opcode); r =amdgpu_fence_wait_polling (ring, seq, timeout); -if (r <1 || !*status_ptr) { - +if (r <1 || *status_ptr != api_status->api_completion_fence_value) {if (misc_op_str)dev_err (adev->dev,"MES(%d) failed to respond to msg=%s (%s)\n" , pipe, op_str, misc_op_str);
--
2.34.1
[Public]
Based on conversations with Alex, it's probably best to just check the low 32-bits of status instead. Will send out v2 shortly.
Jon
Quoted 54 lines
-----Original Message-----
From: Liu, Shaoyun <[email protected]>
Sent: Wednesday, October 8, 2025 1:15 PM
To: Kim, Jonathan <[email protected]>; [email protected]
Subject: RE: [PATCH] drm/amdgpu: fix gfx12 mes packet submission status check[AMD Official Use Only - AMD Internal Distribution Only]
Looks good to me .
Reviewed-by Shaoyun.liu <[email protected]>-----Original Message-----
From: Kim, Jonathan <[email protected]>
Sent: Wednesday, October 8, 2025 12:44 PM
To: [email protected]
Cc: Liu, Shaoyun <[email protected]>; Kim, Jonathan <[email protected]>
Subject: [PATCH] drm/amdgpu: fix gfx12 mes packet submission status checkThe driver currently only checks that the MES packet submission fence did not timeout but does not actually check if the fence return status matches the expected completion value it passed to MES prior to submission.
For example, this can result in
REMOVE_QUEUErequests returning success to the driver when the queue actually failed to preempt.Fix this by having the driver actually compare the completion status value to the expected success value.
Signed-off-by Jonathan Kim <[email protected]>--- drivers/gpu/drm/amd/amdgpu/mes_v12_0.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)drivers/gpu/drm/amd/amdgpu/mes_v12_0.c +1
-2@@ -228,8 +228,7 @@ static int mes_v12_0_submit_pkt_and_poll_completion(struct amdgpu_mes *mes, pipe, x_pkt->header.opcode); r =amdgpu_fence_wait_polling (ring, seq, timeout); -if (r <1 || !*status_ptr) { - +if (r <1 || *status_ptr != api_status->api_completion_fence_value) {if (misc_op_str) dev_err(adev->dev, "MES(%d) failed to respond to msg=%s (%s)\n",pipe, op_str, misc_op_str);--
2.34.1