Skip to contentSkip to conversation

drm/radeon: drop register readback in cayman_cp_int_cntl_setup

PATCH Applied Lucas Stach 3 participants 4 messages Oct 24, 2016 – Oct 25, 2016

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

PATCH 1/1 drm/radeon: drop register readback in cayman_cp_int_cntl_setup

The read is taking a considerable amount of time (about 50us on this machine). The register does not ever hold anything other than the ring ID that is updated in this exact function, so there is no need for the read modify write cycle.

This chops off a big chunk of the time spent in hardirq disabled context, as this function is called multiple times in the interrupt handler. With this change applied radeon won't show up in the list of the worst IRQ latency offenders anymore, where it was a regular before.

---
 drivers/gpu/drm/radeon/ni.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/radeon/ni.c +1 -3
index 103fc86..a0d4a05 100644
@@ -1396,9 +1396,7 @@ static void cayman_pcie_gart_fini(struct radeon_device *rdev)
 void cayman_cp_int_cntl_setup(struct radeon_device *rdev,
 			      int ring, u32 cp_int_cntl)
 {
-	u32 srbm_gfx_cntl = RREG32(SRBM_GFX_CNTL) & ~3;
-
-	WREG32(SRBM_GFX_CNTL, srbm_gfx_cntl | (ring & 3));
+	WREG32(SRBM_GFX_CNTL, RINGID(ring));
 	WREG32(CP_INT_CNTL, cp_int_cntl);
 }
 
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer
#1 lore raw

Am 24.10.2016 um 23:32 schrieb Lucas Stach:

Quoted 5 lines

The read is taking a considerable amount of time (about 50us on this machine). The register does not ever hold anything other than the ring ID that is updated in this exact function, so there is no need for the read modify write cycle.

Quoted 7 lines

This chops off a big chunk of the time spent in hardirq disabled context, as this function is called multiple times in the interrupt handler. With this change applied radeon won't show up in the list of the worst IRQ latency offenders anymore, where it was a regular before.

Ups, and to make it even worse SRBM_GFX_CNTL is explicitly documented to be a write only register.

That it takes a considerable amount of time is probably because the SRBM runs into an error condition when you read it.

So patch is Reviewed-by: Christian König <[email protected]> and please also add a CC:stable on that.

Do we have other occasions where we try to use a read modify write cycle?

Regards,
Christian.

Quoted 9 lines
---
  drivers/gpu/drm/radeon/ni.c | 4 +---
  1 file changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/radeon/ni.c +0 -0
index 103fc86..a0d4a05 100644

drivers/gpu/drm/radeon/ni.c static void cayman_pcie_gart_fini(struct radeon_device *rdev) · line 1402

Quoted 10 lines
drivers/gpu/drm/radeon/ni.c +1 -3
@@ -1396,9 +1396,7 @@ static void cayman_pcie_gart_fini(struct radeon_device *rdev)
  void cayman_cp_int_cntl_setup(struct radeon_device *rdev,
  			      int ring, u32 cp_int_cntl)
  {
-	u32 srbm_gfx_cntl = RREG32(SRBM_GFX_CNTL) & ~3;
-
-	WREG32(SRBM_GFX_CNTL, srbm_gfx_cntl | (ring & 3));
+	WREG32(SRBM_GFX_CNTL, RINGID(ring));
  	WREG32(CP_INT_CNTL, cp_int_cntl);
  }
 

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Am Dienstag, den 25.10.2016, 09:21 +0200 schrieb Christian König:

Quoted 25 lines

Am 24.10.2016 um 23:32 schrieb Lucas Stach:

Quoted 8 lines

The read is taking a considerable amount of time (about 50us on this
machine). The register does not ever hold anything other than the ring
ID that is updated in this exact function, so there is no need for the read modify write cycle.

Quoted 7 lines

This chops off a big chunk of the time spent in hardirq disabled context, as this function is called multiple times in the interrupt handler. With this change applied radeon won't show up in the list of the worst IRQ latency offenders anymore, where it was a regular before.

Ups, and to make it even worse SRBM_GFX_CNTL is explicitly documented to
be a write only register.

That it takes a considerable amount of time is probably because the SRBM
runs into an error condition when you read it.

Quoted 6 lines

So patch is Reviewed-by: Christian König <[email protected]> and
please also add a CC:stable on that.

Do we have other occasions where we try to use a read modify write cycle?

No, that's the only occasion where this specific register is read back (including newer generations that use it like cik).

Regards,
Lucas
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Applied
#3 lore raw
Quoted 30 lines · Lucas Stach

Am Dienstag, den 25.10.2016, 09:21 +0200 schrieb Christian König:

Quoted 29 lines

Am 24.10.2016 um 23:32 schrieb Lucas Stach:

Quoted 8 lines

The read is taking a considerable amount of time (about 50us on this
machine). The register does not ever hold anything other than the ring
ID that is updated in this exact function, so there is no need for the read modify write cycle.

Quoted 7 lines

This chops off a big chunk of the time spent in hardirq disabled context, as this function is called multiple times in the interrupt handler. With this change applied radeon won't show up in the list of the worst IRQ latency offenders anymore, where it was a regular before.

Ups, and to make it even worse SRBM_GFX_CNTL is explicitly documented to
be a write only register.

That it takes a considerable amount of time is probably because the SRBM
runs into an error condition when you read it.

So patch is Reviewed-by: Christian König <[email protected]> and
please also add a CC:stable on that.

Quoted 6 lines
Quoted 2 lines

Do we have other occasions where we try to use a read modify write cycle?

No, that's the only occasion where this specific register is read back (including newer generations that use it like cik).

Applied, including cc to stable.

Thanks,

Alex
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel