Skip to contentSkip to conversation

drm/i915/guc: Use lockless list for destroyed contexts

PATCH In review Matthew Brost 4 participants 9 messages Dec 22, 2021 – Dec 23, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915/guc: Use lockless list for destroyed contexts

Use a lockless list structure for destroyed contexts to avoid hammering on global submission spin lock.

---
 drivers/gpu/drm/i915/gt/intel_context.c       |  2 -
 drivers/gpu/drm/i915/gt/intel_context_types.h |  3 +-
 drivers/gpu/drm/i915/gt/uc/intel_guc.h        |  3 +-
 .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 44 +++++--------------
 4 files changed, 16 insertions(+), 36 deletions(-)
drivers/gpu/drm/i915/gt/intel_context.c +0 -2
index 5d0ec7c49b6a..4aacb4b0418d 100644
@@ -403,8 +403,6 @@ intel_context_init(struct intel_context *ce, struct intel_engine_cs *engine)
 	ce->guc_id.id = GUC_INVALID_LRC_ID;
 	INIT_LIST_HEAD(&ce->guc_id.link);
 
-	INIT_LIST_HEAD(&ce->destroyed_link);
-
 	INIT_LIST_HEAD(&ce->parallel.child_list);
 
 	/*
drivers/gpu/drm/i915/gt/intel_context_types.h +2 -1
index 30cd81ad8911..4532d43ec9c0 100644
@@ -9,6 +9,7 @@
 #include <linux/average.h>
 #include <linux/kref.h>
 #include <linux/list.h>
+#include <linux/llist.h>
 #include <linux/mutex.h>
 #include <linux/types.h>
 
@@ -224,7 +225,7 @@ struct intel_context {
 	 * list when context is pending to be destroyed (deregistered with the
 	 * GuC), protected by guc->submission_state.lock
 	 */
