[PATCH 1/2] drm/radeon: improve ring lockup detection code (original) (raw)
Alex Deucher alexdeucher at gmail.com
Tue Feb 18 10:39:21 PST 2014
- Previous message: [PATCH 2/2] drm/radeon: cleanup the fence ring locking code
- Next message: [pull] radeon drm-next-3.15
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Tue, Feb 18, 2014 at 11:52 AM, Christian König <deathsimple at vodafone.de> wrote:
From: Christian König <christian.koenig at amd.com>
Use atomics and jiffies64, so that we don't need to have the ring mutex locked any more and avoid wrap arounds. Signed-off-by: Christian König <christian.koenig at amd.com>
Series is:
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>
--- drivers/gpu/drm/radeon/radeon.h | 4 ++-- drivers/gpu/drm/radeon/radeonring.c | 21 +++++++++------------ 2 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index a415f8e..9269413 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h @@ -802,8 +802,8 @@ struct radeonring { unsigned ringsize; unsigned ringfreedw; int countdw; - unsigned long lastactivity; - unsigned lastrptr; + atomict lastrptr; + atomic64t lastactivity; uint64t gpuaddr; uint32t alignmask; uint32t ptrmask; diff --git a/drivers/gpu/drm/radeon/radeonring.c b/drivers/gpu/drm/radeon/radeonring.c index b14c86d..ae72108 100644 --- a/drivers/gpu/drm/radeon/radeonring.c +++ b/drivers/gpu/drm/radeon/radeonring.c @@ -485,8 +485,8 @@ void radeonringunlockundo(struct radeondevice *rdev, struct radeonring *rin void radeonringlockupupdate(struct radeondevice *rdev, struct radeonring *ring) { - ring->lastrptr = radeonringgetrptr(rdev, ring); - ring->lastactivity = jiffies; + atomicset(&ring->lastrptr, radeonringgetrptr(rdev, ring)); + atomic64set(&ring->lastactivity, jiffies64); } /** @@ -498,22 +498,19 @@ void radeonringlockupupdate(struct radeondevice *rdev, bool radeonringtestlockup(struct radeondevice *rdev, struct radeonring *ring) { uint32t rptr = radeonringgetrptr(rdev, ring); - unsigned long cjiffies, elapsed; + uint64t last = atomic64read(&ring->lastactivity); + uint64t elapsed; - cjiffies = jiffies; - if (!timeafter(cjiffies, ring->lastactivity)) { - /* likely a wrap around */ - radeonringlockupupdate(rdev, ring); - return false; - } - if (rptr != ring->lastrptr) { + if (rptr != atomicread(&ring->lastrptr)) { /* CP is still working no lockup */ radeonringlockupupdate(rdev, ring); return false; } - elapsed = jiffiestomsecs(cjiffies - ring->lastactivity); + + elapsed = jiffiestomsecs(jiffies64 - last); if (radeonlockuptimeout && elapsed >= radeonlockuptimeout) { - deverr(rdev->dev, "GPU lockup CP stall for more than %lumsec\n", elapsed); + deverr(rdev->dev, "GPU lockup ring %d stall for more " + "than %Lumsec\n", ring->idx, elapsed); return true; } /* give a chance to the GPU ... */ -- 1.8.3.2
dri-devel mailing list dri-devel at lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/dri-devel
- Previous message: [PATCH 2/2] drm/radeon: cleanup the fence ring locking code
- Next message: [pull] radeon drm-next-3.15
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]