Skip to contentSkip to conversation

Revert "drm/amdgpu: promote the implicit sync to the dependent read fences"

PATCH In review Sunil Khatri 3 participants 5 messages May 27, 2025 – May 28, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "drm/amdgpu: promote the implicit sync to the dependent read fences"

This reverts commit 714bbbf20a7266e48632fab466563e695af9acb5. bisected to this change which is causing the flikering issue in the UI for various apps like glxgears and unigen heaven.

Also when we set user_queue=1, which enable both user and kernel submissions the userqueue tests in IGT also fail.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +3 -2
index d6ae9974c952..5576ed0b508f 100644
@@ -249,8 +249,9 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, struct amdgpu_sync *sync,
 
 	if (resv == NULL)
 		return -EINVAL;
-	/* Implicitly sync only to KERNEL, WRITE and READ */
-	dma_resv_for_each_fence(&cursor, resv, DMA_RESV_USAGE_READ, f) {
+
+	/* TODO: Use DMA_RESV_USAGE_READ here */
+	dma_resv_for_each_fence(&cursor, resv, DMA_RESV_USAGE_BOOKKEEP, f) {
 		dma_fence_chain_for_each(f, f) {
 			struct dma_fence *tmp = dma_fence_chain_contained(f);
 
Signature · 1 line
2.34.1
maintainer
#1 lore raw
Quoted 3 lines · Sunil Khatri

This reverts commit 714bbbf20a7266e48632fab466563e695af9acb5. bisected to this change which is causing the flikering issue in the UI for various apps like glxgears and unigen heaven.

Is that flickering also there when using kernel queues?

If not then without an explanation where that flickering is coming from for user queues I have to reject that.

It seems to be the right thing TODO and we are still in the process of hammering out all the bugs for user queues.

Regards,
Christian.

Quoted 24 lines

Also when we set user_queue=1, which enable both user and kernel submissions the userqueue tests in IGT also fail.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +3 -2
index d6ae9974c952..5576ed0b508f 100644
@@ -249,8 +249,9 @@ int amdgpu_sync_resv(struct amdgpu_device *adev, struct amdgpu_sync *sync,
 
 	if (resv == NULL)
 		return -EINVAL;
-	/* Implicitly sync only to KERNEL, WRITE and READ */
-	dma_resv_for_each_fence(&cursor, resv, DMA_RESV_USAGE_READ, f) {
+
+	/* TODO: Use DMA_RESV_USAGE_READ here */
+	dma_resv_for_each_fence(&cursor, resv, DMA_RESV_USAGE_BOOKKEEP, f) {
 		dma_fence_chain_for_each(f, f) {
 			struct dma_fence *tmp = dma_fence_chain_contained(f);
 
#2 lore raw

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Tuesday, May 27, 2025 2:32 PM
To: Khatri, Sunil <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] Revert "drm/amdgpu: promote the implicit sync to the dependent read fences"

Quoted 3 lines · Sunil Khatri

This reverts commit 714bbbf20a7266e48632fab466563e695af9acb5. bisected to this change which is causing the flikering issue in the UI for various apps like glxgears and unigen heaven.

Is that flickering also there when using kernel queues?

If not then without an explanation where that flickering is coming from for user queues I have to reject that.

There is more to just flickering here. We are planning to use amdgpu.user_queue=1 in our CI testing. That means both kernel and user submission are enabled. When I ran the testing amdgpu_basic tests which runs both kernel and user submissions, all the user queue tests are consistently failing. With this revert change in place all those issues are fixed, Both user and kernel queue tests pass consistently without any artifacts.

The reason of why this is helping is I am not sure of but it’s the observation which was observed earlier by Arvind too. We could investigate the probable reason of it infact Arvind is checking that but to enable CI we could revert this if you agree.

Regards
Sunil Khatri

It seems to be the right thing TODO and we are still in the process of hammering out all the bugs for user queues.

Regards,
Christian.

Quoted 26 lines

Also when we set user_queue=1, which enable both user and kernel submissions the userqueue tests in IGT also fail.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +3 -2
index d6ae9974c952..5576ed0b508f 100644
@@ -249,8 +249,9 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
 struct amdgpu_sync *sync,
 
      if (resv == NULL)
              return -EINVAL;
-     /* Implicitly sync only to KERNEL, WRITE and READ */
-     dma_resv_for_each_fence(&cursor, resv, DMA_RESV_USAGE_READ, f) {
+
+     /* TODO: Use DMA_RESV_USAGE_READ here */
+     dma_resv_for_each_fence(&cursor, resv, DMA_RESV_USAGE_BOOKKEEP, f) {
              dma_fence_chain_for_each(f, f) {
                      struct dma_fence *tmp = dma_fence_chain_contained(f);
maintainer
#3 lore raw
Quoted 13 lines · Sunil

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Tuesday, May 27, 2025 2:32 PM
To: Khatri, Sunil <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] Revert "drm/amdgpu: promote the implicit sync to the dependent read fences"

Quoted 3 lines · Sunil Khatri

This reverts commit 714bbbf20a7266e48632fab466563e695af9acb5. bisected to this change which is causing the flikering issue in the UI for various apps like glxgears and unigen heaven.

Quoted 5 lines

Is that flickering also there when using kernel queues?

If not then without an explanation where that flickering is coming from for user queues I have to reject that.

There is more to just flickering here. We are planning to use amdgpu.user_queue=1 in our CI testing. That means both kernel and user submission are enabled. When I ran the testing amdgpu_basic tests which runs both kernel and user submissions, all the user queue tests are consistently failing. With this revert change in place all those issues are fixed, Both user and kernel queue tests pass consistently without any artifacts.

That sounds like we are missing some dependency and that works only by coincident.

Quoted 1 line

The reason of why this is helping is I am not sure of but it’s the observation which was observed earlier by Arvind too. We could investigate the probable reason of it infact Arvind is checking that but to enable CI we could revert this if you agree.

I think figuring out what is missing here is more important than enabling CI.

We most likely incorrectly sync to TLB flush fences on the kernel queues now and that could not only have negative performance side effects but also hide real bugs we need to fix ASAP.

Regards,
Christian.

Quoted 36 lines

Regards
Sunil Khatri

It seems to be the right thing TODO and we are still in the process of hammering out all the bugs for user queues.

Regards,
Christian.

Quoted 26 lines

Also when we set user_queue=1, which enable both user and kernel submissions the userqueue tests in IGT also fail.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +3 -2
index d6ae9974c952..5576ed0b508f 100644
@@ -249,8 +249,9 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
 struct amdgpu_sync *sync,
 
      if (resv == NULL)
              return -EINVAL;
-     /* Implicitly sync only to KERNEL, WRITE and READ */
-     dma_resv_for_each_fence(&cursor, resv, DMA_RESV_USAGE_READ, f) {
+
+     /* TODO: Use DMA_RESV_USAGE_READ here */
+     dma_resv_for_each_fence(&cursor, resv, DMA_RESV_USAGE_BOOKKEEP, f) {
              dma_fence_chain_for_each(f, f) {
                      struct dma_fence *tmp = dma_fence_chain_contained(f);
#4 lore raw

[Public]

Quoted 41 lines

From: amd-gfx <[email protected]> On Behalf Of Christian König
Sent: Tuesday, May 27, 2025 8:24 PM
To: Khatri, Sunil <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] Revert "drm/amdgpu: promote the implicit sync to the dependent read fences"

Quoted 9 lines · Sunil

[AMD Official Use Only - AMD Internal Distribution Only]

-----Original Message-----
From: Koenig, Christian <[email protected]>
Sent: Tuesday, May 27, 2025 2:32 PM
To: Khatri, Sunil <[email protected]>; [email protected]; Deucher, Alexander <[email protected]>
Subject: Re: [PATCH] Revert "drm/amdgpu: promote the implicit sync to the

dependent read fences"

Quoted 9 lines · Sunil Khatri
Quoted 3 lines

This reverts commit 714bbbf20a7266e48632fab466563e695af9acb5. bisected to this change which is causing the flikering issue in the UI for various apps like glxgears and unigen heaven.

Is that flickering also there when using kernel queues?

If not then without an explanation where that flickering is coming from for user

queues I have to reject that.

Quoted 2 lines

There is more to just flickering here. We are planning to use

amdgpu.user_queue=1 in our CI testing. That means both kernel and user submission are enabled. When I ran the testing amdgpu_basic tests which runs both kernel and user submissions, all the user queue tests are consistently failing. With this revert change in place all those issues are fixed, Both user and kernel queue tests pass consistently without any artifacts.

That sounds like we are missing some dependency and that works only by coincident.

Quoted 1 line

The reason of why this is helping is I am not sure of but it’s the observation which

Quoted 8 lines

was observed earlier by Arvind too. We could investigate the probable reason of it infact Arvind is checking that but to enable CI we could revert this if you agree.

I think figuring out what is missing here is more important than enabling CI.

We most likely incorrectly sync to TLB flush fences on the kernel queues now and that could not only have negative performance side effects but also hide real bugs we need to fix ASAP.

Maybe there're some bookkeeping fences that miss explicit sync when the driver doesn't sync them implicitly. I will further investigate it as well. If we need to revert the patch as a workaround, we need the following https://www.spinics.net/lists/amd-gfx/msg123346.html to handle the eviction fence leakage issue.

Thanks,
Prike

Quoted 43 lines

Regards,
Christian.

Quoted 5 lines

Regards
Sunil Khatri

It seems to be the right thing TODO and we are still in the process of hammering

out all the bugs for user queues.

Quoted 20 lines

Regards,
Christian.

Quoted 16 lines

Also when we set user_queue=1, which enable both user and kernel submissions the userqueue tests in IGT also fail.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +0 -0
index d6ae9974c952..5576ed0b508f 100644
@@ -249,8 +249,9 @@ int amdgpu_sync_resv(struct amdgpu_device *adev,
 struct amdgpu_sync *sync,
 
Quoted 7 lines

drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c int amdgpu_sync_resv(struct amdgpu_device *adev, struct amdgpu_sync *sync,

Quoted 7 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +3 -2
      if (resv == NULL)
              return -EINVAL;
-     /* Implicitly sync only to KERNEL, WRITE and READ */
-     dma_resv_for_each_fence(&cursor, resv, DMA_RESV_USAGE_READ, f) {
+
+     /* TODO: Use DMA_RESV_USAGE_READ here */
+     dma_resv_for_each_fence(&cursor, resv,

DMA_RESV_USAGE_BOOKKEEP,

Quoted 6 lines
Quoted 5 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c +1 -0
+ f) {
              dma_fence_chain_for_each(f, f) {
                      struct dma_fence *tmp =

dma_fence_chain_contained(f);