mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Price <steven.price@arm.com>
To: Dmitry Osipenko <dmitry.osipenko@collabora.com>,
	David Airlie <airlied@linux.ie>, Daniel Vetter <daniel@ffwll.ch>,
	Tomeu Vizoso <tomeu.vizoso@collabora.com>,
	Rob Herring <robh@kernel.org>,
	Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>,
	Rob Clark <robdclark@gmail.com>,
	Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	Dmitry Osipenko <digetx@gmail.com>
Subject: Re: [PATCH v1] drm/scheduler: Don't kill jobs in interrupt context
Date: Wed, 13 Apr 2022 11:04:56 +0100	[thread overview]
Message-ID: <a78343c8-2a6d-b223-4219-6b6b0a4fcb1f@arm.com> (raw)
In-Reply-To: <20220411221536.283312-1-dmitry.osipenko@collabora.com>

On 11/04/2022 23:15, Dmitry Osipenko wrote:
> 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: 542cff7893a3 ("drm/sched: Avoid lockdep spalt on killing a processes")
> Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>

Reviewed-by: Steven Price <steven.price@arm.com>

> ---
>  drivers/gpu/drm/scheduler/sched_entity.c | 6 +++---
>  include/drm/gpu_scheduler.h              | 4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
> index 191c56064f19..6b25b2f4f5a3 100644
> --- a/drivers/gpu/drm/scheduler/sched_entity.c
> +++ b/drivers/gpu/drm/scheduler/sched_entity.c
> @@ -190,7 +190,7 @@ long drm_sched_entity_flush(struct drm_sched_entity *entity, long timeout)
>  }
>  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);
>  
> @@ -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,
>  						 finish_cb);
>  
> -	init_irq_work(&job->work, drm_sched_entity_kill_jobs_irq_work);
> -	irq_work_queue(&job->work);
> +	INIT_WORK(&job->work, drm_sched_entity_kill_jobs_work);
> +	schedule_work(&job->work);
>  }
>  
>  static struct dma_fence *
> diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h
> index 0fca8f38bee4..addb135eeea6 100644
> --- a/include/drm/gpu_scheduler.h
> +++ b/include/drm/gpu_scheduler.h
> @@ -28,7 +28,7 @@
>  #include <linux/dma-fence.h>
>  #include <linux/completion.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)
>  
> @@ -295,7 +295,7 @@ struct drm_sched_job {
>  	 */
>  	union {
>  		struct dma_fence_cb		finish_cb;
> -		struct irq_work 		work;
> +		struct work_struct 		work;
>  	};
>  
>  	uint64_t			id;


  parent reply	other threads:[~2022-04-13 10:05 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-11 22:15 Dmitry Osipenko
2022-04-12 16:51 ` Andrey Grodzovsky
2022-04-12 18:20   ` Dmitry Osipenko
2022-04-12 19:40     ` Andrey Grodzovsky
2022-04-12 19:55       ` Dmitry Osipenko
2022-04-12 22:59       ` Erico Nunes
2022-04-13  6:05         ` Dmitry Osipenko
2022-04-13  9:45           ` Erico Nunes
2022-04-13 10:04 ` Steven Price [this message]
2022-05-17  7:40   ` Erico Nunes
2022-05-17  9:03     ` Dmitry Osipenko
2022-05-17 14:03       ` Andrey Grodzovsky
2022-05-17 14:13         ` Andrey Grodzovsky
2022-05-17 14:48           ` Dmitry Osipenko
2022-07-06  7:07             ` Dmitry Osipenko
2022-07-06 13:49               ` Andrey Grodzovsky
2022-07-06 14:57                 ` Dmitry Osipenko
2022-07-06 15:46                 ` Alex Deucher
2022-07-12  8:56                   ` Dmitry Osipenko
2022-07-14  9:57                     ` Dmitry Osipenko
2022-07-14 14:14                       ` Andrey Grodzovsky
2022-07-14 14:23                         ` Dmitry Osipenko
2022-07-14 16:22                         ` Alex Deucher
2022-07-14 17:58                           ` Andrey Grodzovsky
2022-07-14 21:16                             ` Alex Deucher
2022-07-15 15:18                               ` Andrey Grodzovsky
2022-07-15 15:24                                 ` Dmitry Osipenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a78343c8-2a6d-b223-4219-6b6b0a4fcb1f@arm.com \
    --to=steven.price@arm.com \
    --cc=airlied@linux.ie \
    --cc=alyssa.rosenzweig@collabora.com \
    --cc=andrey.grodzovsky@amd.com \
    --cc=daniel@ffwll.ch \
    --cc=digetx@gmail.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@gmail.com \
    --cc=robh@kernel.org \
    --cc=tomeu.vizoso@collabora.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®