mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-02-22 03:00:19 +07:00
drm/i915/gt: Flush ongoing retires during wait_for_idle
Synchronise with any background retires and parking we may have spawned, so that all requests are accounted for. Closes: https://gitlab.freedesktop.org/drm/intel/issues/878 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Andi Shyti <andi.shyti@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200102231604.1669010-1-chris@chris-wilson.co.uk
This commit is contained in:
parent
9dae9e5381
commit
cdd280b1b9
@ -26,18 +26,22 @@ static bool retire_requests(struct intel_timeline *tl)
|
|||||||
return !i915_active_fence_isset(&tl->last_request);
|
return !i915_active_fence_isset(&tl->last_request);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void flush_submission(struct intel_gt *gt)
|
static bool flush_submission(struct intel_gt *gt)
|
||||||
{
|
{
|
||||||
struct intel_engine_cs *engine;
|
struct intel_engine_cs *engine;
|
||||||
enum intel_engine_id id;
|
enum intel_engine_id id;
|
||||||
|
bool active = false;
|
||||||
|
|
||||||
if (!intel_gt_pm_is_awake(gt))
|
if (!intel_gt_pm_is_awake(gt))
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
for_each_engine(engine, gt, id) {
|
for_each_engine(engine, gt, id) {
|
||||||
intel_engine_flush_submission(engine);
|
intel_engine_flush_submission(engine);
|
||||||
flush_work(&engine->retire_work);
|
active |= flush_work(&engine->retire_work);
|
||||||
|
active |= flush_work(&engine->wakeref.work);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return active;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void engine_retire(struct work_struct *work)
|
static void engine_retire(struct work_struct *work)
|
||||||
@ -147,9 +151,9 @@ long intel_gt_retire_requests_timeout(struct intel_gt *gt, long timeout)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
active_count += !retire_requests(tl);
|
if (!retire_requests(tl) || flush_submission(gt))
|
||||||
|
active_count++;
|
||||||
|
|
||||||
flush_submission(gt); /* sync with concurrent retirees */
|
|
||||||
spin_lock(&timelines->lock);
|
spin_lock(&timelines->lock);
|
||||||
|
|
||||||
/* Resume iteration after dropping lock */
|
/* Resume iteration after dropping lock */
|
||||||
|
@ -95,16 +95,17 @@ static void __intel_wakeref_put_work(struct work_struct *wrk)
|
|||||||
void __intel_wakeref_init(struct intel_wakeref *wf,
|
void __intel_wakeref_init(struct intel_wakeref *wf,
|
||||||
struct intel_runtime_pm *rpm,
|
struct intel_runtime_pm *rpm,
|
||||||
const struct intel_wakeref_ops *ops,
|
const struct intel_wakeref_ops *ops,
|
||||||
struct lock_class_key *key)
|
struct intel_wakeref_lockclass *key)
|
||||||
{
|
{
|
||||||
wf->rpm = rpm;
|
wf->rpm = rpm;
|
||||||
wf->ops = ops;
|
wf->ops = ops;
|
||||||
|
|
||||||
__mutex_init(&wf->mutex, "wakeref", key);
|
__mutex_init(&wf->mutex, "wakeref.mutex", &key->mutex);
|
||||||
atomic_set(&wf->count, 0);
|
atomic_set(&wf->count, 0);
|
||||||
wf->wakeref = 0;
|
wf->wakeref = 0;
|
||||||
|
|
||||||
INIT_WORK(&wf->work, __intel_wakeref_put_work);
|
INIT_WORK(&wf->work, __intel_wakeref_put_work);
|
||||||
|
lockdep_init_map(&wf->work.lockdep_map, "wakeref.work", &key->work, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int intel_wakeref_wait_for_idle(struct intel_wakeref *wf)
|
int intel_wakeref_wait_for_idle(struct intel_wakeref *wf)
|
||||||
|
@ -44,12 +44,17 @@ struct intel_wakeref {
|
|||||||
struct work_struct work;
|
struct work_struct work;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct intel_wakeref_lockclass {
|
||||||
|
struct lock_class_key mutex;
|
||||||
|
struct lock_class_key work;
|
||||||
|
};
|
||||||
|
|
||||||
void __intel_wakeref_init(struct intel_wakeref *wf,
|
void __intel_wakeref_init(struct intel_wakeref *wf,
|
||||||
struct intel_runtime_pm *rpm,
|
struct intel_runtime_pm *rpm,
|
||||||
const struct intel_wakeref_ops *ops,
|
const struct intel_wakeref_ops *ops,
|
||||||
struct lock_class_key *key);
|
struct intel_wakeref_lockclass *key);
|
||||||
#define intel_wakeref_init(wf, rpm, ops) do { \
|
#define intel_wakeref_init(wf, rpm, ops) do { \
|
||||||
static struct lock_class_key __key; \
|
static struct intel_wakeref_lockclass __key; \
|
||||||
\
|
\
|
||||||
__intel_wakeref_init((wf), (rpm), (ops), &__key); \
|
__intel_wakeref_init((wf), (rpm), (ops), &__key); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
Loading…
Reference in New Issue
Block a user