Skip to contentSkip to conversation

dma-fence: Use non-atomic bitops while under the lock

PATCH In review Tvrtko Ursulin 2 participants 3 messages Oct 3, 2019

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

PATCH 1/1 dma-fence: Use non-atomic bitops while under the lock

From: Tvrtko Ursulin <[email protected]>

We do not have to use atomic bitops when already under the spinlock.

Saves on a handful of lock instruction prefixes, on x86 at least.

---
 drivers/dma-buf/dma-fence.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/dma-buf/dma-fence.c +7 -7
index 2c136aee3e79..f0b480042e2f 100644
@@ -133,15 +133,15 @@ int dma_fence_signal_locked(struct dma_fence *fence)
 
 	lockdep_assert_held(fence->lock);
 
-	if (unlikely(test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
-				      &fence->flags)))
+	if (unlikely(__test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
+					&fence->flags)))
 		return -EINVAL;
 
 	/* Stash the cb_list before replacing it with the timestamp */
 	list_replace(&fence->cb_list, &cb_list);
 
 	fence->timestamp = ktime_get();
-	set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
+	__set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
 	trace_dma_fence_signaled(fence);
 
 	list_for_each_entry_safe(cur, tmp, &cb_list, node) {
@@ -343,8 +343,8 @@ int dma_fence_add_callback(struct dma_fence *fence, struct dma_fence_cb *cb,
 
 	spin_lock_irqsave(fence->lock, flags);
 
-	was_set = test_and_set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
-				   &fence->flags);
+	was_set = __test_and_set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
+				     &fence->flags);
 
 	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
 		ret = -ENOENT;
@@ -473,8 +473,8 @@ dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout)
 		goto out;
 	}
 
-	was_set = test_and_set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
-				   &fence->flags);
+	was_set = __test_and_set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
+				     &fence->flags);
 
 	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
 		goto out;
Signature · 6 lines
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw

✗ Fi.CI.BAT: failure for dma-fence: Use non-atomic bitops while under the lock

== Series Details ==

== Series Details ==

Series: dma-fence: Use non-atomic bitops while under the lock
URL : https://patchwork.freedesktop.org/series/67532/
State : failure

== Summary ==

CI Bug Log - changes from CI_DRM_6996 -> Patchwork_14646
====================================================

Summary
-------

**FAILURE**

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

If you think the reported changes have nothing to do with the changes introduced in Patchwork_14646, please notify your bug team 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_14646/index.html

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

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

### IGT changes ###

#### Possible regressions ####

