Skip to contentSkip to conversation

dma-buf: revert "use inline lock for the dma-fence-chain"

PATCH In review Christian König 3 participants 4 messages Feb 23 – Feb 24

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

PATCH 1/1 dma-buf: revert "use inline lock for the dma-fence-chain"

This reverts commit a408c0ca0c411ca1ead995bdae3112a806c87556.

This causes a lockdep splat. Not really the right fix, but changing this is more work than expected.

---
 drivers/dma-buf/dma-fence-chain.c | 3 ++-
 include/linux/dma-fence-chain.h   | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/dma-buf/dma-fence-chain.c +2 -1
index a707792b6025..a8a90acf4f34 100644
@@ -245,6 +245,7 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
 	struct dma_fence_chain *prev_chain = to_dma_fence_chain(prev);
 	uint64_t context;
 
+	spin_lock_init(&chain->lock);
 	rcu_assign_pointer(chain->prev, prev);
 	chain->fence = fence;
 	chain->prev_seqno = 0;
@@ -260,7 +261,7 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
 			seqno = max(prev->seqno, seqno);
 	}
 
-	dma_fence_init64(&chain->base, &dma_fence_chain_ops, NULL,
+	dma_fence_init64(&chain->base, &dma_fence_chain_ops, &chain->lock,
 			 context, seqno);
 
 	/*
include/linux/dma-fence-chain.h +1 -0
index df3beadf1515..5cd3ba53b4a1 100644
@@ -46,6 +46,7 @@ struct dma_fence_chain {
 		 */
 		struct irq_work work;
 	};
+	spinlock_t lock;
 };
 
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 5 lines · Christian König

This reverts commit a408c0ca0c411ca1ead995bdae3112a806c87556.

This causes a lockdep splat. Not really the right fix, but changing this is more work than expected.

I think dma-fence-arrays will have the same issue.

Can’t we just assign a lockdep key for chains and arrays?

Typing as fast as I could, I came up with this, and it seems to work:

drivers/dma-buf/dma-fence-array.c +8 -0
index cd970eceaefb..d5cce24dca5b 100644
@@ -200,6 +200,10 @@ void dma_fence_array_init(struct dma_fence_array *array,
                          u64 context, unsigned seqno,
                          bool signal_on_any)
 {
+#if IS_ENABLED(CONFIG_PROVE_LOCKING)
+       static struct lock_class_key dma_fence_array_lock_key;
+#endif
+
        WARN_ON(!num_fences || !fences);
 
        array->num_fences = num_fences;
@@ -208,6 +212,10 @@ void dma_fence_array_init(struct dma_fence_array *array,
                       seqno);
        init_irq_work(&array->work, irq_dma_fence_array_work);
 
+#if IS_ENABLED(CONFIG_PROVE_LOCKING)
+       lockdep_set_class(&array->base.inline_lock, &dma_fence_array_lock_key);
+#endif
+
        atomic_set(&array->num_pending, signal_on_any ? 1 : num_fences);
        array->fences = fences;
 
drivers/dma-buf/dma-fence-chain.c +7 -0
index a707792b6025..aa144b8c3534 100644
@@ -242,6 +242,9 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
                          struct dma_fence *fence,
                          uint64_t seqno)
 {
+#if IS_ENABLED(CONFIG_PROVE_LOCKING)
+       static struct lock_class_key dma_fence_chain_lock_key;
+#endif
        struct dma_fence_chain *prev_chain = to_dma_fence_chain(prev);
        uint64_t context;
 
@@ -263,6 +266,10 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
        dma_fence_init64(&chain->base, &dma_fence_chain_ops, NULL,
                         context, seqno);
 
+#if IS_ENABLED(CONFIG_PROVE_LOCKING)
+       lockdep_set_class(&chain->base.inline_lock, &dma_fence_chain_lock_key);
+#endif
+
        /*
         * Chaining dma_fence_chain container together is only allowed through
         * the prev fence and not through the contained fence.

Matt

Quoted 42 lines
---
 drivers/dma-buf/dma-fence-chain.c | 3 ++-
 include/linux/dma-fence-chain.h   | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/dma-buf/dma-fence-chain.c +2 -1
index a707792b6025..a8a90acf4f34 100644
@@ -245,6 +245,7 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
 	struct dma_fence_chain *prev_chain = to_dma_fence_chain(prev);
 	uint64_t context;
 
+	spin_lock_init(&chain->lock);
 	rcu_assign_pointer(chain->prev, prev);
 	chain->fence = fence;
 	chain->prev_seqno = 0;
@@ -260,7 +261,7 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
 			seqno = max(prev->seqno, seqno);
 	}
 
-	dma_fence_init64(&chain->base, &dma_fence_chain_ops, NULL,
+	dma_fence_init64(&chain->base, &dma_fence_chain_ops, &chain->lock,
 			 context, seqno);
 
 	/*
include/linux/dma-fence-chain.h +1 -0
index df3beadf1515..5cd3ba53b4a1 100644
@@ -46,6 +46,7 @@ struct dma_fence_chain {
 		 */
 		struct irq_work work;
 	};
