Skip to contentSkip to conversation

drm/radeon: Add a rmb() in IH processing

PATCH In review Benjamin Herrenschmidt 4 participants 7 messages Jul 13, 2011 – Jul 15, 2011 1 message not in the archive

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

PATCH 4/6 drm/radeon: Add a rmb() in IH processing

We should have a read memory barrier between reading the WPTR from memory and reading ring entries based on that value (ie, we need to ensure both loads are done in order by the CPU).

It could be argued that the MMIO reads in r600_ack_irq() might be enough to get that barrier but I prefer keeping an explicit one just in case.

---

(resent adding dri-devel to the CC list to hit patchwork)

drivers/gpu/drm/radeon/r600.c | 3 +++

 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600.c +3 -0
index 3c86b15..7e5c801 100644
@@ -3312,6 +3312,9 @@ int r600_irq_process(struct radeon_device *rdev)
 	}
 
 restart_ih:
+	/* Order reading of wptr vs. reading of IH ring data */
+	wmb();
+
 	/* display interrupts */
 	r600_irq_ack(rdev);
Reviewed-by on v1 4/6
#1 lore raw
Quoted 9 lines · Benjamin Herrenschmidt

We should have a read memory barrier between reading the WPTR from memory and reading ring entries based on that value (ie, we need to ensure both loads are done in order by the CPU).

It could be argued that the MMIO reads in r600_ack_irq() might be enough to get that barrier but I prefer keeping an explicit one just in case.

Quoted 25 lines

---

(resent adding dri-devel to the CC list to hit patchwork)

drivers/gpu/drm/radeon/r600.c |    3 +++

 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600.c +0 -0
index 3c86b15..7e5c801 100644
@@ -3312,6 +3312,9 @@ int r600_irq_process(struct radeon_device *rdev)
        }
 

 restart_ih:
+       /* Order reading of wptr vs. reading of IH ring data */
+       wmb();
+
       /* display interrupts */
       r600_irq_ack(rdev);

#2 lore raw
Quoted 6 lines · Alex Deucher
Quoted 4 lines · Benjamin Herrenschmidt

We should have a read memory barrier between reading the WPTR from memory and reading ring entries based on that value (ie, we need to ensure both loads are done in order by the CPU).

Quoted 7 lines
Quoted 5 lines

It could be argued that the MMIO reads in r600_ack_irq() might be enough to get that barrier but I prefer keeping an explicit one just in case.

evergreen.c will need a similar fix.

Alex

Quoted 27 lines
Quoted 26 lines

---

(resent adding dri-devel to the CC list to hit patchwork)

drivers/gpu/drm/radeon/r600.c |    3 +++

 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600.c +0 -0
index 3c86b15..7e5c801 100644
@@ -3312,6 +3312,9 @@ int r600_irq_process(struct radeon_device *rdev)
        }
 

 restart_ih:
+       /* Order reading of wptr vs. reading of IH ring data */
+       wmb();
+
       /* display interrupts */
       r600_irq_ack(rdev);

#4 lore raw
In reply to a message not in the archive
Quoted 11 lines · Alex Deucher
Quoted 10 lines · Alex Deucher
Quoted 8 lines · Benjamin Herrenschmidt

We should have a read memory barrier between reading the WPTR from memory and reading ring entries based on that value (ie, we need to ensure both loads are done in order by the CPU).

It could be argued that the MMIO reads in r600_ack_irq() might be enough to get that barrier but I prefer keeping an explicit one just in case.

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

evergreen.c will need a similar fix.

Ok. I can do that.

Cheers,
Ben.

Quoted 29 lines

Alex

Quoted 27 lines
Quoted 26 lines

---

(resent adding dri-devel to the CC list to hit patchwork)

drivers/gpu/drm/radeon/r600.c | 3 +++

 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600.c +3 -0
index 3c86b15..7e5c801 100644
@@ -3312,6 +3312,9 @@ int r600_irq_process(struct radeon_device *rdev)
       }
 
 restart_ih:
+       /* Order reading of wptr vs. reading of IH ring data */
+       wmb();
+
       /* display interrupts */
       r600_irq_ack(rdev);
 
#5 lore raw
Quoted 12 lines · Benjamin Herrenschmidt
Quoted 11 lines · Alex Deucher
Quoted 10 lines · Alex Deucher
Quoted 8 lines · Benjamin Herrenschmidt

We should have a read memory barrier between reading the WPTR from memory and reading ring entries based on that value (ie, we need to ensure both loads are done in order by the CPU).

It could be argued that the MMIO reads in r600_ack_irq() might be enough to get that barrier but I prefer keeping an explicit one just in case.

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

evergreen.c will need a similar fix.

Ok. I can do that.

Thanks!

Quoted 36 lines

Cheers,
Ben.

Quoted 29 lines

Alex

Quoted 27 lines
Quoted 26 lines

---

(resent adding dri-devel to the CC list to hit patchwork)

drivers/gpu/drm/radeon/r600.c |    3 +++

 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600.c +0 -0
index 3c86b15..7e5c801 100644
@@ -3312,6 +3312,9 @@ int r600_irq_process(struct radeon_device *rdev)
        }
 

 restart_ih:
+       /* Order reading of wptr vs. reading of IH ring data */
+       wmb();
+
       /* display interrupts */
       r600_irq_ack(rdev);

#6 lore raw
In reply to Benjamin Herrenschmidt
Quoted 23 lines · Benjamin Herrenschmidt

We should have a read memory barrier between reading the WPTR from memory and reading ring entries based on that value (ie, we need to ensure both loads are done in order by the CPU).

It could be argued that the MMIO reads in r600_ack_irq() might be enough to get that barrier but I prefer keeping an explicit one just in case.

---

(resent adding dri-devel to the CC list to hit patchwork)

drivers/gpu/drm/radeon/r600.c |    3 +++

 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600.c +0 -0
index 3c86b15..7e5c801 100644
@@ -3312,6 +3312,9 @@ int r600_irq_process(struct radeon_device *rdev)
        }
 
Quoted 6 lines

 restart_ih:
+       /* Order reading of wptr vs. reading of IH ring data */
+       wmb();
+
       /* display interrupts */
       r600_irq_ack(rdev);

The subject line says rmb(), but this says wmb(). Just want to verify what you have is correct.

Matt

#7 lore raw
Quoted 25 lines · Matt Turner
Quoted 23 lines · Benjamin Herrenschmidt

We should have a read memory barrier between reading the WPTR from memory and reading ring entries based on that value (ie, we need to ensure both loads are done in order by the CPU).

It could be argued that the MMIO reads in r600_ack_irq() might be enough to get that barrier but I prefer keeping an explicit one just in case.

---

(resent adding dri-devel to the CC list to hit patchwork)

drivers/gpu/drm/radeon/r600.c | 3 +++

 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/r600.c +0 -0
index 3c86b15..7e5c801 100644
@@ -3312,6 +3312,9 @@ int r600_irq_process(struct radeon_device *rdev)
       }
 
Quoted 9 lines

drivers/gpu/drm/radeon/r600.c int r600_irq_process(struct radeon_device *rdev) · line 3319

Quoted 6 lines
drivers/gpu/drm/radeon/r600.c +3 -0
 restart_ih:
+       /* Order reading of wptr vs. reading of IH ring data */
+       wmb();
+
       /* display interrupts */
       r600_irq_ack(rdev);

The subject line says rmb(), but this says wmb(). Just want to verify what you have is correct.

Nice spotting, it's a typo and should have been rmb(). I'll fix it and respin.

Cheers,
Ben