aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3550-drm-scheduler-use-job-count-instead-of-peek.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3550-drm-scheduler-use-job-count-instead-of-peek.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3550-drm-scheduler-use-job-count-instead-of-peek.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3550-drm-scheduler-use-job-count-instead-of-peek.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3550-drm-scheduler-use-job-count-instead-of-peek.patch
new file mode 100644
index 00000000..4cfe026d
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3550-drm-scheduler-use-job-count-instead-of-peek.patch
@@ -0,0 +1,45 @@
+From e7009d24434c1bd93ac221b2d872911e79fa1fd6 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@amd.com>
+Date: Fri, 9 Aug 2019 17:27:21 +0200
+Subject: [PATCH 3550/4256] drm/scheduler: use job count instead of peek
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+The spsc_queue_peek function is accessing queue->head which belongs to
+the consumer thread and shouldn't be accessed by the producer
+
+This is fixing a rare race condition when destroying entities.
+
+Signed-off-by: Christian König <christian.koenig@amd.com>
+Acked-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
+Reviewed-by: Monk.liu@amd.com
+---
+ drivers/gpu/drm/scheduler/sched_entity.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c
+index 35ddbec1375a..671c90f34ede 100644
+--- a/drivers/gpu/drm/scheduler/sched_entity.c
++++ b/drivers/gpu/drm/scheduler/sched_entity.c
+@@ -95,7 +95,7 @@ static bool drm_sched_entity_is_idle(struct drm_sched_entity *entity)
+ rmb(); /* for list_empty to work without lock */
+
+ if (list_empty(&entity->list) ||
+- spsc_queue_peek(&entity->job_queue) == NULL)
++ spsc_queue_count(&entity->job_queue) == 0)
+ return true;
+
+ return false;
+@@ -281,7 +281,7 @@ void drm_sched_entity_fini(struct drm_sched_entity *entity)
+ /* Consumption of existing IBs wasn't completed. Forcefully
+ * remove them here.
+ */
+- if (spsc_queue_peek(&entity->job_queue)) {
++ if (spsc_queue_count(&entity->job_queue)) {
+ if (sched) {
+ /* Park the kernel for a moment to make sure it isn't processing
+ * our enity.
+--
+2.17.1
+