+	spinlock_t lock;
 };
 
 
Signature · 1 line
2.43.0
#2 lore raw
Quoted 6 lines · Matthew Brost
Quoted 5 lines · Christian König

This reverts commit a408c0ca0c411ca1ead995bdae3112a806c87556.

This causes a lockdep splat. Not really the right fix, but changing this is more work than expected.

Ping - this is blocking our CI so if we can figure out the best way to move forward soon, it is would be helpful.

Mstt

Quoted 103 lines

I think dma-fence-arrays will have the same issue.

Can’t we just assign a lockdep key for chains and arrays?

Typing as fast as I could, I came up with this, and it seems to work:

drivers/dma-buf/dma-fence-array.c +8 -0
index cd970eceaefb..d5cce24dca5b 100644
@@ -200,6 +200,10 @@ void dma_fence_array_init(struct dma_fence_array *array,
                          u64 context, unsigned seqno,
                          bool signal_on_any)
 {
+#if IS_ENABLED(CONFIG_PROVE_LOCKING)
+       static struct lock_class_key dma_fence_array_lock_key;
+#endif
+
        WARN_ON(!num_fences || !fences);
 
        array->num_fences = num_fences;
@@ -208,6 +212,10 @@ void dma_fence_array_init(struct dma_fence_array *array,
                       seqno);
        init_irq_work(&array->work, irq_dma_fence_array_work);
 
+#if IS_ENABLED(CONFIG_PROVE_LOCKING)
+       lockdep_set_class(&array->base.inline_lock, &dma_fence_array_lock_key);
+#endif
+
        atomic_set(&array->num_pending, signal_on_any ? 1 : num_fences);
        array->fences = fences;
 
drivers/dma-buf/dma-fence-chain.c +7 -0
index a707792b6025..aa144b8c3534 100644
@@ -242,6 +242,9 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
                          struct dma_fence *fence,
                          uint64_t seqno)
 {
+#if IS_ENABLED(CONFIG_PROVE_LOCKING)
+       static struct lock_class_key dma_fence_chain_lock_key;
+#endif
        struct dma_fence_chain *prev_chain = to_dma_fence_chain(prev);
        uint64_t context;
 
@@ -263,6 +266,10 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
        dma_fence_init64(&chain->base, &dma_fence_chain_ops, NULL,
                         context, seqno);
 
+#if IS_ENABLED(CONFIG_PROVE_LOCKING)
+       lockdep_set_class(&chain->base.inline_lock, &dma_fence_chain_lock_key);
+#endif
+
        /*
         * Chaining dma_fence_chain container together is only allowed through
         * the prev fence and not through the contained fence.

Matt

Quoted 42 lines
---
 drivers/dma-buf/dma-fence-chain.c | 3 ++-
 include/linux/dma-fence-chain.h   | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)
drivers/dma-buf/dma-fence-chain.c +2 -1
index a707792b6025..a8a90acf4f34 100644
@@ -245,6 +245,7 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
 	struct dma_fence_chain *prev_chain = to_dma_fence_chain(prev);
 	uint64_t context;
 
+	spin_lock_init(&chain->lock);
 	rcu_assign_pointer(chain->prev, prev);
 	chain->fence = fence;
 	chain->prev_seqno = 0;
@@ -260,7 +261,7 @@ void dma_fence_chain_init(struct dma_fence_chain *chain,
 			seqno = max(prev->seqno, seqno);
 	}
 
-	dma_fence_init64(&chain->base, &dma_fence_chain_ops, NULL,
+	dma_fence_init64(&chain->base, &dma_fence_chain_ops, &chain->lock,
 			 context, seqno);
 
 	/*
include/linux/dma-fence-chain.h +1 -0
index df3beadf1515..5cd3ba53b4a1 100644
@@ -46,6 +46,7 @@ struct dma_fence_chain {
 		 */
 		struct irq_work work;
 	};