* igt@gem_exec_parallel@basic:
- fi-icl-u2: [PASS][1] -> [DMESG-WARN][2]
[1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-icl-u2/igt@[email protected]
[2]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-icl-u2/igt@[email protected]

* igt@gem_exec_reloc@basic-gtt-read-noreloc:
- fi-cfl-8700k: [PASS][3] -> [INCOMPLETE][4]
[3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-cfl-8700k/igt@[email protected]
[4]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-cfl-8700k/igt@[email protected]

* igt@gem_ringfill@basic-default-interruptible:
- fi-whl-u: [PASS][5] -> [INCOMPLETE][6]
[5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-whl-u/igt@[email protected]
[6]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-whl-u/igt@[email protected]
- fi-hsw-4770: [PASS][7] -> [INCOMPLETE][8]
[7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-hsw-4770/igt@[email protected]
[8]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-hsw-4770/igt@[email protected]
- fi-skl-iommu: [PASS][9] -> [DMESG-WARN][10]
[9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-skl-iommu/igt@[email protected]
[10]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-skl-iommu/igt@[email protected]
- fi-cml-u2: [PASS][11] -> [DMESG-WARN][12]
[11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-cml-u2/igt@[email protected]
[12]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-cml-u2/igt@[email protected]
- fi-ivb-3770: [PASS][13] -> [INCOMPLETE][14]
[13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-ivb-3770/igt@[email protected]
[14]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-ivb-3770/igt@[email protected]
- fi-skl-6700k2: [PASS][15] -> [INCOMPLETE][16]
[15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-skl-6700k2/igt@[email protected]
[16]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-skl-6700k2/igt@[email protected]
- fi-kbl-x1275: [PASS][17] -> [INCOMPLETE][18]
[17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-kbl-x1275/igt@[email protected]
[18]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-kbl-x1275/igt@[email protected]
- fi-cfl-guc: [PASS][19] -> [INCOMPLETE][20]
[19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-cfl-guc/igt@[email protected]
[20]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-cfl-guc/igt@[email protected]
- fi-skl-guc: [PASS][21] -> [INCOMPLETE][22]
[21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-skl-guc/igt@[email protected]
[22]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-skl-guc/igt@[email protected]
- fi-skl-6600u: [PASS][23] -> [INCOMPLETE][24]
[23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-skl-6600u/igt@[email protected]
[24]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-skl-6600u/igt@[email protected]
- fi-kbl-8809g: [PASS][25] -> [DMESG-WARN][26]
[25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-kbl-8809g/igt@[email protected]
[26]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-kbl-8809g/igt@[email protected]
- fi-kbl-r: [PASS][27] -> [INCOMPLETE][28]
[27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-kbl-r/igt@[email protected]
[28]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-kbl-r/igt@[email protected]
- fi-hsw-4770r: [PASS][29] -> [INCOMPLETE][30]
[29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-hsw-4770r/igt@[email protected]
[30]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-hsw-4770r/igt@[email protected]
- fi-skl-lmem: [PASS][31] -> [INCOMPLETE][32]
[31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-skl-lmem/igt@[email protected]
[32]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-skl-lmem/igt@[email protected]
- fi-bdw-5557u: [PASS][33] -> [INCOMPLETE][34]
[33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-bdw-5557u/igt@[email protected]
[34]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-bdw-5557u/igt@[email protected]
- fi-snb-2600: [PASS][35] -> [DMESG-WARN][36]
[35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-snb-2600/igt@[email protected]
[36]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-snb-2600/igt@[email protected]
- fi-skl-6260u: [PASS][37] -> [INCOMPLETE][38]
[37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-skl-6260u/igt@[email protected]
[38]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-skl-6260u/igt@[email protected]

* igt@gem_sync@basic-many-each:
- fi-kbl-guc: [PASS][39] -> [DMESG-WARN][40]
[39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-kbl-guc/igt@[email protected]
[40]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-kbl-guc/igt@[email protected]

* igt@gem_sync@basic-store-all:
- fi-hsw-peppy: [PASS][41] -> [INCOMPLETE][42]
[41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-hsw-peppy/igt@[email protected]
[42]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-hsw-peppy/igt@[email protected]
- fi-snb-2520m: [PASS][43] -> [DMESG-WARN][44]
[43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-snb-2520m/igt@[email protected]
[44]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-snb-2520m/igt@[email protected]
- fi-ilk-650: [PASS][45] -> [INCOMPLETE][46]
[45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-ilk-650/igt@[email protected]
[46]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-ilk-650/igt@[email protected]

* igt@i915_selftest@live_gem_contexts:
- fi-kbl-7500u: [PASS][47] -> [INCOMPLETE][48]
[47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-kbl-7500u/igt@i915_selftest@live_gem_contexts.html
[48]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-kbl-7500u/igt@i915_selftest@live_gem_contexts.html

* igt@runner@aborted:
- fi-snb-2520m: NOTRUN -> [FAIL][49]
[49]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-snb-2520m/igt@[email protected]
- fi-cml-u2: NOTRUN -> [FAIL][50]
[50]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-cml-u2/igt@[email protected]
- fi-kbl-8809g: NOTRUN -> [FAIL][51]
[51]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-kbl-8809g/igt@[email protected]
- fi-kbl-guc: NOTRUN -> [FAIL][52]
[52]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-kbl-guc/igt@[email protected]
- fi-snb-2600: NOTRUN -> [FAIL][53]
[53]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-snb-2600/igt@[email protected]

#### Suppressed ####

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

* igt@gem_sync@basic-many-each:
- {fi-icl-guc}: [PASS][54] -> [DMESG-WARN][55]
[54]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-icl-guc/igt@[email protected]
[55]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-icl-guc/igt@[email protected]

* igt@gem_sync@basic-store-all:
- {fi-kbl-soraka}: [PASS][56] -> [DMESG-WARN][57]
[56]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-kbl-soraka/igt@[email protected]
[57]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-kbl-soraka/igt@[email protected]

* igt@runner@aborted:
- {fi-kbl-soraka}: NOTRUN -> [FAIL][58]
[58]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-kbl-soraka/igt@[email protected]

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

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

### IGT changes ###

#### Issues hit ####

* igt@gem_exec_suspend@basic-s3:
- fi-blb-e6850: [PASS][59] -> [INCOMPLETE][60] ([fdo#107718])
[59]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-blb-e6850/igt@[email protected]
[60]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-blb-e6850/igt@[email protected]

* igt@gem_flink_basic@basic:
- fi-icl-u3: [PASS][61] -> [DMESG-WARN][62] ([fdo#107724])
[61]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-icl-u3/igt@[email protected]
[62]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-icl-u3/igt@[email protected]

* igt@gem_sync@basic-many-each:
- fi-icl-u3: [PASS][63] -> [INCOMPLETE][64] ([fdo#107713] / [fdo#109100])
[63]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-icl-u3/igt@[email protected]
[64]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-icl-u3/igt@[email protected]

* igt@gem_sync@basic-store-all:
- fi-bxt-dsi: [PASS][65] -> [INCOMPLETE][66] ([fdo#103927])
[65]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-bxt-dsi/igt@[email protected]
[66]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-bxt-dsi/igt@[email protected]

#### Possible fixes ####

* igt@gem_flink_basic@double-flink:
- fi-icl-u3: [DMESG-WARN][67] ([fdo#107724]) -> [PASS][68]
[67]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-icl-u3/igt@[email protected]
[68]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-icl-u3/igt@[email protected]

* igt@i915_selftest@live_hangcheck:
- fi-cfl-8109u: [INCOMPLETE][69] ([fdo#106070]) -> [PASS][70]
[69]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6996/fi-cfl-8109u/igt@i915_selftest@live_hangcheck.html
[70]: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/fi-cfl-8109u/igt@i915_selftest@live_hangcheck.html

{name}: This element is suppressed. This means it is ignored when computing
the status of the difference (SUCCESS, WARNING, or FAILURE).

[fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
[fdo#106070]: https://bugs.freedesktop.org/show_bug.cgi?id=106070
[fdo#106107]: https://bugs.freedesktop.org/show_bug.cgi?id=106107
[fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
[fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
[fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
[fdo#109100]: https://bugs.freedesktop.org/show_bug.cgi?id=109100
[fdo#110566]: https://bugs.freedesktop.org/show_bug.cgi?id=110566
[fdo#111880]: https://bugs.freedesktop.org/show_bug.cgi?id=111880

Participating hosts (52 -> 45)
------------------------------

Missing (7): fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-icl-y fi-byt-clapper fi-bdw-samus

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

* CI: CI-20190529 -> None
* Linux: CI_DRM_6996 -> Patchwork_14646

CI-20190529: 20190529
CI_DRM_6996: 98596d29a3cff9d996c42468eb606036faf42954 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_5210: 74f55119f9920b65996535210a09147997804136 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_14646: 5b79c16952ebff9bf8af17ec9533207eeea64d99 @ git://anongit.freedesktop.org/gfx-ci/linux

== Linux commits ==

5b79c16952eb dma-fence: Use non-atomic bitops while under the lock

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_14646/index.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
In reply to Tvrtko Ursulin
Quoted 18 lines · Tvrtko Ursulin

From: Tvrtko Ursulin <[email protected]>

We do not have to use atomic bitops when already under the spinlock.

Saves on a handful of lock instruction prefixes, on x86 at least.

---
  drivers/dma-buf/dma-fence.c | 14 +++++++-------
  1 file changed, 7 insertions(+), 7 deletions(-)
drivers/dma-buf/dma-fence.c +0 -0
index 2c136aee3e79..f0b480042e2f 100644

drivers/dma-buf/dma-fence.c int dma_fence_signal_locked(struct dma_fence *fence) · line 137

Quoted 7 lines
drivers/dma-buf/dma-fence.c +2 -2
@@ -133,15 +133,15 @@ int dma_fence_signal_locked(struct dma_fence *fence)
 
  	lockdep_assert_held(fence->lock);
 
-	if (unlikely(test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
-				      &fence->flags)))
+	if (unlikely(__test_and_set_bit(DMA_FENCE_FLAG_SIGNALED_BIT,
+					&fence->flags)))

This breaks left right and center so I guess it is more subtle than this!

Regards,

Tvrtko

Quoted 24 lines
drivers/dma-buf/dma-fence.c +3 -3
  		return -EINVAL;
 
  	/* Stash the cb_list before replacing it with the timestamp */
  	list_replace(&fence->cb_list, &cb_list);
 
  	fence->timestamp = ktime_get();
-	set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
+	__set_bit(DMA_FENCE_FLAG_TIMESTAMP_BIT, &fence->flags);
  	trace_dma_fence_signaled(fence);
 
  	list_for_each_entry_safe(cur, tmp, &cb_list, node) {
@@ -343,8 +343,8 @@ int dma_fence_add_callback(struct dma_fence *fence, struct dma_fence_cb *cb,
 
  	spin_lock_irqsave(fence->lock, flags);
 
-	was_set = test_and_set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
-				   &fence->flags);
+	was_set = __test_and_set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
+				     &fence->flags);
 
  	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
  		ret = -ENOENT;

drivers/dma-buf/dma-fence.c dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout) · line 480

Quoted 10 lines
drivers/dma-buf/dma-fence.c +2 -2
@@ -473,8 +473,8 @@ dma_fence_default_wait(struct dma_fence *fence, bool intr, signed long timeout)
  		goto out;
  	}
 
-	was_set = test_and_set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
-				   &fence->flags);
+	was_set = __test_and_set_bit(DMA_FENCE_FLAG_ENABLE_SIGNAL_BIT,
+				     &fence->flags);
 
  	if (test_bit(DMA_FENCE_FLAG_SIGNALED_BIT, &fence->flags))
  		goto out;

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel