提交 7d64c40a 编写于 作者: D Dmitry Osipenko 提交者: Andrey Grodzovsky

drm/scheduler: Don't kill jobs in interrupt context

Interrupt context can't sleep. Drivers like Panfrost and MSM are taking
mutex when job is released, and thus, that code can sleep. This results
into "BUG: scheduling while atomic" if locks are contented while job is
freed. There is no good reason for releasing scheduler's jobs in IRQ
context, hence use normal context to fix the trouble.

Cc: stable@vger.kernel.org
Fixes: 542cff78 ("drm/sched: Avoid lockdep spalt on killing a processes")
Signed-off-by: NDmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: NAndrey Grodzovsky <andrey.grodzovsky@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220411221536.283312-1-dmitry.osipenko@collabora.com
上级 a9ad5822
...@@ -190,7 +190,7 @@ long drm_sched_entity_flush(struct drm_sched_entity *entity, long timeout) ...@@ -190,7 +190,7 @@ long drm_sched_entity_flush(struct drm_sched_entity *entity, long timeout)
} }
EXPORT_SYMBOL(drm_sched_entity_flush); EXPORT_SYMBOL(drm_sched_entity_flush);
static void drm_sched_entity_kill_jobs_irq_work(struct irq_work *wrk) static void drm_sched_entity_kill_jobs_work(struct work_struct *wrk)
{ {
struct drm_sched_job *job = container_of(wrk, typeof(*job), work); struct drm_sched_job *job = container_of(wrk, typeof(*job), work);
...@@ -207,8 +207,8 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f, ...@@ -207,8 +207,8 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f,
struct drm_sched_job *job = container_of(cb, struct drm_sched_job, struct drm_sched_job *job = container_of(cb, struct drm_sched_job,
finish_cb); finish_cb);
init_irq_work(&job->work, drm_sched_entity_kill_jobs_irq_work); INIT_WORK(&job->work, drm_sched_entity_kill_jobs_work);
irq_work_queue(&job->work); schedule_work(&job->work);
} }
static struct dma_fence * static struct dma_fence *
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <linux/dma-fence.h> #include <linux/dma-fence.h>
#include <linux/completion.h> #include <linux/completion.h>
#include <linux/xarray.h> #include <linux/xarray.h>
#include <linux/irq_work.h> #include <linux/workqueue.h>
#define MAX_WAIT_SCHED_ENTITY_Q_EMPTY msecs_to_jiffies(1000) #define MAX_WAIT_SCHED_ENTITY_Q_EMPTY msecs_to_jiffies(1000)
...@@ -295,7 +295,7 @@ struct drm_sched_job { ...@@ -295,7 +295,7 @@ struct drm_sched_job {
*/ */
union { union {
struct dma_fence_cb finish_cb; struct dma_fence_cb finish_cb;
struct irq_work work; struct work_struct work;
}; };
uint64_t id; uint64_t id;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册