+	spinlock_t lock;
 };
 
 
Signature · 1 line
2.43.0
#3 lore raw

✗ i915.CI.BAT: failure for dma-buf: revert "use inline lock for the dma-fence-chain"

In reply to Christian König
== Series Details ==

== Series Details ==

Series: dma-buf: revert "use inline lock for the dma-fence-chain"
URL : https://patchwork.freedesktop.org/series/162008/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_18022 -> Patchwork_162008v1
====================================================

Summary
-------

**FAILURE**

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

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

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

Participating hosts (43 -> 41)
------------------------------

Missing (2): bat-dg2-13 fi-snb-2520m

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

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

### IGT changes ###

#### Possible regressions ####

* igt@i915_selftest@live:
- bat-arls-5: [PASS][1] -> [TIMEOUT][2] +1 other test timeout
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18022/bat-arls-5/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_162008v1/bat-arls-5/igt@[email protected]

* igt@kms_pipe_crc_basic@hang-read-crc@pipe-b-dp-3:
- bat-arls-5: [PASS][3] -> [DMESG-WARN][4] +3 other tests dmesg-warn
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18022/bat-arls-5/igt@kms_pipe_crc_basic@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_162008v1/bat-arls-5/igt@kms_pipe_crc_basic@[email protected]

* igt@kms_pipe_crc_basic@read-crc:
- fi-cfl-8109u: [PASS][5] -> [DMESG-WARN][6] +48 other tests dmesg-warn
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18022/fi-cfl-8109u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_162008v1/fi-cfl-8109u/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@i915_module_load@reload:
- bat-arls-6: [PASS][7] -> [DMESG-WARN][8] ([i915#15738]) +36 other tests dmesg-warn
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18022/bat-arls-6/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_162008v1/bat-arls-6/igt@[email protected]

* igt@i915_selftest@live@evict:
- bat-arls-6: [PASS][9] -> [DMESG-FAIL][10] ([i915#15738])
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18022/bat-arls-6/igt@i915_selftest@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_162008v1/bat-arls-6/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@gem_contexts:
- bat-arls-6: [PASS][11] -> [INCOMPLETE][12] ([i915#15738])
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18022/bat-arls-6/igt@i915_selftest@live@gem_contexts.html
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_162008v1/bat-arls-6/igt@i915_selftest@live@gem_contexts.html

* igt@i915_selftest@live@sanitycheck:
- bat-arls-5: [PASS][13] -> [DMESG-WARN][14] ([i915#15738]) +17 other tests dmesg-warn
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18022/bat-arls-5/igt@i915_selftest@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_162008v1/bat-arls-5/igt@i915_selftest@[email protected]

* igt@i915_selftest@live@workarounds:
- bat-dg2-14: [PASS][15] -> [DMESG-FAIL][16] ([i915#12061]) +1 other test dmesg-fail
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18022/bat-dg2-14/igt@i915_selftest@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_162008v1/bat-dg2-14/igt@i915_selftest@[email protected]

* igt@kms_hdmi_inject@inject-audio:
- fi-tgl-1115g4: [PASS][17] -> [SKIP][18] ([i915#13030])
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18022/fi-tgl-1115g4/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_162008v1/fi-tgl-1115g4/igt@[email protected]

#### Warnings ####

* igt@i915_selftest@live:
- bat-arls-6: [DMESG-FAIL][19] ([i915#12061]) -> [INCOMPLETE][20] ([i915#15738])
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18022/bat-arls-6/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_162008v1/bat-arls-6/igt@[email protected]

* igt@i915_selftest@live@workarounds:
- bat-arls-6: [DMESG-FAIL][21] ([i915#12061]) -> [DMESG-WARN][22] ([i915#15738])
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_18022/bat-arls-6/igt@i915_selftest@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_162008v1/bat-arls-6/igt@i915_selftest@[email protected]

[i915#12061]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12061
[i915#13030]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13030
[i915#15738]: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/15738

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

* Linux: CI_DRM_18022 -> Patchwork_162008v1

CI-20190529: 20190529
CI_DRM_18022: 45a3045fc0dc46a893cb8bbe304afafd4120c904 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_8765: 8765
Patchwork_162008v1: 45a3045fc0dc46a893cb8bbe304afafd4120c904 @ git://anongit.freedesktop.org/gfx-ci/linux

== Logs ==

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