-	struct list_head destroyed_link;
+	struct llist_node destroyed_link;
 
 	/** @parallel: sub-structure for parallel submission members */
 	struct {
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -1
index f9240d4baa69..705085058411 100644
@@ -8,6 +8,7 @@
 
 #include <linux/xarray.h>
 #include <linux/delay.h>
+#include <linux/llist.h>
 
 #include "intel_uncore.h"
 #include "intel_guc_fw.h"
@@ -112,7 +113,7 @@ struct intel_guc {
 		 * @destroyed_contexts: list of contexts waiting to be destroyed
 		 * (deregistered with the GuC)
 		 */
-		struct list_head destroyed_contexts;
+		struct llist_head destroyed_contexts;
 		/**
 		 * @destroyed_worker: worker to deregister contexts, need as we
 		 * need to take a GT PM reference and can't from destroy
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +12 -32

76 lines not on this page · raw message

Signature · 1 line
2.34.1
#1 lore raw

[Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/i915/guc: Use lockless list for destroyed contexts

== Series Details ==

== Series Details ==

Series: drm/i915/guc: Use lockless list for destroyed contexts
URL : https://patchwork.freedesktop.org/series/98316/
State : warning

== Summary ==

$ dim checkpatch origin/drm-tip
dc0006ee6d95 drm/i915/guc: Use lockless list for destroyed contexts
-:84: CHECK:MACRO_ARG_PRECEDENCE: Macro argument 'guc' may be better as '(guc)' to avoid precedence issues
#84: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:2699:
+#define take_destroyed_contexts(guc) \
+	llist_del_all(&guc->submission_state.destroyed_contexts)

-:109: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #109: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:2710:
+ llist_for_each_entry_safe(ce, cn, take_destroyed_contexts(guc),
+ destroyed_link) {

-:134: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #134: FILE: drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c:2721:
+ llist_for_each_entry_safe(ce, cn, take_destroyed_contexts(guc),
+ destroyed_link)

total: 0 errors, 0 warnings, 3 checks, 114 lines checked

#2 lore raw

[Intel-gfx] ✗ Fi.CI.SPARSE: warning for drm/i915/guc: Use lockless list for destroyed contexts

In reply to Matthew Brost
== Series Details ==

== Series Details ==

Series: drm/i915/guc: Use lockless list for destroyed contexts
URL : https://patchwork.freedesktop.org/series/98316/
State : warning

== Summary ==

$ dim sparse --fast origin/drm-tip
Sparse version: v0.6.2
Fast mode used, each commit won't be checked separately.
#3 lore raw

[Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/guc: Use lockless list for destroyed contexts

In reply to Matthew Brost
== Series Details ==

== Series Details ==

Series: drm/i915/guc: Use lockless list for destroyed contexts
URL : https://patchwork.freedesktop.org/series/98316/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_11029 -> Patchwork_21900
====================================================

Summary
-------

**SUCCESS**

No regressions found.

External URL: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/index.html

Participating hosts (43 -> 36)
------------------------------

Additional (2): fi-kbl-soraka fi-icl-u2
Missing (9): bat-dg1-6 fi-tgl-u2 bat-dg1-5 fi-bsw-cyan bat-adlp-6 bat-adlp-4 fi-pnv-d510 bat-jsl-2 fi-bdw-samus

Known issues
------------

Here are the changes found in Patchwork_21900 that come from known issues:

### IGT changes ###

#### Issues hit ####

* igt@amdgpu/amd_cs_nop@fork-gfx0:
- fi-icl-u2: NOTRUN -> [SKIP][1] ([fdo#109315]) +17 similar issues
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-icl-u2/igt@amdgpu/[email protected]

* igt@gem_exec_fence@basic-busy@bcs0:
- fi-kbl-soraka: NOTRUN -> [SKIP][2] ([fdo#109271]) +25 similar issues
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-kbl-soraka/igt@gem_exec_fence@[email protected]

* igt@gem_huc_copy@huc-copy:
- fi-kbl-soraka: NOTRUN -> [SKIP][3] ([fdo#109271] / [i915#2190])
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-kbl-soraka/igt@[email protected]
- fi-icl-u2: NOTRUN -> [SKIP][4] ([i915#2190])
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-icl-u2/igt@[email protected]

* igt@gem_lmem_swapping@basic:
- fi-kbl-soraka: NOTRUN -> [SKIP][5] ([fdo#109271] / [i915#4613]) +3 similar issues
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-kbl-soraka/igt@[email protected]

* igt@gem_lmem_swapping@parallel-random-engines:
- fi-icl-u2: NOTRUN -> [SKIP][6] ([i915#4613]) +3 similar issues
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-icl-u2/igt@[email protected]

* igt@i915_selftest@live@gt_lrc:
- fi-bsw-n3050: [PASS][7] -> [DMESG-FAIL][8] ([i915#2373])
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/fi-bsw-n3050/igt@i915_selftest@live@gt_lrc.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-bsw-n3050/igt@i915_selftest@live@gt_lrc.html

* igt@i915_selftest@live@gt_pm:
- fi-kbl-soraka: NOTRUN -> [DMESG-FAIL][9] ([i915#1886] / [i915#2291])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-kbl-soraka/igt@i915_selftest@live@gt_pm.html

* igt@kms_chamelium@common-hpd-after-suspend:
- fi-kbl-soraka: NOTRUN -> [SKIP][10] ([fdo#109271] / [fdo#111827]) +8 similar issues
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-kbl-soraka/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-fast:
- fi-icl-u2: NOTRUN -> [SKIP][11] ([fdo#111827]) +8 similar issues
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-icl-u2/igt@[email protected]

* igt@kms_cursor_legacy@basic-busy-flip-before-cursor-legacy:
- fi-icl-u2: NOTRUN -> [SKIP][12] ([fdo#109278]) +2 similar issues
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-icl-u2/igt@[email protected]

* igt@kms_force_connector_basic@force-load-detect:
- fi-icl-u2: NOTRUN -> [SKIP][13] ([fdo#109285])
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-icl-u2/igt@[email protected]

* igt@kms_pipe_crc_basic@compare-crc-sanitycheck-pipe-d:
- fi-kbl-soraka: NOTRUN -> [SKIP][14] ([fdo#109271] / [i915#533])
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-kbl-soraka/igt@[email protected]

* igt@kms_psr@primary_page_flip:
- fi-skl-6600u: [PASS][15] -> [FAIL][16] ([i915#4547])
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/fi-skl-6600u/igt@kms_psr@primary_page_flip.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-skl-6600u/igt@kms_psr@primary_page_flip.html

* igt@prime_vgem@basic-userptr:
- fi-icl-u2: NOTRUN -> [SKIP][17] ([i915#3301])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-icl-u2/igt@[email protected]

* igt@runner@aborted:
- fi-skl-6600u: NOTRUN -> [FAIL][18] ([i915#4312])
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/fi-skl-6600u/igt@[email protected]

[fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
[fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
[fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
[fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
[fdo#111827]: https://bugs.freedesktop.org/show_bug.cgi?id=111827
[i915#1886]: https://gitlab.freedesktop.org/drm/intel/issues/1886
[i915#2190]: https://gitlab.freedesktop.org/drm/intel/issues/2190
[i915#2291]: https://gitlab.freedesktop.org/drm/intel/issues/2291
[i915#2373]: https://gitlab.freedesktop.org/drm/intel/issues/2373
[i915#3301]: https://gitlab.freedesktop.org/drm/intel/issues/3301
[i915#4312]: https://gitlab.freedesktop.org/drm/intel/issues/4312
[i915#4547]: https://gitlab.freedesktop.org/drm/intel/issues/4547
[i915#4613]: https://gitlab.freedesktop.org/drm/intel/issues/4613
[i915#533]: https://gitlab.freedesktop.org/drm/intel/issues/533

Build changes
-------------

* Linux: CI_DRM_11029 -> Patchwork_21900

CI-20190529: 20190529
CI_DRM_11029: ed49e39bdb15ee9721b96022cde454ffa045d621 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_6317: 704a1a42db2fad72c382e95c9da200b5bde5e5fc @ https://gitlab.freedesktop.org/drm/igt-gpu-tools.git
Patchwork_21900: dc0006ee6d9525cee59f7c4dc81ace6d9eaf1e80 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

dc0006ee6d95 drm/i915/guc: Use lockless list for destroyed contexts

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/index.html

#4 lore raw
In reply to Matthew Brost
Quoted 2 lines · Matthew Brost

Use a lockless list structure for destroyed contexts to avoid hammering on global submission spin lock.

I thought the guidance was that lockless anything without an explanation longer than War And Peace comes with an automatic termination penalty?

Also, I thought the simple suggestion was to just move the entire list sideways under the existing lock and then loop through the local list safely without requiring locks because it is now local only.

John.

Quoted 149 lines
---
  drivers/gpu/drm/i915/gt/intel_context.c       |  2 -
  drivers/gpu/drm/i915/gt/intel_context_types.h |  3 +-
  drivers/gpu/drm/i915/gt/uc/intel_guc.h        |  3 +-
  .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 44 +++++--------------
  4 files changed, 16 insertions(+), 36 deletions(-)
drivers/gpu/drm/i915/gt/intel_context.c +0 -2
index 5d0ec7c49b6a..4aacb4b0418d 100644
@@ -403,8 +403,6 @@ intel_context_init(struct intel_context *ce, struct intel_engine_cs *engine)
  	ce->guc_id.id = GUC_INVALID_LRC_ID;
  	INIT_LIST_HEAD(&ce->guc_id.link);
 
-	INIT_LIST_HEAD(&ce->destroyed_link);
-
  	INIT_LIST_HEAD(&ce->parallel.child_list);
 
  	/*
drivers/gpu/drm/i915/gt/intel_context_types.h +2 -1
index 30cd81ad8911..4532d43ec9c0 100644
@@ -9,6 +9,7 @@
  #include <linux/average.h>
  #include <linux/kref.h>
  #include <linux/list.h>
+#include <linux/llist.h>
  #include <linux/mutex.h>
  #include <linux/types.h>
 
@@ -224,7 +225,7 @@ struct intel_context {
  	 * list when context is pending to be destroyed (deregistered with the
  	 * GuC), protected by guc->submission_state.lock
  	 */
-	struct list_head destroyed_link;
+	struct llist_node destroyed_link;
 
  	/** @parallel: sub-structure for parallel submission members */
  	struct {
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -1
index f9240d4baa69..705085058411 100644
@@ -8,6 +8,7 @@
 
  #include <linux/xarray.h>
  #include <linux/delay.h>
+#include <linux/llist.h>
 
  #include "intel_uncore.h"
  #include "intel_guc_fw.h"
@@ -112,7 +113,7 @@ struct intel_guc {
  		 * @destroyed_contexts: list of contexts waiting to be destroyed
  		 * (deregistered with the GuC)
  		 */
-		struct list_head destroyed_contexts;
+		struct llist_head destroyed_contexts;
  		/**
  		 * @destroyed_worker: worker to deregister contexts, need as we
  		 * need to take a GT PM reference and can't from destroy
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +12 -32
index 0a03a30e4c6d..6f7643edc139 100644
@@ -1771,7 +1771,7 @@ int intel_guc_submission_init(struct intel_guc *guc)
  	spin_lock_init(&guc->submission_state.lock);
  	INIT_LIST_HEAD(&guc->submission_state.guc_id_list);
  	ida_init(&guc->submission_state.guc_ids);
-	INIT_LIST_HEAD(&guc->submission_state.destroyed_contexts);
+	init_llist_head(&guc->submission_state.destroyed_contexts);
  	INIT_WORK(&guc->submission_state.destroyed_worker,
  		  destroyed_worker_func);
 
@@ -2696,26 +2696,18 @@ static void __guc_context_destroy(struct intel_context *ce)
  	}
  }
 
+#define take_destroyed_contexts(guc) \
+	llist_del_all(&guc->submission_state.destroyed_contexts)
+
  static void guc_flush_destroyed_contexts(struct intel_guc *guc)
  {
-	struct intel_context *ce;
-	unsigned long flags;
+	struct intel_context *ce, *cn;
 
  	GEM_BUG_ON(!submission_disabled(guc) &&
  		   guc_submission_initialized(guc));
 
-	while (!list_empty(&guc->submission_state.destroyed_contexts)) {
-		spin_lock_irqsave(&guc->submission_state.lock, flags);
-		ce = list_first_entry_or_null(&guc->submission_state.destroyed_contexts,
-					      struct intel_context,
-					      destroyed_link);
-		if (ce)
-			list_del_init(&ce->destroyed_link);
-		spin_unlock_irqrestore(&guc->submission_state.lock, flags);
-
-		if (!ce)
-			break;
-
+	llist_for_each_entry_safe(ce, cn, take_destroyed_contexts(guc),
+				 destroyed_link) {
  		release_guc_id(guc, ce);
  		__guc_context_destroy(ce);
  	}
@@ -2723,23 +2715,11 @@ static void guc_flush_destroyed_contexts(struct intel_guc *guc)
 
  static void deregister_destroyed_contexts(struct intel_guc *guc)
  {
-	struct intel_context *ce;
-	unsigned long flags;
-
-	while (!list_empty(&guc->submission_state.destroyed_contexts)) {
-		spin_lock_irqsave(&guc->submission_state.lock, flags);
-		ce = list_first_entry_or_null(&guc->submission_state.destroyed_contexts,
-					      struct intel_context,
-					      destroyed_link);
-		if (ce)
-			list_del_init(&ce->destroyed_link);
-		spin_unlock_irqrestore(&guc->submission_state.lock, flags);
-
-		if (!ce)
-			break;
+	struct intel_context *ce, *cn;
 
+	llist_for_each_entry_safe(ce, cn, take_destroyed_contexts(guc),
+				 destroyed_link)
  		guc_lrc_desc_unpin(ce);
-	}
  }
 
  static void destroyed_worker_func(struct work_struct *w)
@@ -2771,8 +2751,8 @@ static void guc_context_destroy(struct kref *kref)
  	if (likely(!destroy)) {
  		if (!list_empty(&ce->guc_id.link))
  			list_del_init(&ce->guc_id.link);
-		list_add_tail(&ce->destroyed_link,
-			      &guc->submission_state.destroyed_contexts);
+		llist_add(&ce->destroyed_link,
+			  &guc->submission_state.destroyed_contexts);
  	} else {
  		__release_guc_id(guc, ce);
  	}
#5 lore raw
Quoted 6 lines · John Harrison
Quoted 2 lines · Matthew Brost

Use a lockless list structure for destroyed contexts to avoid hammering on global submission spin lock.

I thought the guidance was that lockless anything without an explanation longer than War And Peace comes with an automatic termination penalty?

I was thinking that was for custom lockless algorithms not using core uAPIs. If this is really concern I could protect the llist_del_all by a lock but the doc explicitly says how I'm using this uAPI is safe without a lock.

Quoted 4 lines

Also, I thought the simple suggestion was to just move the entire list sideways under the existing lock and then loop through the local list safely without requiring locks because it is now local only.

That's basically what this uAPI does in a few simple calls rather than our own algorithm to move to a new list.

Matt

Quoted 140 lines

John.

Quoted 136 lines
---
  drivers/gpu/drm/i915/gt/intel_context.c       |  2 -
  drivers/gpu/drm/i915/gt/intel_context_types.h |  3 +-
  drivers/gpu/drm/i915/gt/uc/intel_guc.h        |  3 +-
  .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 44 +++++--------------
  4 files changed, 16 insertions(+), 36 deletions(-)
drivers/gpu/drm/i915/gt/intel_context.c +0 -2
index 5d0ec7c49b6a..4aacb4b0418d 100644
@@ -403,8 +403,6 @@ intel_context_init(struct intel_context *ce, struct intel_engine_cs *engine)
  	ce->guc_id.id = GUC_INVALID_LRC_ID;
  	INIT_LIST_HEAD(&ce->guc_id.link);
-	INIT_LIST_HEAD(&ce->destroyed_link);
-
  	INIT_LIST_HEAD(&ce->parallel.child_list);
  	/*
drivers/gpu/drm/i915/gt/intel_context_types.h +2 -1
index 30cd81ad8911..4532d43ec9c0 100644
@@ -9,6 +9,7 @@
  #include <linux/average.h>
  #include <linux/kref.h>
  #include <linux/list.h>
+#include <linux/llist.h>
  #include <linux/mutex.h>
  #include <linux/types.h>
@@ -224,7 +225,7 @@ struct intel_context {
  	 * list when context is pending to be destroyed (deregistered with the
  	 * GuC), protected by guc->submission_state.lock
  	 */
-	struct list_head destroyed_link;
+	struct llist_node destroyed_link;
  	/** @parallel: sub-structure for parallel submission members */
  	struct {
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -1
index f9240d4baa69..705085058411 100644
@@ -8,6 +8,7 @@
  #include <linux/xarray.h>
  #include <linux/delay.h>
+#include <linux/llist.h>
  #include "intel_uncore.h"
  #include "intel_guc_fw.h"
@@ -112,7 +113,7 @@ struct intel_guc {
  		 * @destroyed_contexts: list of contexts waiting to be destroyed
  		 * (deregistered with the GuC)
  		 */
-		struct list_head destroyed_contexts;
+		struct llist_head destroyed_contexts;
  		/**
  		 * @destroyed_worker: worker to deregister contexts, need as we
  		 * need to take a GT PM reference and can't from destroy
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +12 -32
index 0a03a30e4c6d..6f7643edc139 100644
@@ -1771,7 +1771,7 @@ int intel_guc_submission_init(struct intel_guc *guc)
  	spin_lock_init(&guc->submission_state.lock);
  	INIT_LIST_HEAD(&guc->submission_state.guc_id_list);
  	ida_init(&guc->submission_state.guc_ids);
-	INIT_LIST_HEAD(&guc->submission_state.destroyed_contexts);
+	init_llist_head(&guc->submission_state.destroyed_contexts);
  	INIT_WORK(&guc->submission_state.destroyed_worker,
  		  destroyed_worker_func);
@@ -2696,26 +2696,18 @@ static void __guc_context_destroy(struct intel_context *ce)
  	}
  }
+#define take_destroyed_contexts(guc) \
+	llist_del_all(&guc->submission_state.destroyed_contexts)
+
  static void guc_flush_destroyed_contexts(struct intel_guc *guc)
  {
-	struct intel_context *ce;
-	unsigned long flags;
+	struct intel_context *ce, *cn;
  	GEM_BUG_ON(!submission_disabled(guc) &&
  		   guc_submission_initialized(guc));
-	while (!list_empty(&guc->submission_state.destroyed_contexts)) {
-		spin_lock_irqsave(&guc->submission_state.lock, flags);
-		ce = list_first_entry_or_null(&guc->submission_state.destroyed_contexts,
-					      struct intel_context,
-					      destroyed_link);
-		if (ce)
-			list_del_init(&ce->destroyed_link);
-		spin_unlock_irqrestore(&guc->submission_state.lock, flags);
-
-		if (!ce)
-			break;
-
+	llist_for_each_entry_safe(ce, cn, take_destroyed_contexts(guc),
+				 destroyed_link) {
  		release_guc_id(guc, ce);
  		__guc_context_destroy(ce);
  	}
@@ -2723,23 +2715,11 @@ static void guc_flush_destroyed_contexts(struct intel_guc *guc)
  static void deregister_destroyed_contexts(struct intel_guc *guc)
  {
-	struct intel_context *ce;
-	unsigned long flags;
-
-	while (!list_empty(&guc->submission_state.destroyed_contexts)) {
-		spin_lock_irqsave(&guc->submission_state.lock, flags);
-		ce = list_first_entry_or_null(&guc->submission_state.destroyed_contexts,
-					      struct intel_context,
-					      destroyed_link);
-		if (ce)
-			list_del_init(&ce->destroyed_link);
-		spin_unlock_irqrestore(&guc->submission_state.lock, flags);
-
-		if (!ce)
-			break;
+	struct intel_context *ce, *cn;
+	llist_for_each_entry_safe(ce, cn, take_destroyed_contexts(guc),
+				 destroyed_link)
  		guc_lrc_desc_unpin(ce);
-	}
  }
  static void destroyed_worker_func(struct work_struct *w)
@@ -2771,8 +2751,8 @@ static void guc_context_destroy(struct kref *kref)
  	if (likely(!destroy)) {
  		if (!list_empty(&ce->guc_id.link))
  			list_del_init(&ce->guc_id.link);
-		list_add_tail(&ce->destroyed_link,
-			      &guc->submission_state.destroyed_contexts);
+		llist_add(&ce->destroyed_link,
+			  &guc->submission_state.destroyed_contexts);
  	} else {
  		__release_guc_id(guc, ce);
  	}
#6 lore raw

[Intel-gfx] ✗ Fi.CI.IGT: failure for drm/i915/guc: Use lockless list for destroyed contexts

In reply to Matthew Brost
== Series Details ==

== Series Details ==

Series: drm/i915/guc: Use lockless list for destroyed contexts
URL : https://patchwork.freedesktop.org/series/98316/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_11029_full -> Patchwork_21900_full
====================================================

Summary
-------

**FAILURE**

Serious unknown changes coming with Patchwork_21900_full absolutely need to be verified manually.

If you think the reported changes have nothing to do with the changes introduced in Patchwork_21900_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.

Participating hosts (10 -> 10)
------------------------------

No changes in participating hosts

Possible new issues
-------------------

Here are the unknown changes that may have been introduced in Patchwork_21900_full:

### IGT changes ###

#### Possible regressions ####

* igt@kms_flip@flip-vs-fences-interruptible@a-vga1:
- shard-snb: [PASS][1] -> [INCOMPLETE][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-snb2/igt@kms_flip@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-snb7/igt@kms_flip@[email protected]

#### Suppressed ####

The following results come from untrusted machines, tests, or statuses. They do not affect the overall result.

* {igt@kms_flip_scaled_crc@flip-64bpp-ytile-to-32bpp-ytile-downscaling}:
- shard-iclb: [PASS][3] -> [SKIP][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-iclb3/igt@kms_flip_scaled_crc@flip-64bpp-ytile-to-32bpp-ytile-downscaling.html
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb2/igt@kms_flip_scaled_crc@flip-64bpp-ytile-to-32bpp-ytile-downscaling.html

Known issues
------------

Here are the changes found in Patchwork_21900_full that come from known issues:

### CI changes ###

#### Issues hit ####

* boot:
- shard-glk: ([PASS][5], [PASS][6], [PASS][7], [PASS][8], [PASS][9], [PASS][10], [PASS][11], [PASS][12], [PASS][13], [PASS][14], [PASS][15], [PASS][16], [PASS][17], [PASS][18], [PASS][19], [PASS][20], [PASS][21], [PASS][22], [PASS][23], [PASS][24], [PASS][25], [PASS][26], [PASS][27], [PASS][28], [PASS][29]) -> ([PASS][30], [PASS][31], [PASS][32], [PASS][33], [PASS][34], [PASS][35], [PASS][36], [FAIL][37], [PASS][38], [PASS][39], [PASS][40], [PASS][41], [PASS][42], [PASS][43], [PASS][44], [PASS][45], [PASS][46], [PASS][47], [PASS][48], [PASS][49], [PASS][50], [PASS][51], [PASS][52], [PASS][53], [PASS][54]) ([i915#4392])
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk1/boot.html
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk1/boot.html
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk1/boot.html
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk2/boot.html
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk2/boot.html
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk2/boot.html
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk3/boot.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk3/boot.html
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk3/boot.html
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk4/boot.html
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk4/boot.html
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk4/boot.html
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk5/boot.html
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk5/boot.html
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk6/boot.html
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk6/boot.html
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk7/boot.html
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk7/boot.html
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk7/boot.html
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk8/boot.html
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk8/boot.html
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk8/boot.html
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk9/boot.html
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk9/boot.html
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk9/boot.html
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk6/boot.html
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk1/boot.html
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk1/boot.html
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk2/boot.html
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk2/boot.html
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk3/boot.html
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk9/boot.html
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk9/boot.html
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk3/boot.html
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk9/boot.html
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk9/boot.html
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk8/boot.html
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk3/boot.html
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk8/boot.html
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk4/boot.html
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk7/boot.html
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk4/boot.html
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk7/boot.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk4/boot.html
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk7/boot.html
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk5/boot.html
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk5/boot.html
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk5/boot.html
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk6/boot.html
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk6/boot.html

#### Possible fixes ####

* boot:
- shard-apl: ([PASS][55], [FAIL][56], [PASS][57], [PASS][58], [PASS][59], [PASS][60], [PASS][61], [PASS][62], [PASS][63], [PASS][64], [PASS][65], [PASS][66], [PASS][67], [PASS][68], [PASS][69], [PASS][70], [PASS][71], [PASS][72], [PASS][73], [PASS][74], [PASS][75], [PASS][76], [PASS][77], [PASS][78], [PASS][79]) ([i915#4386]) -> ([PASS][80], [PASS][81], [PASS][82], [PASS][83], [PASS][84], [PASS][85], [PASS][86], [PASS][87], [PASS][88], [PASS][89], [PASS][90], [PASS][91], [PASS][92], [PASS][93], [PASS][94], [PASS][95], [PASS][96], [PASS][97], [PASS][98], [PASS][99], [PASS][100], [PASS][101], [PASS][102], [PASS][103], [PASS][104])
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl1/boot.html
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl1/boot.html
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl1/boot.html
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl1/boot.html
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl1/boot.html
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl2/boot.html
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl2/boot.html
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl2/boot.html
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl3/boot.html
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl3/boot.html
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl3/boot.html
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl3/boot.html
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl4/boot.html
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl4/boot.html
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl4/boot.html
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl4/boot.html
[71]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl6/boot.html
[72]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl6/boot.html
[73]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl6/boot.html
[74]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl7/boot.html
[75]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl7/boot.html
[76]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl7/boot.html
[77]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl8/boot.html
[78]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl8/boot.html
[79]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl8/boot.html
[80]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl2/boot.html
[81]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl2/boot.html
[82]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl2/boot.html
[83]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl3/boot.html
[84]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl3/boot.html
[85]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl3/boot.html
[86]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl4/boot.html
[87]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl4/boot.html
[88]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl4/boot.html
[89]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl4/boot.html
[90]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl6/boot.html
[91]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl6/boot.html
[92]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl6/boot.html
[93]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl6/boot.html
[94]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl7/boot.html
[95]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl7/boot.html
[96]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl7/boot.html
[97]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl7/boot.html
[98]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl8/boot.html
[99]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl8/boot.html
[100]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl8/boot.html
[101]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl8/boot.html
[102]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl1/boot.html
[103]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl1/boot.html
[104]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl1/boot.html

### IGT changes ###

#### Issues hit ####

* igt@gem_create@create-massive:
- shard-apl: NOTRUN -> [DMESG-WARN][105] ([i915#3002])
[105]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl1/igt@[email protected]

* igt@gem_exec_fair@basic-flow@rcs0:
- shard-tglb: NOTRUN -> [FAIL][106] ([i915#2842])
[106]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb5/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none-share@rcs0:
- shard-iclb: [PASS][107] -> [FAIL][108] ([i915#2842])
[107]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-iclb6/igt@gem_exec_fair@[email protected]
[108]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb2/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none-solo@rcs0:
- shard-apl: [PASS][109] -> [FAIL][110] ([i915#2842])
[109]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl8/igt@gem_exec_fair@[email protected]
[110]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl1/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-none@vcs1:
- shard-iclb: NOTRUN -> [FAIL][111] ([i915#2842])
[111]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@gem_exec_fair@[email protected]

* igt@gem_exec_fair@basic-pace@rcs0:
- shard-kbl: [PASS][112] -> [FAIL][113] ([i915#2842])
[112]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-kbl7/igt@gem_exec_fair@[email protected]
[113]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-kbl4/igt@gem_exec_fair@[email protected]

* igt@gem_lmem_swapping@basic:
- shard-apl: NOTRUN -> [SKIP][114] ([fdo#109271] / [i915#4613])
[114]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl1/igt@[email protected]

* igt@gem_lmem_swapping@random-engines:
- shard-kbl: NOTRUN -> [SKIP][115] ([fdo#109271] / [i915#4613]) +1 similar issue
[115]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-kbl7/igt@[email protected]

* igt@gem_mmap_gtt@coherency:
- shard-tglb: NOTRUN -> [SKIP][116] ([fdo#111656])
[116]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb7/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][117] ([fdo#109292])
[117]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]

* igt@gem_pxp@reject-modify-context-protection-on:
- shard-tglb: NOTRUN -> [SKIP][118] ([i915#4270])
[118]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb7/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][119] ([i915#4270])
[119]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]

* igt@gem_softpin@evict-snoop:
- shard-iclb: NOTRUN -> [SKIP][120] ([fdo#109312])
[120]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]
- shard-tglb: NOTRUN -> [SKIP][121] ([fdo#109312])
[121]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb7/igt@[email protected]

* igt@gem_userptr_blits@access-control:
- shard-tglb: NOTRUN -> [SKIP][122] ([i915#3297]) +1 similar issue
[122]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb5/igt@[email protected]

* igt@gem_userptr_blits@input-checking:
- shard-kbl: NOTRUN -> [DMESG-WARN][123] ([i915#3002])
[123]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-kbl7/igt@[email protected]

* igt@gem_userptr_blits@unsync-unmap:
- shard-iclb: NOTRUN -> [SKIP][124] ([i915#3297])
[124]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]

* igt@gen3_render_tiledy_blits:
- shard-tglb: NOTRUN -> [SKIP][125] ([fdo#109289]) +1 similar issue
[125]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb1/igt@gen3_render_tiledy_blits.html

* igt@gen9_exec_parse@allowed-all:
- shard-glk: [PASS][126] -> [DMESG-WARN][127] ([i915#1436] / [i915#716])
[126]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk4/igt@[email protected]
[127]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk9/igt@[email protected]

* igt@gen9_exec_parse@secure-batches:
- shard-iclb: NOTRUN -> [SKIP][128] ([i915#2856])
[128]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]
- shard-tglb: NOTRUN -> [SKIP][129] ([i915#2856])
[129]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb7/igt@[email protected]

* igt@i915_pm_dc@dc6-psr:
- shard-iclb: [PASS][130] -> [FAIL][131] ([i915#454])
[130]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-iclb7/igt@[email protected]
[131]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb3/igt@[email protected]

* igt@i915_pm_lpsp@kms-lpsp@kms-lpsp-dp:
- shard-apl: NOTRUN -> [SKIP][132] ([fdo#109271] / [i915#1937])
[132]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl1/igt@i915_pm_lpsp@[email protected]

* igt@i915_pm_rpm@modeset-pc8-residency-stress:
- shard-tglb: NOTRUN -> [SKIP][133] ([fdo#109506] / [i915#2411])
[133]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb7/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][134] ([fdo#109293] / [fdo#109506])
[134]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]

* igt@i915_pm_sseu@full-enable:
- shard-tglb: NOTRUN -> [SKIP][135] ([i915#4387])
[135]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb7/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][136] ([i915#4387])
[136]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]

* igt@i915_query@query-topology-unsupported:
- shard-tglb: NOTRUN -> [SKIP][137] ([fdo#109302])
[137]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb1/igt@[email protected]

* igt@kms_big_fb@linear-8bpp-rotate-270:
- shard-tglb: NOTRUN -> [SKIP][138] ([fdo#111614]) +3 similar issues
[138]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb7/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][139] ([fdo#110725] / [fdo#111614]) +2 similar issues
[139]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]

* igt@kms_big_fb@x-tiled-max-hw-stride-32bpp-rotate-0-async-flip:
- shard-skl: NOTRUN -> [FAIL][140] ([i915#3743])
[140]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-skl10/igt@[email protected]

* igt@kms_ccs@pipe-a-crc-sprite-planes-basic-y_tiled_gen12_rc_ccs:
- shard-apl: NOTRUN -> [SKIP][141] ([fdo#109271]) +54 similar issues
[141]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl1/igt@kms_ccs@pipe-a-crc-sprite-planes-basic-y_tiled_gen12_rc_ccs.html

* igt@kms_ccs@pipe-c-bad-rotation-90-y_tiled_gen12_mc_ccs:
- shard-apl: NOTRUN -> [SKIP][142] ([fdo#109271] / [i915#3886]) +4 similar issues
[142]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl1/igt@kms_ccs@pipe-c-bad-rotation-90-y_tiled_gen12_mc_ccs.html

* igt@kms_ccs@pipe-c-ccs-on-another-bo-y_tiled_gen12_mc_ccs:
- shard-iclb: NOTRUN -> [SKIP][143] ([fdo#109278] / [i915#3886]) +1 similar issue
[143]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@kms_ccs@pipe-c-ccs-on-another-bo-y_tiled_gen12_mc_ccs.html
- shard-tglb: NOTRUN -> [SKIP][144] ([i915#3689] / [i915#3886])
[144]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb7/igt@kms_ccs@pipe-c-ccs-on-another-bo-y_tiled_gen12_mc_ccs.html

* igt@kms_ccs@pipe-c-crc-sprite-planes-basic-y_tiled_gen12_rc_ccs_cc:
- shard-kbl: NOTRUN -> [SKIP][145] ([fdo#109271] / [i915#3886]) +2 similar issues
[145]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-kbl7/igt@kms_ccs@pipe-c-crc-sprite-planes-basic-y_tiled_gen12_rc_ccs_cc.html

* igt@kms_ccs@pipe-d-crc-sprite-planes-basic-y_tiled_ccs:
- shard-tglb: NOTRUN -> [SKIP][146] ([i915#3689]) +3 similar issues
[146]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb7/igt@kms_ccs@pipe-d-crc-sprite-planes-basic-y_tiled_ccs.html

* igt@kms_ccs@pipe-d-crc-sprite-planes-basic-yf_tiled_ccs:
- shard-tglb: NOTRUN -> [SKIP][147] ([fdo#111615] / [i915#3689])
[147]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb5/igt@kms_ccs@pipe-d-crc-sprite-planes-basic-yf_tiled_ccs.html

* igt@kms_ccs@pipe-d-missing-ccs-buffer-y_tiled_gen12_rc_ccs_cc:
- shard-kbl: NOTRUN -> [SKIP][148] ([fdo#109271]) +65 similar issues
[148]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-kbl7/igt@kms_ccs@pipe-d-missing-ccs-buffer-y_tiled_gen12_rc_ccs_cc.html

* igt@kms_chamelium@hdmi-audio-edid:
- shard-kbl: NOTRUN -> [SKIP][149] ([fdo#109271] / [fdo#111827]) +7 similar issues
[149]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-kbl7/igt@[email protected]

* igt@kms_chamelium@hdmi-hpd-storm:
- shard-iclb: NOTRUN -> [SKIP][150] ([fdo#109284] / [fdo#111827])
[150]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]

* igt@kms_color@pipe-d-degamma:
- shard-iclb: NOTRUN -> [SKIP][151] ([fdo#109278] / [i915#1149])
[151]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]

* igt@kms_color_chamelium@pipe-a-gamma:
- shard-skl: NOTRUN -> [SKIP][152] ([fdo#109271] / [fdo#111827]) +2 similar issues
[152]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-skl3/igt@[email protected]

* igt@kms_color_chamelium@pipe-c-ctm-0-25:
- shard-apl: NOTRUN -> [SKIP][153] ([fdo#109271] / [fdo#111827]) +4 similar issues
[153]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl1/igt@[email protected]

* igt@kms_color_chamelium@pipe-d-ctm-blue-to-red:
- shard-iclb: NOTRUN -> [SKIP][154] ([fdo#109278] / [fdo#109284] / [fdo#111827])
[154]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]

* igt@kms_color_chamelium@pipe-d-ctm-limited-range:
- shard-tglb: NOTRUN -> [SKIP][155] ([fdo#109284] / [fdo#111827]) +3 similar issues
[155]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb5/igt@[email protected]

* igt@kms_content_protection@legacy:
- shard-kbl: NOTRUN -> [TIMEOUT][156] ([i915#1319])
[156]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-kbl7/igt@[email protected]

* igt@kms_cursor_crc@pipe-a-cursor-32x32-offscreen:
- shard-tglb: NOTRUN -> [SKIP][157] ([i915#3319])
[157]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb7/igt@[email protected]

* igt@kms_cursor_crc@pipe-b-cursor-512x512-sliding:
- shard-iclb: NOTRUN -> [SKIP][158] ([fdo#109278] / [fdo#109279]) +1 similar issue
[158]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]

* igt@kms_cursor_crc@pipe-c-cursor-max-size-offscreen:
- shard-tglb: NOTRUN -> [SKIP][159] ([i915#3359]) +1 similar issue
[159]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb1/igt@[email protected]

* igt@kms_cursor_crc@pipe-d-cursor-512x170-offscreen:
- shard-tglb: NOTRUN -> [SKIP][160] ([fdo#109279] / [i915#3359]) +4 similar issues
[160]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb7/igt@[email protected]

* igt@kms_cursor_legacy@cursora-vs-flipb-varying-size:
- shard-iclb: NOTRUN -> [SKIP][161] ([fdo#109274] / [fdo#109278])
[161]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]

* igt@kms_flip@2x-flip-vs-expired-vblank@ab-hdmi-a1-hdmi-a2:
- shard-glk: [PASS][162] -> [FAIL][163] ([i915#79])
[162]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk1/igt@kms_flip@[email protected]
[163]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk9/igt@kms_flip@[email protected]

* igt@kms_flip@2x-flip-vs-suspend-interruptible:
- shard-tglb: NOTRUN -> [SKIP][164] ([fdo#111825]) +15 similar issues
[164]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb7/igt@[email protected]

* igt@kms_flip@2x-flip-vs-wf_vblank-interruptible:
- shard-iclb: NOTRUN -> [SKIP][165] ([fdo#109274]) +2 similar issues
[165]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@kms_flip@2x-flip-vs-wf_vblank-interruptible.html

* igt@kms_flip@flip-vs-expired-vblank@a-edp1:
- shard-skl: [PASS][166] -> [FAIL][167] ([i915#79])
[166]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-skl1/igt@kms_flip@[email protected]
[167]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-skl7/igt@kms_flip@[email protected]

* igt@kms_flip@flip-vs-suspend-interruptible@c-dp1:
- shard-apl: [PASS][168] -> [DMESG-WARN][169] ([i915#180]) +2 similar issues
[168]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-apl3/igt@kms_flip@[email protected]
[169]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl8/igt@kms_flip@[email protected]

* igt@kms_flip@plain-flip-fb-recreate-interruptible@b-edp1:
- shard-skl: [PASS][170] -> [FAIL][171] ([i915#2122]) +1 similar issue
[170]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-skl1/igt@kms_flip@[email protected]
[171]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-skl7/igt@kms_flip@[email protected]

* igt@kms_flip@plain-flip-ts-check-interruptible@b-hdmi-a2:
- shard-glk: [PASS][172] -> [FAIL][173] ([i915#2122]) +1 similar issue
[172]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-glk2/igt@kms_flip@[email protected]
[173]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-glk5/igt@kms_flip@[email protected]

* igt@kms_frontbuffer_tracking@fbc-suspend:
- shard-kbl: [PASS][174] -> [DMESG-WARN][175] ([i915#180]) +1 similar issue
[174]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-kbl1/igt@[email protected]
[175]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-kbl4/igt@[email protected]

* igt@kms_frontbuffer_tracking@psr-2p-primscrn-pri-indfb-draw-mmap-wc:
- shard-skl: NOTRUN -> [SKIP][176] ([fdo#109271]) +26 similar issues
[176]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-skl3/igt@kms_frontbuffer_tracking@psr-2p-primscrn-pri-indfb-draw-mmap-wc.html

* igt@kms_frontbuffer_tracking@psr-2p-primscrn-shrfb-pgflip-blt:
- shard-iclb: NOTRUN -> [SKIP][177] ([fdo#109280]) +4 similar issues
[177]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]

* igt@kms_hdr@bpc-switch-dpms:
- shard-skl: [PASS][178] -> [FAIL][179] ([i915#1188])
[178]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-skl4/igt@[email protected]
[179]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-skl6/igt@[email protected]

* igt@kms_hdr@static-toggle-dpms:
- shard-tglb: NOTRUN -> [SKIP][180] ([i915#1187])
[180]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-tglb7/igt@[email protected]
- shard-iclb: NOTRUN -> [SKIP][181] ([i915#1187])
[181]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-iclb1/igt@[email protected]

* igt@kms_pipe_crc_basic@nonblocking-crc-pipe-d-frame-sequence:
- shard-kbl: NOTRUN -> [SKIP][182] ([fdo#109271] / [i915#533])
[182]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-kbl6/igt@[email protected]

* igt@kms_pipe_crc_basic@read-crc-pipe-d-frame-sequence:
- shard-apl: NOTRUN -> [SKIP][183] ([fdo#109271] / [i915#533])
[183]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/shard-apl1/igt@[email protected]

* igt@kms_pipe_crc_basic@suspend-read-crc-pipe-a:
- shard-kbl: [PASS][184] -> [INCOMPLETE][185] ([i915#794])
[184]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_11029/shard-kbl6/igt@[email protected]
[185]: https://intel-g

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_21900/index.html

#7 lore raw
In reply to Matthew Brost
Quoted 2 lines · Matthew Brost

Use a lockless list structure for destroyed contexts to avoid hammering on global submission spin lock.

Thanks for looking into it quickly!

On the topic of "lockless" yes I agree the llist in principle is not a concern. That part looks fine to me. On the actual "integration" (how it slots in) with the GuC code I leave one comment below.

Quoted 138 lines
---
  drivers/gpu/drm/i915/gt/intel_context.c       |  2 -
  drivers/gpu/drm/i915/gt/intel_context_types.h |  3 +-
  drivers/gpu/drm/i915/gt/uc/intel_guc.h        |  3 +-
  .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 44 +++++--------------
  4 files changed, 16 insertions(+), 36 deletions(-)
drivers/gpu/drm/i915/gt/intel_context.c +0 -2
index 5d0ec7c49b6a..4aacb4b0418d 100644
@@ -403,8 +403,6 @@ intel_context_init(struct intel_context *ce, struct intel_engine_cs *engine)
  	ce->guc_id.id = GUC_INVALID_LRC_ID;
  	INIT_LIST_HEAD(&ce->guc_id.link);
 
-	INIT_LIST_HEAD(&ce->destroyed_link);
-
  	INIT_LIST_HEAD(&ce->parallel.child_list);
 
  	/*
drivers/gpu/drm/i915/gt/intel_context_types.h +2 -1
index 30cd81ad8911..4532d43ec9c0 100644
@@ -9,6 +9,7 @@
  #include <linux/average.h>
  #include <linux/kref.h>
  #include <linux/list.h>
+#include <linux/llist.h>
  #include <linux/mutex.h>
  #include <linux/types.h>
 
@@ -224,7 +225,7 @@ struct intel_context {
  	 * list when context is pending to be destroyed (deregistered with the
  	 * GuC), protected by guc->submission_state.lock
  	 */
-	struct list_head destroyed_link;
+	struct llist_node destroyed_link;
 
  	/** @parallel: sub-structure for parallel submission members */
  	struct {
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -1
index f9240d4baa69..705085058411 100644
@@ -8,6 +8,7 @@
 
  #include <linux/xarray.h>
  #include <linux/delay.h>
+#include <linux/llist.h>
 
  #include "intel_uncore.h"
  #include "intel_guc_fw.h"
@@ -112,7 +113,7 @@ struct intel_guc {
  		 * @destroyed_contexts: list of contexts waiting to be destroyed
  		 * (deregistered with the GuC)
  		 */
-		struct list_head destroyed_contexts;
+		struct llist_head destroyed_contexts;
  		/**
  		 * @destroyed_worker: worker to deregister contexts, need as we
  		 * need to take a GT PM reference and can't from destroy
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10 -30
index 0a03a30e4c6d..6f7643edc139 100644
@@ -1771,7 +1771,7 @@ int intel_guc_submission_init(struct intel_guc *guc)
  	spin_lock_init(&guc->submission_state.lock);
  	INIT_LIST_HEAD(&guc->submission_state.guc_id_list);
  	ida_init(&guc->submission_state.guc_ids);
-	INIT_LIST_HEAD(&guc->submission_state.destroyed_contexts);
+	init_llist_head(&guc->submission_state.destroyed_contexts);
  	INIT_WORK(&guc->submission_state.destroyed_worker,
  		  destroyed_worker_func);
 
@@ -2696,26 +2696,18 @@ static void __guc_context_destroy(struct intel_context *ce)
  	}
  }
 
+#define take_destroyed_contexts(guc) \
+	llist_del_all(&guc->submission_state.destroyed_contexts)
+
  static void guc_flush_destroyed_contexts(struct intel_guc *guc)
  {
-	struct intel_context *ce;
-	unsigned long flags;
+	struct intel_context *ce, *cn;
 
  	GEM_BUG_ON(!submission_disabled(guc) &&
  		   guc_submission_initialized(guc));
 
-	while (!list_empty(&guc->submission_state.destroyed_contexts)) {
-		spin_lock_irqsave(&guc->submission_state.lock, flags);
-		ce = list_first_entry_or_null(&guc->submission_state.destroyed_contexts,
-					      struct intel_context,
-					      destroyed_link);
-		if (ce)
-			list_del_init(&ce->destroyed_link);
-		spin_unlock_irqrestore(&guc->submission_state.lock, flags);
-
-		if (!ce)
-			break;
-
+	llist_for_each_entry_safe(ce, cn, take_destroyed_contexts(guc),
+				 destroyed_link) {
  		release_guc_id(guc, ce);
  		__guc_context_destroy(ce);
  	}
@@ -2723,23 +2715,11 @@ static void guc_flush_destroyed_contexts(struct intel_guc *guc)
 
  static void deregister_destroyed_contexts(struct intel_guc *guc)
  {
-	struct intel_context *ce;
-	unsigned long flags;
-
-	while (!list_empty(&guc->submission_state.destroyed_contexts)) {
-		spin_lock_irqsave(&guc->submission_state.lock, flags);
-		ce = list_first_entry_or_null(&guc->submission_state.destroyed_contexts,
-					      struct intel_context,
-					      destroyed_link);
-		if (ce)
-			list_del_init(&ce->destroyed_link);
-		spin_unlock_irqrestore(&guc->submission_state.lock, flags);
-
-		if (!ce)
-			break;
+	struct intel_context *ce, *cn;
 
+	llist_for_each_entry_safe(ce, cn, take_destroyed_contexts(guc),
+				 destroyed_link)
  		guc_lrc_desc_unpin(ce);
-	}
  }
 
  static void destroyed_worker_func(struct work_struct *w)

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static void guc_context_destroy(struct kref *kref) · line 2755

Quoted 7 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +2 -2
@@ -2771,8 +2751,8 @@ static void guc_context_destroy(struct kref *kref)
  	if (likely(!destroy)) {
  		if (!list_empty(&ce->guc_id.link))
  			list_del_init(&ce->guc_id.link);
-		list_add_tail(&ce->destroyed_link,
-			      &guc->submission_state.destroyed_contexts);
+		llist_add(&ce->destroyed_link,
+			  &guc->submission_state.destroyed_contexts);

So here presumably submission lock is still needed for unlinking the from guc_id list.

Mechanical flows of the patch looks good to me, but I leave to you and John to decide on llist vs keeping the existing doubly linked list. I mean agreeing what fits better with the existing locking and data structure design.

Regards,

Tvrtko

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -0
  	} else {
  		__release_guc_id(guc, ce);
  	}
#8 lore raw
Quoted 11 lines · Tvrtko Ursulin
Quoted 2 lines · Matthew Brost

Use a lockless list structure for destroyed contexts to avoid hammering on global submission spin lock.

Thanks for looking into it quickly!

On the topic of "lockless" yes I agree the llist in principle is not a concern. That part looks fine to me. On the actual "integration" (how it slots in) with the GuC code I leave one comment below.

Agree.

Quoted 127 lines
Quoted 127 lines
---
  drivers/gpu/drm/i915/gt/intel_context.c       |  2 -
  drivers/gpu/drm/i915/gt/intel_context_types.h |  3 +-
  drivers/gpu/drm/i915/gt/uc/intel_guc.h        |  3 +-
  .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 44 +++++--------------
  4 files changed, 16 insertions(+), 36 deletions(-)
drivers/gpu/drm/i915/gt/intel_context.c +0 -2
index 5d0ec7c49b6a..4aacb4b0418d 100644
@@ -403,8 +403,6 @@ intel_context_init(struct intel_context *ce, struct intel_engine_cs *engine)
  	ce->guc_id.id = GUC_INVALID_LRC_ID;
  	INIT_LIST_HEAD(&ce->guc_id.link);
-	INIT_LIST_HEAD(&ce->destroyed_link);
-
  	INIT_LIST_HEAD(&ce->parallel.child_list);
  	/*
drivers/gpu/drm/i915/gt/intel_context_types.h +2 -1
index 30cd81ad8911..4532d43ec9c0 100644
@@ -9,6 +9,7 @@
  #include <linux/average.h>
  #include <linux/kref.h>
  #include <linux/list.h>
+#include <linux/llist.h>
  #include <linux/mutex.h>
  #include <linux/types.h>
@@ -224,7 +225,7 @@ struct intel_context {
  	 * list when context is pending to be destroyed (deregistered with the
  	 * GuC), protected by guc->submission_state.lock
  	 */
-	struct list_head destroyed_link;
+	struct llist_node destroyed_link;
  	/** @parallel: sub-structure for parallel submission members */
  	struct {
drivers/gpu/drm/i915/gt/uc/intel_guc.h +2 -1
index f9240d4baa69..705085058411 100644
@@ -8,6 +8,7 @@
  #include <linux/xarray.h>
  #include <linux/delay.h>
+#include <linux/llist.h>
  #include "intel_uncore.h"
  #include "intel_guc_fw.h"
@@ -112,7 +113,7 @@ struct intel_guc {
  		 * @destroyed_contexts: list of contexts waiting to be destroyed
  		 * (deregistered with the GuC)
  		 */
-		struct list_head destroyed_contexts;
+		struct llist_head destroyed_contexts;
  		/**
  		 * @destroyed_worker: worker to deregister contexts, need as we
  		 * need to take a GT PM reference and can't from destroy
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +10 -30
index 0a03a30e4c6d..6f7643edc139 100644
@@ -1771,7 +1771,7 @@ int intel_guc_submission_init(struct intel_guc *guc)
  	spin_lock_init(&guc->submission_state.lock);
  	INIT_LIST_HEAD(&guc->submission_state.guc_id_list);
  	ida_init(&guc->submission_state.guc_ids);
-	INIT_LIST_HEAD(&guc->submission_state.destroyed_contexts);
+	init_llist_head(&guc->submission_state.destroyed_contexts);
  	INIT_WORK(&guc->submission_state.destroyed_worker,
  		  destroyed_worker_func);
@@ -2696,26 +2696,18 @@ static void __guc_context_destroy(struct intel_context *ce)
  	}
  }
+#define take_destroyed_contexts(guc) \
+	llist_del_all(&guc->submission_state.destroyed_contexts)
+
  static void guc_flush_destroyed_contexts(struct intel_guc *guc)
  {
-	struct intel_context *ce;
-	unsigned long flags;
+	struct intel_context *ce, *cn;
  	GEM_BUG_ON(!submission_disabled(guc) &&
  		   guc_submission_initialized(guc));
-	while (!list_empty(&guc->submission_state.destroyed_contexts)) {
-		spin_lock_irqsave(&guc->submission_state.lock, flags);
-		ce = list_first_entry_or_null(&guc->submission_state.destroyed_contexts,
-					      struct intel_context,
-					      destroyed_link);
-		if (ce)
-			list_del_init(&ce->destroyed_link);
-		spin_unlock_irqrestore(&guc->submission_state.lock, flags);
-
-		if (!ce)
-			break;
-
+	llist_for_each_entry_safe(ce, cn, take_destroyed_contexts(guc),
+				 destroyed_link) {
  		release_guc_id(guc, ce);
  		__guc_context_destroy(ce);
  	}
@@ -2723,23 +2715,11 @@ static void guc_flush_destroyed_contexts(struct intel_guc *guc)
  static void deregister_destroyed_contexts(struct intel_guc *guc)
  {
-	struct intel_context *ce;
-	unsigned long flags;
-
-	while (!list_empty(&guc->submission_state.destroyed_contexts)) {
-		spin_lock_irqsave(&guc->submission_state.lock, flags);
-		ce = list_first_entry_or_null(&guc->submission_state.destroyed_contexts,
-					      struct intel_context,
-					      destroyed_link);
-		if (ce)
-			list_del_init(&ce->destroyed_link);
-		spin_unlock_irqrestore(&guc->submission_state.lock, flags);
-
-		if (!ce)
-			break;
+	struct intel_context *ce, *cn;
+	llist_for_each_entry_safe(ce, cn, take_destroyed_contexts(guc),
+				 destroyed_link)
  		guc_lrc_desc_unpin(ce);
-	}
  }
  static void destroyed_worker_func(struct work_struct *w)
@@ -2771,8 +2751,8 @@ static void guc_context_destroy(struct kref *kref)
  	if (likely(!destroy)) {
  		if (!list_empty(&ce->guc_id.link))
Quoted 9 lines

drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c static void guc_context_destroy(struct kref *kref) · line 2755

Quoted 5 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +2 -2
  			list_del_init(&ce->guc_id.link);
-		list_add_tail(&ce->destroyed_link,
-			      &guc->submission_state.destroyed_contexts);
+		llist_add(&ce->destroyed_link,
+			  &guc->submission_state.destroyed_contexts);

So here presumably submission lock is still needed for unlinking the from guc_id list.

Yes, the submission lock also protects the guc_id list.

According to the llist DoC the llist_add could be outside a lock (multiple producers can safely call llist_add simultaneously but it is also harmless to call within a lock.

Quoted 5 lines

Mechanical flows of the patch looks good to me, but I leave to you and John to decide on llist vs keeping the existing doubly linked list. I mean agreeing what fits better with the existing locking and data structure design.

Sounds good.

Matt

Quoted 8 lines

Regards,

Tvrtko

Quoted 4 lines
drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +0 -0
  	} else {
  		__release_guc_id(guc, ce);
  	}