Skip to content

Commit 9b04369

Browse files
digetxAndrey Grodzovsky
authored andcommitted
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: 542cff7 ("drm/sched: Avoid lockdep spalt on killing a processes") Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com> Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/20220411221536.283312-1-dmitry.osipenko@collabora.com
1 parent 925b6e5 commit 9b04369

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

drivers/gpu/drm/scheduler/sched_entity.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ long drm_sched_entity_flush(struct drm_sched_entity *entity, long timeout)
190190
}
191191
EXPORT_SYMBOL(drm_sched_entity_flush);
192192

193-
static void drm_sched_entity_kill_jobs_irq_work(struct irq_work *wrk)
193+
static void drm_sched_entity_kill_jobs_work(struct work_struct *wrk)
194194
{
195195
struct drm_sched_job *job = container_of(wrk, typeof(*job), work);
196196

@@ -207,8 +207,8 @@ static void drm_sched_entity_kill_jobs_cb(struct dma_fence *f,
207207
struct drm_sched_job *job = container_of(cb, struct drm_sched_job,
208208
finish_cb);
209209

210-
init_irq_work(&job->work, drm_sched_entity_kill_jobs_irq_work);
211-
irq_work_queue(&job->work);
210+
INIT_WORK(&job->work, drm_sched_entity_kill_jobs_work);
211+
schedule_work(&job->work);
212212
}
213213

214214
static struct dma_fence *

include/drm/gpu_scheduler.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
#include <linux/dma-fence.h>
2929
#include <linux/completion.h>
3030
#include <linux/xarray.h>
31-
#include <linux/irq_work.h>
31+
#include <linux/workqueue.h>
3232

3333
#define MAX_WAIT_SCHED_ENTITY_Q_EMPTY msecs_to_jiffies(1000)
3434

@@ -295,7 +295,7 @@ struct drm_sched_job {
295295
*/
296296
union {
297297
struct dma_fence_cb finish_cb;
298-
struct irq_work work;
298+
struct work_struct work;
299299
};
300300

301301
uint64_t id;

0 commit comments

Comments
 (0)