aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/files/0685-drm-amd-dal-Avoid-flood-kernel-with-storm-of-work-it.patch
blob: 00775cf44ccff3808d810991e89ab9ed5395c1b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From b3d16ddfc98550586b5c2534532bf4bfc8941a83 Mon Sep 17 00:00:00 2001
From: Vitaly Prosyak <vitaly.prosyak@amd.com>
Date: Mon, 11 Jan 2016 14:19:10 -0500
Subject: [PATCH 0685/1110] drm/amd/dal: Avoid flood kernel with storm of work
 items

Add work item to system only when handler is  available.
The change decrease the boot time and improve system
performance by not overload the system thread pool with
thousands of empty work items.

Signed-off-by: Vitaly Prosyak <vitaly.prosyak@amd.com>
Acked-by: Jordan Lazare <Jordan.Lazare@amd.com>
---
 drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_irq.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_irq.c b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_irq.c
index ab6df66..7cfb754 100644
--- a/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_irq.c
+++ b/drivers/gpu/drm/amd/dal/amdgpu_dm/amdgpu_dm_irq.c
@@ -558,15 +558,21 @@ static void amdgpu_dm_irq_schedule_work(
 	enum dc_irq_source irq_source)
 {
 	unsigned long irq_table_flags;
+	struct work_struct *work = NULL;
 
 	DM_IRQ_TABLE_LOCK(adev, irq_table_flags);
 
-	/* Since the caller is interested in 'work_struct' then
-	 * the irq will be post-processed at "INTERRUPT_LOW_IRQ_CONTEXT". */
-
-	schedule_work(&adev->dm.irq_handler_list_low_tab[irq_source].work);
+	if (!list_empty(&adev->dm.irq_handler_list_low_tab[irq_source].head))
+		work = &adev->dm.irq_handler_list_low_tab[irq_source].work;
 
 	DM_IRQ_TABLE_UNLOCK(adev, irq_table_flags);
+
+	if (work) {
+		if (!schedule_work(work))
+			DRM_INFO("amdgpu_dm_irq_schedule_work FAILED src %d\n",
+						irq_source);
+	}
+
 }
 
 /** amdgpu_dm_irq_immediate_work
-- 
2.7.4