Skip to contentSkip to conversation

drm/radeon: fix irq ring buffer overflow handling

PATCH Applied Christian König 3 participants 4 messages Jul 23, 2014

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

PATCH 1/1 drm/radeon: fix irq ring buffer overflow handling

From: Christian König <[email protected]>

We must mask out the overflow bit as well, otherwise the wptr will never match the rptr again and the interrupt handler will loop forever.

---
 drivers/gpu/drm/radeon/cik.c       | 1 +
 drivers/gpu/drm/radeon/evergreen.c | 1 +
 drivers/gpu/drm/radeon/r600.c      | 1 +
 drivers/gpu/drm/radeon/si.c        | 1 +
 4 files changed, 4 insertions(+)
drivers/gpu/drm/radeon/cik.c +1 -0
index 0b24711..cc1f02f 100644
@@ -7376,6 +7376,7 @@ static inline u32 cik_get_ih_wptr(struct radeon_device *rdev)
 		tmp = RREG32(IH_RB_CNTL);
 		tmp |= IH_WPTR_OVERFLOW_CLEAR;
 		WREG32(IH_RB_CNTL, tmp);
+		wptr &= ~RB_OVERFLOW;
 	}
 	return (wptr & rdev->ih.ptr_mask);
 }
drivers/gpu/drm/radeon/evergreen.c +1 -0
index 250bac3..15e4f28 100644
@@ -4756,6 +4756,7 @@ static u32 evergreen_get_ih_wptr(struct radeon_device *rdev)
 		tmp = RREG32(IH_RB_CNTL);
 		tmp |= IH_WPTR_OVERFLOW_CLEAR;
 		WREG32(IH_RB_CNTL, tmp);
+		wptr &= ~RB_OVERFLOW;
 	}
 	return (wptr & rdev->ih.ptr_mask);
 }
drivers/gpu/drm/radeon/r600.c +1 -0
index c66952d..3c69f58 100644
@@ -3795,6 +3795,7 @@ static u32 r600_get_ih_wptr(struct radeon_device *rdev)
 		tmp = RREG32(IH_RB_CNTL);
 		tmp |= IH_WPTR_OVERFLOW_CLEAR;
 		WREG32(IH_RB_CNTL, tmp);
+		wptr &= ~RB_OVERFLOW;
 	}
 	return (wptr & rdev->ih.ptr_mask);
 }
drivers/gpu/drm/radeon/si.c +1 -0
index eba0225..9e854fd 100644
@@ -6103,6 +6103,7 @@ static inline u32 si_get_ih_wptr(struct radeon_device *rdev)
 		tmp = RREG32(IH_RB_CNTL);
 		tmp |= IH_WPTR_OVERFLOW_CLEAR;
 		WREG32(IH_RB_CNTL, tmp);
+		wptr &= ~RB_OVERFLOW;
 	}
 	return (wptr & rdev->ih.ptr_mask);
 }
Signature · 6 lines
1.9.1

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Christian König

From: Christian König <[email protected]>

We must mask out the overflow bit as well, otherwise the wptr will never match the rptr again and the interrupt handler will loop forever.

Quoted 1 line

Not sure this is justified though. Were you able to reproduce the problem and verify the fix?

Signature · 6 lines
Earthling Michel Dänzer            |                  http://www.amd.com
Libre software enthusiast          |                Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Am 23.07.2014 11:07, schrieb Michel Dänzer:

Quoted 7 lines · Christian König
Quoted 6 lines

From: Christian König <[email protected]>

We must mask out the overflow bit as well, otherwise the wptr will never match the rptr again and the interrupt handler will loop forever.

Quoted 7 lines
Quoted 1 line
Quoted 1 line

Not sure this is justified though. Were you able to reproduce the problem and verify the fix?

Not yet, reproducing ring buffer overflows aren't easy to do. But I've had that multiple times with CIK and userptr support work and I can try if I can reproduce it once more.

From reading the code it looks like a rather fundamental problem to me and because of this I've added the stable Cc.

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

Applied
#3 lore raw
In reply to Christian König
Quoted 8 lines · Christian König

From: Christian König <[email protected]>

We must mask out the overflow bit as well, otherwise the wptr will never match the rptr again and the interrupt handler will loop forever.

Applied to my 3.16 tree. Thanks!

Alex

Quoted 56 lines
---
 drivers/gpu/drm/radeon/cik.c       | 1 +
 drivers/gpu/drm/radeon/evergreen.c | 1 +
 drivers/gpu/drm/radeon/r600.c      | 1 +
 drivers/gpu/drm/radeon/si.c        | 1 +
 4 files changed, 4 insertions(+)
drivers/gpu/drm/radeon/cik.c +1 -0
index 0b24711..cc1f02f 100644
@@ -7376,6 +7376,7 @@ static inline u32 cik_get_ih_wptr(struct radeon_device *rdev)
                tmp = RREG32(IH_RB_CNTL);
                tmp |= IH_WPTR_OVERFLOW_CLEAR;
                WREG32(IH_RB_CNTL, tmp);
+               wptr &= ~RB_OVERFLOW;
        }
        return (wptr & rdev->ih.ptr_mask);
 }
drivers/gpu/drm/radeon/evergreen.c +1 -0
index 250bac3..15e4f28 100644
@@ -4756,6 +4756,7 @@ static u32 evergreen_get_ih_wptr(struct radeon_device *rdev)
                tmp = RREG32(IH_RB_CNTL);
                tmp |= IH_WPTR_OVERFLOW_CLEAR;
                WREG32(IH_RB_CNTL, tmp);
+               wptr &= ~RB_OVERFLOW;
        }
        return (wptr & rdev->ih.ptr_mask);
 }
drivers/gpu/drm/radeon/r600.c +1 -0
index c66952d..3c69f58 100644
@@ -3795,6 +3795,7 @@ static u32 r600_get_ih_wptr(struct radeon_device *rdev)
                tmp = RREG32(IH_RB_CNTL);
                tmp |= IH_WPTR_OVERFLOW_CLEAR;
                WREG32(IH_RB_CNTL, tmp);
+               wptr &= ~RB_OVERFLOW;
        }
        return (wptr & rdev->ih.ptr_mask);
 }
drivers/gpu/drm/radeon/si.c +1 -1
index eba0225..9e854fd 100644
@@ -6103,6 +6103,7 @@ static inline u32 si_get_ih_wptr(struct radeon_device *rdev)
                tmp = RREG32(IH_RB_CNTL);
                tmp |= IH_WPTR_OVERFLOW_CLEAR;
                WREG32(IH_RB_CNTL, tmp);
+               wptr &= ~RB_OVERFLOW;
        }
        return (wptr & rdev->ih.ptr_mask);
 }
--
Quoted 2 lines

1.9.1

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