Commit aa202367 authored by Tomeu Vizoso's avatar Tomeu Vizoso Committed by Rob Herring

drm/panfrost: Prevent concurrent resets

If a job times out in slot 0 while a reset is performed because a job
timed out in slot 1, the drm-sched core can get into a deadlock.
Signed-off-by: default avatarTomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20190418084305.45021-1-tomeu.vizoso@collabora.com
parent db594ba3
...@@ -98,6 +98,7 @@ int panfrost_device_init(struct panfrost_device *pfdev) ...@@ -98,6 +98,7 @@ int panfrost_device_init(struct panfrost_device *pfdev)
struct resource *res; struct resource *res;
mutex_init(&pfdev->sched_lock); mutex_init(&pfdev->sched_lock);
mutex_init(&pfdev->reset_lock);
INIT_LIST_HEAD(&pfdev->scheduled_jobs); INIT_LIST_HEAD(&pfdev->scheduled_jobs);
spin_lock_init(&pfdev->hwaccess_lock); spin_lock_init(&pfdev->hwaccess_lock);
......
...@@ -78,6 +78,7 @@ struct panfrost_device { ...@@ -78,6 +78,7 @@ struct panfrost_device {
struct list_head scheduled_jobs; struct list_head scheduled_jobs;
struct mutex sched_lock; struct mutex sched_lock;
struct mutex reset_lock;
struct { struct {
struct devfreq *devfreq; struct devfreq *devfreq;
......
...@@ -384,6 +384,8 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) ...@@ -384,6 +384,8 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job)
job_read(pfdev, JS_TAIL_LO(js)), job_read(pfdev, JS_TAIL_LO(js)),
sched_job); sched_job);
mutex_lock(&pfdev->reset_lock);
for (i = 0; i < NUM_JOB_SLOTS; i++) for (i = 0; i < NUM_JOB_SLOTS; i++)
drm_sched_stop(&pfdev->js->queue[i].sched); drm_sched_stop(&pfdev->js->queue[i].sched);
...@@ -406,6 +408,8 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job) ...@@ -406,6 +408,8 @@ static void panfrost_job_timedout(struct drm_sched_job *sched_job)
/* restart scheduler after GPU is usable again */ /* restart scheduler after GPU is usable again */
for (i = 0; i < NUM_JOB_SLOTS; i++) for (i = 0; i < NUM_JOB_SLOTS; i++)
drm_sched_start(&pfdev->js->queue[i].sched, true); drm_sched_start(&pfdev->js->queue[i].sched, true);
mutex_unlock(&pfdev->reset_lock);
} }
static const struct drm_sched_backend_ops panfrost_sched_ops = { static const struct drm_sched_backend_ops panfrost_sched_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment