sna: Treat external bo carefully when marking as idle

When we flag a bo as being externally modified, we set a special flag on
its request pointer. This forces us to inspect whether the bo is busy
before accessing it the next, and if it is idle, we must be careful that
we then do not dereference the special request.

Fixes regression from
commit 9115406b65
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Thu Oct 30 19:21:02 2014 +0000

    sna: Retire all requests when a bo is found to be not busy

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2014-10-31 20:38:40 +00:00
parent 122f606560
commit cc3b8a542e
2 changed files with 8 additions and 4 deletions

View File

@ -2704,13 +2704,17 @@ bool __kgem_ring_is_idle(struct kgem *kgem, int ring)
return true;
}
void __kgem_retire_requests_upto(struct kgem *kgem, struct kgem_request *rq)
void __kgem_retire_requests_upto(struct kgem *kgem, struct kgem_bo *bo)
{
struct kgem_request *rq = bo->rq, *tmp;
struct list *requests = &kgem->requests[RQ_RING(rq) == I915_EXEC_BLT];
struct kgem_request *tmp;
rq = RQ(rq);
assert(rq != &kgem->static_request);
if (rq == (struct kgem_request *)kgem) {
__kgem_bo_clear_busy(bo);
return;
}
do {
tmp = list_first_entry(requests, struct kgem_request, list);

View File

@ -618,7 +618,7 @@ static inline bool kgem_bo_is_busy(struct kgem_bo *bo)
return bo->rq;
}
void __kgem_retire_requests_upto(struct kgem *kgem, struct kgem_request *rq);
void __kgem_retire_requests_upto(struct kgem *kgem, struct kgem_bo *bo);
static inline bool __kgem_bo_is_busy(struct kgem *kgem, struct kgem_bo *bo)
{
DBG(("%s: handle=%d, domain: %d exec? %d, rq? %d\n", __FUNCTION__,
@ -629,7 +629,7 @@ static inline bool __kgem_bo_is_busy(struct kgem *kgem, struct kgem_bo *bo)
return true;
if (bo->rq && !__kgem_busy(kgem, bo->handle)) {
__kgem_retire_requests_upto(kgem, bo->rq);
__kgem_retire_requests_upto(kgem, bo);
assert(list_is_empty(&bo->request));
assert(bo->rq == NULL);
assert(bo->domain == DOMAIN_NONE);