Skip to contentSkip to conversation

drm/sched: Add warning for removing hack in drm_sched_fini()

PATCH Superseded Philipp Stanner 2 participants 2 messages Oct 9, 2025 – Oct 11, 2025

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Philipp Stanner

author maintainer
#0 lore raw

PATCH 1/1 drm/sched: Add warning for removing hack in drm_sched_fini()

The assembled developers agreed at the X.Org Developers Conference that the hack added for amdgpu in drm_sched_fini() shall be removed. It shouldn't be needed by amdgpu anymore.

As it's unclear whether all drivers really follow the life time rule of entities having to be torn down before their scheduler, it is reasonable to warn for a while before removing the hack.

Add a warning in drm_sched_fini() that fires if an entity is still active.

---
 drivers/gpu/drm/scheduler/sched_main.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/gpu/drm/scheduler/sched_main.c +2 -0
index 46119aacb809..e69917120870 100644
@@ -1441,6 +1441,8 @@ void drm_sched_fini(struct drm_gpu_scheduler *sched)
 			 * drivers that keep entities alive for longer than
 			 * the scheduler.
 			 */
+			if (!s_entity->stopped)
+				dev_warn(sched->dev, "Tearing down scheduler with active entities!\n");
 			s_entity->stopped = true;
 		spin_unlock(&rq->lock);
 		kfree(sched->sched_rq[i]);
Signature · 1 line
2.49.0
#1 lore raw
kernel test robot noticed the following build warnings:

Hi Philipp,

kernel test robot noticed the following build warnings:

[auto build test WARNING on drm-misc/drm-misc-next]
[also build test WARNING on linus/master v6.17 next-20251010] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Philipp-Stanner/drm-sched-Add-warning-for-removing-hack-in-drm_sched_fini/20251010-120556
base:   git://anongit.freedesktop.org/drm/drm-misc drm-misc-next
patch link:    https://lore.kernel.org/r/20251009125928.250652-2-phasta%40kernel.org
patch subject: [PATCH] drm/sched: Add warning for removing hack in drm_sched_fini()
config: parisc-randconfig-r072-20251011 (https://download.01.org/0day-ci/archive/20251011/[email protected]/config)
compiler: hppa-linux-gcc (GCC) 8.5.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251011/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

In file included from include/linux/wait.h:7,
from drivers/gpu/drm/scheduler/sched_main.c:70:
drivers/gpu/drm/scheduler/sched_main.c: In function 'drm_sched_fini':

>> include/linux/list.h:784:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for (pos = list_first_entry(head, typeof(*pos), member); \
     ^~~
   drivers/gpu/drm/scheduler/sched_main.c:1422:3: note: in expansion of macro 'list_for_each_entry'
      list_for_each_entry(s_entity, &rq->entities, list)
      ^~~~~~~~~~~~~~~~~~~
   drivers/gpu/drm/scheduler/sched_main.c:1446:4: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
       s_entity->stopped = true;
       ^~~~~~~~

vim +/for +784 include/linux/list.h

4d70c74659d9746 Andy Shevchenko 2022-11-30  767  
e130816164e244b Andy Shevchenko 2020-10-15  768  /**
e130816164e244b Andy Shevchenko 2020-10-15  769   * list_entry_is_head - test if the entry points to the head of the list
e130816164e244b Andy Shevchenko 2020-10-15  770   * @pos:	the type * to cursor
e130816164e244b Andy Shevchenko 2020-10-15  771   * @head:	the head for your list.
e130816164e244b Andy Shevchenko 2020-10-15  772   * @member:	the name of the list_head within the struct.
e130816164e244b Andy Shevchenko 2020-10-15  773   */
e130816164e244b Andy Shevchenko 2020-10-15  774  #define list_entry_is_head(pos, head, member)				\
2932fb0a927d306 Wei Yang        2024-02-08  775  	list_is_head(&pos->member, (head))
e130816164e244b Andy Shevchenko 2020-10-15  776  
^1da177e4c3f415 Linus Torvalds  2005-04-16  777  /**
^1da177e4c3f415 Linus Torvalds  2005-04-16  778   * list_for_each_entry	-	iterate over list of given type
8e3a67a99231f9f Randy Dunlap    2006-06-25  779   * @pos:	the type * to use as a loop cursor.
^1da177e4c3f415 Linus Torvalds  2005-04-16  780   * @head:	the head for your list.
3943f42c11896ce Andrey Utkin    2014-11-14  781   * @member:	the name of the list_head within the struct.
^1da177e4c3f415 Linus Torvalds  2005-04-16  782   */
^1da177e4c3f415 Linus Torvalds  2005-04-16  783  #define list_for_each_entry(pos, head, member)				\
93be3c2eb3371f0 Oleg Nesterov   2013-11-12 @784  	for (pos = list_first_entry(head, typeof(*pos), member);	\
e130816164e244b Andy Shevchenko 2020-10-15  785  	     !list_entry_is_head(pos, head, member);			\
8120e2e5141a420 Oleg Nesterov   2013-11-12  786  	     pos = list_next_entry(pos, member))

^1da177e4c3f415 Linus Torvalds 2005-04-16 787

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki