All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t 1/4] tests: add libatomic dependency
@ 2019-06-03 11:54 ` Guillaume Tucker
  0 siblings, 0 replies; 28+ messages in thread
From: Guillaume Tucker @ 2019-06-03 11:54 UTC (permalink / raw)
  To: Arkadiusz Hiler, Petri Latvala; +Cc: igt-dev, intel-gfx

Add dependency to libatomic in order to be able to use the __atomic_*
functions instead of the older __sync_* ones.  This is to enable
atomic operations on a wider number of architectures including MIPS.

Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
---
 meson.build       | 1 +
 tests/meson.build | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 6268c58d3634..4e5bb323fa49 100644
--- a/meson.build
+++ b/meson.build
@@ -179,6 +179,7 @@ math = cc.find_library('m')
 realtime = cc.find_library('rt')
 dlsym = cc.find_library('dl')
 zlib = cc.find_library('z')
+libatomic = cc.find_library('atomic')
 
 if cc.has_header('linux/kd.h')
 	config.set('HAVE_LINUX_KD_H', 1)
diff --git a/tests/meson.build b/tests/meson.build
index 806766e51667..6877ccd59235 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -233,7 +233,7 @@ i915_progs = [
 	'i915_suspend',
 ]
 
-test_deps = [ igt_deps ]
+test_deps = [ igt_deps, libatomic ]
 
 if libdrm_nouveau.found()
 	test_progs += [
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [igt-dev] [PATCH i-g-t 1/4] tests: add libatomic dependency
@ 2019-06-03 11:54 ` Guillaume Tucker
  0 siblings, 0 replies; 28+ messages in thread
From: Guillaume Tucker @ 2019-06-03 11:54 UTC (permalink / raw)
  To: Arkadiusz Hiler, Petri Latvala; +Cc: igt-dev, intel-gfx

Add dependency to libatomic in order to be able to use the __atomic_*
functions instead of the older __sync_* ones.  This is to enable
atomic operations on a wider number of architectures including MIPS.

Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
---
 meson.build       | 1 +
 tests/meson.build | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 6268c58d3634..4e5bb323fa49 100644
--- a/meson.build
+++ b/meson.build
@@ -179,6 +179,7 @@ math = cc.find_library('m')
 realtime = cc.find_library('rt')
 dlsym = cc.find_library('dl')
 zlib = cc.find_library('z')
+libatomic = cc.find_library('atomic')
 
 if cc.has_header('linux/kd.h')
 	config.set('HAVE_LINUX_KD_H', 1)
diff --git a/tests/meson.build b/tests/meson.build
index 806766e51667..6877ccd59235 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -233,7 +233,7 @@ i915_progs = [
 	'i915_suspend',
 ]
 
-test_deps = [ igt_deps ]
+test_deps = [ igt_deps, libatomic ]
 
 if libdrm_nouveau.found()
 	test_progs += [
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH i-g-t 2/4] gitlab-ci: add libatomic to Fedora docker image
  2019-06-03 11:54 ` [igt-dev] " Guillaume Tucker
@ 2019-06-03 11:54   ` Guillaume Tucker
  -1 siblings, 0 replies; 28+ messages in thread
From: Guillaume Tucker @ 2019-06-03 11:54 UTC (permalink / raw)
  To: Arkadiusz Hiler, Petri Latvala; +Cc: igt-dev, intel-gfx

Add libatomic to the Fedora docker image so it can link binaries that
use __atomic_* functions.

Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
---
 Dockerfile.fedora | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Dockerfile.fedora b/Dockerfile.fedora
index 6686e587613d..c84b412b0723 100644
--- a/Dockerfile.fedora
+++ b/Dockerfile.fedora
@@ -1,7 +1,7 @@
 FROM fedora:30
 
 RUN dnf install -y \
-	gcc flex bison meson ninja-build xdotool \
+	gcc flex bison libatomic meson ninja-build xdotool \
 	'pkgconfig(libdrm)' \
 	'pkgconfig(pciaccess)' \
 	'pkgconfig(libkmod)' \
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [igt-dev] [PATCH i-g-t 2/4] gitlab-ci: add libatomic to Fedora docker image
@ 2019-06-03 11:54   ` Guillaume Tucker
  0 siblings, 0 replies; 28+ messages in thread
From: Guillaume Tucker @ 2019-06-03 11:54 UTC (permalink / raw)
  To: Arkadiusz Hiler, Petri Latvala; +Cc: igt-dev, intel-gfx

Add libatomic to the Fedora docker image so it can link binaries that
use __atomic_* functions.

Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
---
 Dockerfile.fedora | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Dockerfile.fedora b/Dockerfile.fedora
index 6686e587613d..c84b412b0723 100644
--- a/Dockerfile.fedora
+++ b/Dockerfile.fedora
@@ -1,7 +1,7 @@
 FROM fedora:30
 
 RUN dnf install -y \
-	gcc flex bison meson ninja-build xdotool \
+	gcc flex bison libatomic meson ninja-build xdotool \
 	'pkgconfig(libdrm)' \
 	'pkgconfig(pciaccess)' \
 	'pkgconfig(libkmod)' \
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH i-g-t 3/4] i915/gem_create: use __atomic_* instead of __sync_*
  2019-06-03 11:54 ` [igt-dev] " Guillaume Tucker
@ 2019-06-03 11:54   ` Guillaume Tucker
  -1 siblings, 0 replies; 28+ messages in thread
From: Guillaume Tucker @ 2019-06-03 11:54 UTC (permalink / raw)
  To: Arkadiusz Hiler, Petri Latvala; +Cc: igt-dev, intel-gfx

Replace calls to the older __sync_* functions with the new __atomic_*
standard ones.  This fixes builds on some architectures, in particular
MIPS which doesn't have __sync_add_and_fetch_8 and
__sync_val_compare_and_swap_8 for 64-bit variable handling.

Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
---
 tests/Makefile.am       |  2 +-
 tests/i915/gem_create.c | 12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5097debf629c..18a0f1f20592 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -90,7 +90,7 @@ AM_LDFLAGS = -Wl,--as-needed
 drm_import_export_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 drm_import_export_LDADD = $(LDADD) -lpthread
 gem_create_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
-gem_create_LDADD = $(LDADD) -lpthread
+gem_create_LDADD = $(LDADD) -lpthread -latomic
 gem_close_race_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 gem_close_race_LDADD = $(LDADD) -lpthread
 gem_ctx_thrash_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
index 43cbf45f289b..a4aeb94b3f93 100644
--- a/tests/i915/gem_create.c
+++ b/tests/i915/gem_create.c
@@ -156,6 +156,14 @@ static void invalid_nonaligned_size(int fd)
 	gem_close(fd, create.handle);
 }
 
+static uint64_t atomic_compare_swap_u64(uint64_t *ptr, uint64_t oldval,
+					uint64_t newval)
+{
+	__atomic_compare_exchange_n(ptr, &oldval, newval, 0,
+				    __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+	return oldval;
+}
+
 static uint64_t get_npages(uint64_t *global, uint64_t npages)
 {
 	uint64_t try, old, max;
@@ -165,7 +173,7 @@ static uint64_t get_npages(uint64_t *global, uint64_t npages)
 		old = max;
 		try = 1 + npages % (max / 2);
 		max -= try;
-	} while ((max = __sync_val_compare_and_swap(global, old, max)) != old);
+	} while ((max = atomic_compare_swap_u64(global, old, max)) != old);
 
 	return try;
 }
@@ -202,7 +210,7 @@ static void *thread_clear(void *data)
 		}
 		gem_close(i915, create.handle);
 
-		__sync_add_and_fetch(&arg->max, npages);
+		__atomic_add_fetch(&arg->max, npages, __ATOMIC_SEQ_CST);
 	}
 
 	return NULL;
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [igt-dev] [PATCH i-g-t 3/4] i915/gem_create: use __atomic_* instead of __sync_*
@ 2019-06-03 11:54   ` Guillaume Tucker
  0 siblings, 0 replies; 28+ messages in thread
From: Guillaume Tucker @ 2019-06-03 11:54 UTC (permalink / raw)
  To: Arkadiusz Hiler, Petri Latvala; +Cc: igt-dev, intel-gfx

Replace calls to the older __sync_* functions with the new __atomic_*
standard ones.  This fixes builds on some architectures, in particular
MIPS which doesn't have __sync_add_and_fetch_8 and
__sync_val_compare_and_swap_8 for 64-bit variable handling.

Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
---
 tests/Makefile.am       |  2 +-
 tests/i915/gem_create.c | 12 ++++++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5097debf629c..18a0f1f20592 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -90,7 +90,7 @@ AM_LDFLAGS = -Wl,--as-needed
 drm_import_export_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 drm_import_export_LDADD = $(LDADD) -lpthread
 gem_create_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
-gem_create_LDADD = $(LDADD) -lpthread
+gem_create_LDADD = $(LDADD) -lpthread -latomic
 gem_close_race_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 gem_close_race_LDADD = $(LDADD) -lpthread
 gem_ctx_thrash_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
index 43cbf45f289b..a4aeb94b3f93 100644
--- a/tests/i915/gem_create.c
+++ b/tests/i915/gem_create.c
@@ -156,6 +156,14 @@ static void invalid_nonaligned_size(int fd)
 	gem_close(fd, create.handle);
 }
 
+static uint64_t atomic_compare_swap_u64(uint64_t *ptr, uint64_t oldval,
+					uint64_t newval)
+{
+	__atomic_compare_exchange_n(ptr, &oldval, newval, 0,
+				    __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
+	return oldval;
+}
+
 static uint64_t get_npages(uint64_t *global, uint64_t npages)
 {
 	uint64_t try, old, max;
@@ -165,7 +173,7 @@ static uint64_t get_npages(uint64_t *global, uint64_t npages)
 		old = max;
 		try = 1 + npages % (max / 2);
 		max -= try;
-	} while ((max = __sync_val_compare_and_swap(global, old, max)) != old);
+	} while ((max = atomic_compare_swap_u64(global, old, max)) != old);
 
 	return try;
 }
@@ -202,7 +210,7 @@ static void *thread_clear(void *data)
 		}
 		gem_close(i915, create.handle);
 
-		__sync_add_and_fetch(&arg->max, npages);
+		__atomic_add_fetch(&arg->max, npages, __ATOMIC_SEQ_CST);
 	}
 
 	return NULL;
-- 
2.20.1

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [PATCH i-g-t 4/4] tests/sw_sync: use __atomic_* instead of __sync_*
  2019-06-03 11:54 ` [igt-dev] " Guillaume Tucker
@ 2019-06-03 11:54   ` Guillaume Tucker
  -1 siblings, 0 replies; 28+ messages in thread
From: Guillaume Tucker @ 2019-06-03 11:54 UTC (permalink / raw)
  To: Arkadiusz Hiler, Petri Latvala; +Cc: igt-dev, intel-gfx

Replace calls to the older __sync_* functions with the new __atomic_*
standard ones to be consistent with other tests and improve
portability across CPU architectures.

Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
---
 tests/Makefile.am | 1 +
 tests/sw_sync.c   | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 18a0f1f20592..71514d4d2e5a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -121,6 +121,7 @@ prime_self_import_LDADD = $(LDADD) -lpthread
 gem_userptr_blits_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 gem_userptr_blits_LDADD = $(LDADD) -lpthread
 perf_pmu_LDADD = $(LDADD) $(top_builddir)/lib/libigt_perf.la
+sw_sync_LDADD = $(LDADD) -latomic
 
 kms_flip_LDADD = $(LDADD) -lpthread
 
diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 950b8b614759..2ee1e1c60b32 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -517,7 +517,7 @@ static void test_sync_multi_consumer(void)
 	{
 		sem_wait(&sem);
 
-		__sync_fetch_and_add(&counter, 1);
+		__atomic_fetch_add(&counter, 1, __ATOMIC_SEQ_CST);
 		sw_sync_timeline_inc(timeline, 1);
 	}
 
@@ -554,7 +554,8 @@ static void * test_sync_multi_consumer_producer_thread(void *arg)
 		if (sync_fence_wait(fence, 1000) < 0)
 			return (void *) 1;
 
-		if (__sync_fetch_and_add(data->counter, 1) != next_point)
+		if (__atomic_fetch_add(data->counter, 1, __ATOMIC_SEQ_CST) !=
+		    next_point)
 			return (void *) 1;
 
 		/* Kick off the next thread. */
@@ -900,4 +901,3 @@ igt_main
 	igt_subtest("sync_random_merge")
 		test_sync_random_merge();
 }
-
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [Intel-gfx] [PATCH i-g-t 4/4] tests/sw_sync: use __atomic_* instead of __sync_*
@ 2019-06-03 11:54   ` Guillaume Tucker
  0 siblings, 0 replies; 28+ messages in thread
From: Guillaume Tucker @ 2019-06-03 11:54 UTC (permalink / raw)
  To: Arkadiusz Hiler, Petri Latvala; +Cc: igt-dev, intel-gfx

Replace calls to the older __sync_* functions with the new __atomic_*
standard ones to be consistent with other tests and improve
portability across CPU architectures.

Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
---
 tests/Makefile.am | 1 +
 tests/sw_sync.c   | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 18a0f1f20592..71514d4d2e5a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -121,6 +121,7 @@ prime_self_import_LDADD = $(LDADD) -lpthread
 gem_userptr_blits_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
 gem_userptr_blits_LDADD = $(LDADD) -lpthread
 perf_pmu_LDADD = $(LDADD) $(top_builddir)/lib/libigt_perf.la
+sw_sync_LDADD = $(LDADD) -latomic
 
 kms_flip_LDADD = $(LDADD) -lpthread
 
diff --git a/tests/sw_sync.c b/tests/sw_sync.c
index 950b8b614759..2ee1e1c60b32 100644
--- a/tests/sw_sync.c
+++ b/tests/sw_sync.c
@@ -517,7 +517,7 @@ static void test_sync_multi_consumer(void)
 	{
 		sem_wait(&sem);
 
-		__sync_fetch_and_add(&counter, 1);
+		__atomic_fetch_add(&counter, 1, __ATOMIC_SEQ_CST);
 		sw_sync_timeline_inc(timeline, 1);
 	}
 
@@ -554,7 +554,8 @@ static void * test_sync_multi_consumer_producer_thread(void *arg)
 		if (sync_fence_wait(fence, 1000) < 0)
 			return (void *) 1;
 
-		if (__sync_fetch_and_add(data->counter, 1) != next_point)
+		if (__atomic_fetch_add(data->counter, 1, __ATOMIC_SEQ_CST) !=
+		    next_point)
 			return (void *) 1;
 
 		/* Kick off the next thread. */
@@ -900,4 +901,3 @@ igt_main
 	igt_subtest("sync_random_merge")
 		test_sync_random_merge();
 }
-
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 28+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] tests: add libatomic dependency
  2019-06-03 11:54 ` [igt-dev] " Guillaume Tucker
                   ` (3 preceding siblings ...)
  (?)
@ 2019-06-03 13:04 ` Patchwork
  -1 siblings, 0 replies; 28+ messages in thread
From: Patchwork @ 2019-06-03 13:04 UTC (permalink / raw)
  To: Guillaume Tucker; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,1/4] tests: add libatomic dependency
URL   : https://patchwork.freedesktop.org/series/61515/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6180 -> IGTPW_3093
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/61515/revisions/1/mbox/

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

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

### IGT changes ###

#### Issues hit ####

  * igt@i915_selftest@live_gtt:
    - fi-glk-dsi:         [PASS][1] -> [INCOMPLETE][2] ([fdo#103359] / [k.org#198133])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/fi-glk-dsi/igt@i915_selftest@live_gtt.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/fi-glk-dsi/igt@i915_selftest@live_gtt.html

  
#### Possible fixes ####

  * igt@gem_exec_reloc@basic-write-gtt-noreloc:
    - fi-icl-u3:          [DMESG-WARN][3] ([fdo#107724]) -> [PASS][4]
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/fi-icl-u3/igt@gem_exec_reloc@basic-write-gtt-noreloc.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/fi-icl-u3/igt@gem_exec_reloc@basic-write-gtt-noreloc.html

  * igt@gem_exec_suspend@basic-s3:
    - fi-blb-e6850:       [INCOMPLETE][5] ([fdo#107718]) -> [PASS][6]
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/fi-blb-e6850/igt@gem_exec_suspend@basic-s3.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/fi-blb-e6850/igt@gem_exec_suspend@basic-s3.html

  
  [fdo#103359]: https://bugs.freedesktop.org/show_bug.cgi?id=103359
  [fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
  [fdo#107724]: https://bugs.freedesktop.org/show_bug.cgi?id=107724
  [k.org#198133]: https://bugzilla.kernel.org/show_bug.cgi?id=198133


Participating hosts (51 -> 46)
------------------------------

  Additional (1): fi-skl-6770hq 
  Missing    (6): fi-ilk-m540 fi-hsw-4200u fi-bsw-cyan fi-kbl-7560u fi-byt-clapper fi-bdw-samus 


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

  * IGT: IGT_5027 -> IGTPW_3093

  CI_DRM_6180: e724dd1cacd9da18b18808880a13b0cb33ddd3d7 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_3093: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/
  IGT_5027: c998ca40a12933a0cefbe6b99c916eae32846919 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/4] tests: add libatomic dependency
  2019-06-03 11:54 ` [igt-dev] " Guillaume Tucker
                   ` (4 preceding siblings ...)
  (?)
@ 2019-06-03 16:38 ` Patchwork
  -1 siblings, 0 replies; 28+ messages in thread
From: Patchwork @ 2019-06-03 16:38 UTC (permalink / raw)
  To: Guillaume Tucker; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,1/4] tests: add libatomic dependency
URL   : https://patchwork.freedesktop.org/series/61515/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_6180_full -> IGTPW_3093_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/61515/revisions/1/mbox/

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

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

### IGT changes ###

#### Issues hit ####

  * igt@gem_mmap_gtt@forked-big-copy:
    - shard-iclb:         [PASS][1] -> [INCOMPLETE][2] ([fdo#107713] / [fdo#109100])
   [1]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-iclb4/igt@gem_mmap_gtt@forked-big-copy.html
   [2]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-iclb3/igt@gem_mmap_gtt@forked-big-copy.html

  * igt@i915_pm_rps@reset:
    - shard-apl:          [PASS][3] -> [FAIL][4] ([fdo#102250])
   [3]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-apl7/igt@i915_pm_rps@reset.html
   [4]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-apl8/igt@i915_pm_rps@reset.html
    - shard-glk:          [PASS][5] -> [FAIL][6] ([fdo#102250])
   [5]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-glk4/igt@i915_pm_rps@reset.html
   [6]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-glk3/igt@i915_pm_rps@reset.html

  * igt@i915_suspend@debugfs-reader:
    - shard-apl:          [PASS][7] -> [DMESG-WARN][8] ([fdo#108566]) +3 similar issues
   [7]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-apl8/igt@i915_suspend@debugfs-reader.html
   [8]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-apl6/igt@i915_suspend@debugfs-reader.html

  * igt@kms_cursor_crc@pipe-b-cursor-alpha-opaque:
    - shard-apl:          [PASS][9] -> [FAIL][10] ([fdo#103232])
   [9]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-apl3/igt@kms_cursor_crc@pipe-b-cursor-alpha-opaque.html
   [10]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-apl6/igt@kms_cursor_crc@pipe-b-cursor-alpha-opaque.html
    - shard-kbl:          [PASS][11] -> [FAIL][12] ([fdo#103232])
   [11]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-kbl6/igt@kms_cursor_crc@pipe-b-cursor-alpha-opaque.html
   [12]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-kbl2/igt@kms_cursor_crc@pipe-b-cursor-alpha-opaque.html

  * igt@kms_cursor_legacy@cursor-vs-flip-atomic:
    - shard-hsw:          [PASS][13] -> [FAIL][14] ([fdo#103355])
   [13]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-hsw8/igt@kms_cursor_legacy@cursor-vs-flip-atomic.html
   [14]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-hsw8/igt@kms_cursor_legacy@cursor-vs-flip-atomic.html

  * igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-shrfb-draw-mmap-cpu:
    - shard-hsw:          [PASS][15] -> [SKIP][16] ([fdo#109271]) +3 similar issues
   [15]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-hsw2/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-shrfb-draw-mmap-cpu.html
   [16]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-hsw1/igt@kms_frontbuffer_tracking@fbc-2p-scndscrn-pri-shrfb-draw-mmap-cpu.html

  * igt@kms_frontbuffer_tracking@fbc-stridechange:
    - shard-snb:          [PASS][17] -> [SKIP][18] ([fdo#109271])
   [17]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-snb2/igt@kms_frontbuffer_tracking@fbc-stridechange.html
   [18]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-snb6/igt@kms_frontbuffer_tracking@fbc-stridechange.html

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-render:
    - shard-iclb:         [PASS][19] -> [FAIL][20] ([fdo#103167]) +1 similar issue
   [19]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-iclb6/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-render.html
   [20]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-shrfb-draw-render.html

  * igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes:
    - shard-kbl:          [PASS][21] -> [INCOMPLETE][22] ([fdo#103665])
   [21]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-kbl4/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes.html
   [22]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-kbl3/igt@kms_plane@plane-panning-bottom-right-suspend-pipe-a-planes.html

  * igt@kms_plane_lowres@pipe-a-tiling-y:
    - shard-iclb:         [PASS][23] -> [FAIL][24] ([fdo#103166])
   [23]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-iclb2/igt@kms_plane_lowres@pipe-a-tiling-y.html
   [24]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-iclb8/igt@kms_plane_lowres@pipe-a-tiling-y.html

  * igt@kms_psr2_su@frontbuffer:
    - shard-iclb:         [PASS][25] -> [SKIP][26] ([fdo#109642])
   [25]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-iclb2/igt@kms_psr2_su@frontbuffer.html
   [26]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-iclb7/igt@kms_psr2_su@frontbuffer.html

  * igt@kms_psr@psr2_cursor_plane_onoff:
    - shard-iclb:         [PASS][27] -> [SKIP][28] ([fdo#109441]) +2 similar issues
   [27]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-iclb2/igt@kms_psr@psr2_cursor_plane_onoff.html
   [28]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-iclb7/igt@kms_psr@psr2_cursor_plane_onoff.html

  
#### Possible fixes ####

  * igt@gem_eio@unwedge-stress:
    - shard-snb:          [FAIL][29] ([fdo#109661]) -> [PASS][30] +1 similar issue
   [29]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-snb6/igt@gem_eio@unwedge-stress.html
   [30]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-snb2/igt@gem_eio@unwedge-stress.html

  * igt@i915_pm_rpm@gem-evict-pwrite:
    - shard-iclb:         [INCOMPLETE][31] ([fdo#107713] / [fdo#108840]) -> [PASS][32]
   [31]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-iclb7/igt@i915_pm_rpm@gem-evict-pwrite.html
   [32]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-iclb1/igt@i915_pm_rpm@gem-evict-pwrite.html

  * igt@kms_color@pipe-c-ctm-blue-to-red:
    - shard-kbl:          [FAIL][33] ([fdo#107201]) -> [PASS][34]
   [33]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-kbl2/igt@kms_color@pipe-c-ctm-blue-to-red.html
   [34]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-kbl6/igt@kms_color@pipe-c-ctm-blue-to-red.html
    - shard-apl:          [FAIL][35] ([fdo#107201]) -> [PASS][36]
   [35]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-apl3/igt@kms_color@pipe-c-ctm-blue-to-red.html
   [36]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-apl4/igt@kms_color@pipe-c-ctm-blue-to-red.html

  * igt@kms_dp_dsc@basic-dsc-enable-edp:
    - shard-iclb:         [SKIP][37] ([fdo#109349]) -> [PASS][38]
   [37]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-iclb6/igt@kms_dp_dsc@basic-dsc-enable-edp.html
   [38]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-iclb2/igt@kms_dp_dsc@basic-dsc-enable-edp.html

  * igt@kms_flip@2x-plain-flip:
    - shard-hsw:          [SKIP][39] ([fdo#109271]) -> [PASS][40] +4 similar issues
   [39]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-hsw1/igt@kms_flip@2x-plain-flip.html
   [40]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-hsw4/igt@kms_flip@2x-plain-flip.html

  * igt@kms_flip@dpms-vs-vblank-race:
    - shard-glk:          [FAIL][41] ([fdo#103060]) -> [PASS][42]
   [41]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-glk1/igt@kms_flip@dpms-vs-vblank-race.html
   [42]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-glk9/igt@kms_flip@dpms-vs-vblank-race.html

  * igt@kms_flip@flip-vs-suspend:
    - shard-hsw:          [INCOMPLETE][43] ([fdo#103540]) -> [PASS][44]
   [43]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-hsw1/igt@kms_flip@flip-vs-suspend.html
   [44]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-hsw2/igt@kms_flip@flip-vs-suspend.html

  * igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-render:
    - shard-iclb:         [FAIL][45] ([fdo#103167]) -> [PASS][46] +3 similar issues
   [45]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-iclb2/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-render.html
   [46]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-iclb6/igt@kms_frontbuffer_tracking@fbcpsr-1p-primscrn-pri-indfb-draw-render.html

  * igt@kms_psr@psr2_sprite_plane_move:
    - shard-iclb:         [SKIP][47] ([fdo#109441]) -> [PASS][48] +2 similar issues
   [47]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-iclb5/igt@kms_psr@psr2_sprite_plane_move.html
   [48]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-iclb2/igt@kms_psr@psr2_sprite_plane_move.html

  * igt@kms_sysfs_edid_timing:
    - shard-iclb:         [FAIL][49] ([fdo#100047]) -> [PASS][50]
   [49]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-iclb3/igt@kms_sysfs_edid_timing.html
   [50]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-iclb8/igt@kms_sysfs_edid_timing.html

  * igt@kms_vblank@pipe-c-ts-continuation-suspend:
    - shard-apl:          [DMESG-WARN][51] ([fdo#108566]) -> [PASS][52] +7 similar issues
   [51]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-apl1/igt@kms_vblank@pipe-c-ts-continuation-suspend.html
   [52]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-apl3/igt@kms_vblank@pipe-c-ts-continuation-suspend.html

  
#### Warnings ####

  * igt@gem_mmap_gtt@forked-big-copy-odd:
    - shard-iclb:         [TIMEOUT][53] ([fdo#109673]) -> [INCOMPLETE][54] ([fdo#107713] / [fdo#109100]) +1 similar issue
   [53]: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_6180/shard-iclb8/igt@gem_mmap_gtt@forked-big-copy-odd.html
   [54]: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/shard-iclb4/igt@gem_mmap_gtt@forked-big-copy-odd.html

  
  [fdo#100047]: https://bugs.freedesktop.org/show_bug.cgi?id=100047
  [fdo#102250]: https://bugs.freedesktop.org/show_bug.cgi?id=102250
  [fdo#103060]: https://bugs.freedesktop.org/show_bug.cgi?id=103060
  [fdo#103166]: https://bugs.freedesktop.org/show_bug.cgi?id=103166
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103355]: https://bugs.freedesktop.org/show_bug.cgi?id=103355
  [fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#107201]: https://bugs.freedesktop.org/show_bug.cgi?id=107201
  [fdo#107713]: https://bugs.freedesktop.org/show_bug.cgi?id=107713
  [fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
  [fdo#108840]: https://bugs.freedesktop.org/show_bug.cgi?id=108840
  [fdo#109100]: https://bugs.freedesktop.org/show_bug.cgi?id=109100
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109349]: https://bugs.freedesktop.org/show_bug.cgi?id=109349
  [fdo#109441]: https://bugs.freedesktop.org/show_bug.cgi?id=109441
  [fdo#109642]: https://bugs.freedesktop.org/show_bug.cgi?id=109642
  [fdo#109661]: https://bugs.freedesktop.org/show_bug.cgi?id=109661
  [fdo#109673]: https://bugs.freedesktop.org/show_bug.cgi?id=109673


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

  Missing    (4): pig-skl-6260u shard-skl pig-hsw-4770r pig-glk-j5005 


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

  * IGT: IGT_5027 -> IGTPW_3093
  * Piglit: piglit_4509 -> None

  CI_DRM_6180: e724dd1cacd9da18b18808880a13b0cb33ddd3d7 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_3093: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/
  IGT_5027: c998ca40a12933a0cefbe6b99c916eae32846919 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_3093/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/4] tests: add libatomic dependency
  2019-06-03 11:54 ` [igt-dev] " Guillaume Tucker
@ 2019-06-06  7:18   ` Ser, Simon
  -1 siblings, 0 replies; 28+ messages in thread
From: Ser, Simon @ 2019-06-06  7:18 UTC (permalink / raw)
  To: guillaume.tucker, Hiler, Arkadiusz, Latvala, Petri; +Cc: igt-dev, intel-gfx

On Mon, 2019-06-03 at 12:54 +0100, Guillaume Tucker wrote:
> Add dependency to libatomic in order to be able to use the __atomic_*
> functions instead of the older __sync_* ones.  This is to enable
> atomic operations on a wider number of architectures including MIPS.

Thanks for your patch! I have a few questions because I don't know well
how libatomic works.

Do we want to always link against libatomic? For instance LLVM tries to
compile a program with atomic before falling back to libatomic:
https://github.com/llvm-mirror/llvm/blob/master/cmake/modules/CheckAtomic.cmake

Should this dependency be mandatory?

> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
> ---
>  meson.build       | 1 +
>  tests/meson.build | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 6268c58d3634..4e5bb323fa49 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -179,6 +179,7 @@ math = cc.find_library('m')
>  realtime = cc.find_library('rt')
>  dlsym = cc.find_library('dl')
>  zlib = cc.find_library('z')
> +libatomic = cc.find_library('atomic')
>  
>  if cc.has_header('linux/kd.h')
>  	config.set('HAVE_LINUX_KD_H', 1)
> diff --git a/tests/meson.build b/tests/meson.build
> index 806766e51667..6877ccd59235 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -233,7 +233,7 @@ i915_progs = [
>  	'i915_suspend',
>  ]
>  
> -test_deps = [ igt_deps ]
> +test_deps = [ igt_deps, libatomic ]
>  
>  if libdrm_nouveau.found()
>  	test_progs += [
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/4] tests: add libatomic dependency
@ 2019-06-06  7:18   ` Ser, Simon
  0 siblings, 0 replies; 28+ messages in thread
From: Ser, Simon @ 2019-06-06  7:18 UTC (permalink / raw)
  To: guillaume.tucker, Hiler, Arkadiusz, Latvala, Petri; +Cc: igt-dev, intel-gfx

On Mon, 2019-06-03 at 12:54 +0100, Guillaume Tucker wrote:
> Add dependency to libatomic in order to be able to use the __atomic_*
> functions instead of the older __sync_* ones.  This is to enable
> atomic operations on a wider number of architectures including MIPS.

Thanks for your patch! I have a few questions because I don't know well
how libatomic works.

Do we want to always link against libatomic? For instance LLVM tries to
compile a program with atomic before falling back to libatomic:
https://github.com/llvm-mirror/llvm/blob/master/cmake/modules/CheckAtomic.cmake

Should this dependency be mandatory?

> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
> ---
>  meson.build       | 1 +
>  tests/meson.build | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/meson.build b/meson.build
> index 6268c58d3634..4e5bb323fa49 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -179,6 +179,7 @@ math = cc.find_library('m')
>  realtime = cc.find_library('rt')
>  dlsym = cc.find_library('dl')
>  zlib = cc.find_library('z')
> +libatomic = cc.find_library('atomic')
>  
>  if cc.has_header('linux/kd.h')
>  	config.set('HAVE_LINUX_KD_H', 1)
> diff --git a/tests/meson.build b/tests/meson.build
> index 806766e51667..6877ccd59235 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -233,7 +233,7 @@ i915_progs = [
>  	'i915_suspend',
>  ]
>  
> -test_deps = [ igt_deps ]
> +test_deps = [ igt_deps, libatomic ]
>  
>  if libdrm_nouveau.found()
>  	test_progs += [
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH i-g-t 1/4] tests: add libatomic dependency
  2019-06-03 11:54 ` [igt-dev] " Guillaume Tucker
@ 2019-06-06  7:19   ` Arkadiusz Hiler
  -1 siblings, 0 replies; 28+ messages in thread
From: Arkadiusz Hiler @ 2019-06-06  7:19 UTC (permalink / raw)
  To: Guillaume Tucker; +Cc: igt-dev, intel-gfx

On Mon, Jun 03, 2019 at 12:54:47PM +0100, Guillaume Tucker wrote:
> Add dependency to libatomic in order to be able to use the __atomic_*
> functions instead of the older __sync_* ones.  This is to enable
> atomic operations on a wider number of architectures including MIPS.
> 
> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>

Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

This points out that we need some cleanups in tests/meson.build, as it's
getting a bit messy with some of the test using igt_desp and others
test_deps, but that's out of the sope of this series.

Seems like for autotools we already have it:

% ag -G Makefile atomic
tests/Makefile.am
93:gem_create_LDADD = $(LDADD) -lpthread -latomic
125:sw_sync_LDADD = $(LDADD) -latomic
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Intel-gfx] [PATCH i-g-t 1/4] tests: add libatomic dependency
@ 2019-06-06  7:19   ` Arkadiusz Hiler
  0 siblings, 0 replies; 28+ messages in thread
From: Arkadiusz Hiler @ 2019-06-06  7:19 UTC (permalink / raw)
  To: Guillaume Tucker; +Cc: igt-dev, intel-gfx

On Mon, Jun 03, 2019 at 12:54:47PM +0100, Guillaume Tucker wrote:
> Add dependency to libatomic in order to be able to use the __atomic_*
> functions instead of the older __sync_* ones.  This is to enable
> atomic operations on a wider number of architectures including MIPS.
> 
> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>

Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

This points out that we need some cleanups in tests/meson.build, as it's
getting a bit messy with some of the test using igt_desp and others
test_deps, but that's out of the sope of this series.

Seems like for autotools we already have it:

% ag -G Makefile atomic
tests/Makefile.am
93:gem_create_LDADD = $(LDADD) -lpthread -latomic
125:sw_sync_LDADD = $(LDADD) -latomic
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 3/4] i915/gem_create: use __atomic_* instead of __sync_*
  2019-06-03 11:54   ` [igt-dev] " Guillaume Tucker
@ 2019-06-06  7:20     ` Ser, Simon
  -1 siblings, 0 replies; 28+ messages in thread
From: Ser, Simon @ 2019-06-06  7:20 UTC (permalink / raw)
  To: guillaume.tucker, Hiler, Arkadiusz, Latvala, Petri; +Cc: igt-dev, intel-gfx

On Mon, 2019-06-03 at 12:54 +0100, Guillaume Tucker wrote:
> Replace calls to the older __sync_* functions with the new __atomic_*
> standard ones.  This fixes builds on some architectures, in particular
> MIPS which doesn't have __sync_add_and_fetch_8 and
> __sync_val_compare_and_swap_8 for 64-bit variable handling.

Can't we use the C11 atomics from stdatomic.h instead?

For instance:
https://en.cppreference.com/w/c/atomic/atomic_compare_exchange

> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
> ---
>  tests/Makefile.am       |  2 +-
>  tests/i915/gem_create.c | 12 ++++++++++--
>  2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 5097debf629c..18a0f1f20592 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -90,7 +90,7 @@ AM_LDFLAGS = -Wl,--as-needed
>  drm_import_export_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
>  drm_import_export_LDADD = $(LDADD) -lpthread
>  gem_create_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
> -gem_create_LDADD = $(LDADD) -lpthread
> +gem_create_LDADD = $(LDADD) -lpthread -latomic
>  gem_close_race_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
>  gem_close_race_LDADD = $(LDADD) -lpthread
>  gem_ctx_thrash_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
> diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
> index 43cbf45f289b..a4aeb94b3f93 100644
> --- a/tests/i915/gem_create.c
> +++ b/tests/i915/gem_create.c
> @@ -156,6 +156,14 @@ static void invalid_nonaligned_size(int fd)
>  	gem_close(fd, create.handle);
>  }
>  
> +static uint64_t atomic_compare_swap_u64(uint64_t *ptr, uint64_t oldval,
> +					uint64_t newval)
> +{
> +	__atomic_compare_exchange_n(ptr, &oldval, newval, 0,
> +				    __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
> +	return oldval;
> +}
> +
>  static uint64_t get_npages(uint64_t *global, uint64_t npages)
>  {
>  	uint64_t try, old, max;
> @@ -165,7 +173,7 @@ static uint64_t get_npages(uint64_t *global, uint64_t npages)
>  		old = max;
>  		try = 1 + npages % (max / 2);
>  		max -= try;
> -	} while ((max = __sync_val_compare_and_swap(global, old, max)) != old);
> +	} while ((max = atomic_compare_swap_u64(global, old, max)) != old);
>  
>  	return try;
>  }
> @@ -202,7 +210,7 @@ static void *thread_clear(void *data)
>  		}
>  		gem_close(i915, create.handle);
>  
> -		__sync_add_and_fetch(&arg->max, npages);
> +		__atomic_add_fetch(&arg->max, npages, __ATOMIC_SEQ_CST);
>  	}
>  
>  	return NULL;
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 3/4] i915/gem_create: use __atomic_* instead of __sync_*
@ 2019-06-06  7:20     ` Ser, Simon
  0 siblings, 0 replies; 28+ messages in thread
From: Ser, Simon @ 2019-06-06  7:20 UTC (permalink / raw)
  To: guillaume.tucker, Hiler, Arkadiusz, Latvala, Petri; +Cc: igt-dev, intel-gfx

On Mon, 2019-06-03 at 12:54 +0100, Guillaume Tucker wrote:
> Replace calls to the older __sync_* functions with the new __atomic_*
> standard ones.  This fixes builds on some architectures, in particular
> MIPS which doesn't have __sync_add_and_fetch_8 and
> __sync_val_compare_and_swap_8 for 64-bit variable handling.

Can't we use the C11 atomics from stdatomic.h instead?

For instance:
https://en.cppreference.com/w/c/atomic/atomic_compare_exchange

> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
> ---
>  tests/Makefile.am       |  2 +-
>  tests/i915/gem_create.c | 12 ++++++++++--
>  2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 5097debf629c..18a0f1f20592 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -90,7 +90,7 @@ AM_LDFLAGS = -Wl,--as-needed
>  drm_import_export_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
>  drm_import_export_LDADD = $(LDADD) -lpthread
>  gem_create_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
> -gem_create_LDADD = $(LDADD) -lpthread
> +gem_create_LDADD = $(LDADD) -lpthread -latomic
>  gem_close_race_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
>  gem_close_race_LDADD = $(LDADD) -lpthread
>  gem_ctx_thrash_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
> diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
> index 43cbf45f289b..a4aeb94b3f93 100644
> --- a/tests/i915/gem_create.c
> +++ b/tests/i915/gem_create.c
> @@ -156,6 +156,14 @@ static void invalid_nonaligned_size(int fd)
>  	gem_close(fd, create.handle);
>  }
>  
> +static uint64_t atomic_compare_swap_u64(uint64_t *ptr, uint64_t oldval,
> +					uint64_t newval)
> +{
> +	__atomic_compare_exchange_n(ptr, &oldval, newval, 0,
> +				    __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
> +	return oldval;
> +}
> +
>  static uint64_t get_npages(uint64_t *global, uint64_t npages)
>  {
>  	uint64_t try, old, max;
> @@ -165,7 +173,7 @@ static uint64_t get_npages(uint64_t *global, uint64_t npages)
>  		old = max;
>  		try = 1 + npages % (max / 2);
>  		max -= try;
> -	} while ((max = __sync_val_compare_and_swap(global, old, max)) != old);
> +	} while ((max = atomic_compare_swap_u64(global, old, max)) != old);
>  
>  	return try;
>  }
> @@ -202,7 +210,7 @@ static void *thread_clear(void *data)
>  		}
>  		gem_close(i915, create.handle);
>  
> -		__sync_add_and_fetch(&arg->max, npages);
> +		__atomic_add_fetch(&arg->max, npages, __ATOMIC_SEQ_CST);
>  	}
>  
>  	return NULL;
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCH i-g-t 2/4] gitlab-ci: add libatomic to Fedora docker image
  2019-06-03 11:54   ` [igt-dev] " Guillaume Tucker
@ 2019-06-06  7:21     ` Arkadiusz Hiler
  -1 siblings, 0 replies; 28+ messages in thread
From: Arkadiusz Hiler @ 2019-06-06  7:21 UTC (permalink / raw)
  To: Guillaume Tucker; +Cc: igt-dev, intel-gfx

On Mon, Jun 03, 2019 at 12:54:48PM +0100, Guillaume Tucker wrote:
> Add libatomic to the Fedora docker image so it can link binaries that
> use __atomic_* functions.
> 
> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
> ---
>  Dockerfile.fedora | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Dockerfile.fedora b/Dockerfile.fedora
> index 6686e587613d..c84b412b0723 100644
> --- a/Dockerfile.fedora
> +++ b/Dockerfile.fedora
> @@ -1,7 +1,7 @@
>  FROM fedora:30
>  
>  RUN dnf install -y \
> -	gcc flex bison meson ninja-build xdotool \
> +	gcc flex bison libatomic meson ninja-build xdotool \
>  	'pkgconfig(libdrm)' \
>  	'pkgconfig(pciaccess)' \
>  	'pkgconfig(libkmod)' \

Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

I wonder how does the libatomic gets installed implicitly in Debian.
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/4] gitlab-ci: add libatomic to Fedora docker image
@ 2019-06-06  7:21     ` Arkadiusz Hiler
  0 siblings, 0 replies; 28+ messages in thread
From: Arkadiusz Hiler @ 2019-06-06  7:21 UTC (permalink / raw)
  To: Guillaume Tucker; +Cc: igt-dev, intel-gfx, Petri Latvala

On Mon, Jun 03, 2019 at 12:54:48PM +0100, Guillaume Tucker wrote:
> Add libatomic to the Fedora docker image so it can link binaries that
> use __atomic_* functions.
> 
> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
> ---
>  Dockerfile.fedora | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Dockerfile.fedora b/Dockerfile.fedora
> index 6686e587613d..c84b412b0723 100644
> --- a/Dockerfile.fedora
> +++ b/Dockerfile.fedora
> @@ -1,7 +1,7 @@
>  FROM fedora:30
>  
>  RUN dnf install -y \
> -	gcc flex bison meson ninja-build xdotool \
> +	gcc flex bison libatomic meson ninja-build xdotool \
>  	'pkgconfig(libdrm)' \
>  	'pkgconfig(pciaccess)' \
>  	'pkgconfig(libkmod)' \

Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

I wonder how does the libatomic gets installed implicitly in Debian.
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/4] gitlab-ci: add libatomic to Fedora docker image
  2019-06-06  7:21     ` [igt-dev] " Arkadiusz Hiler
@ 2019-06-06  7:26       ` Ser, Simon
  -1 siblings, 0 replies; 28+ messages in thread
From: Ser, Simon @ 2019-06-06  7:26 UTC (permalink / raw)
  To: Hiler, Arkadiusz, guillaume.tucker; +Cc: igt-dev, intel-gfx

On Thu, 2019-06-06 at 10:21 +0300, Arkadiusz Hiler wrote:
> On Mon, Jun 03, 2019 at 12:54:48PM +0100, Guillaume Tucker wrote:
> > Add libatomic to the Fedora docker image so it can link binaries that
> > use __atomic_* functions.
> > 
> > Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
> > ---
> >  Dockerfile.fedora | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/Dockerfile.fedora b/Dockerfile.fedora
> > index 6686e587613d..c84b412b0723 100644
> > --- a/Dockerfile.fedora
> > +++ b/Dockerfile.fedora
> > @@ -1,7 +1,7 @@
> >  FROM fedora:30
> >  
> >  RUN dnf install -y \
> > -	gcc flex bison meson ninja-build xdotool \
> > +	gcc flex bison libatomic meson ninja-build xdotool \
> >  	'pkgconfig(libdrm)' \
> >  	'pkgconfig(pciaccess)' \
> >  	'pkgconfig(libkmod)' \
> 
> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> 
> I wonder how does the libatomic gets installed implicitly in Debian.

It's a dependency of GCC. Probably a good idea to add it anyway?

> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/4] gitlab-ci: add libatomic to Fedora docker image
@ 2019-06-06  7:26       ` Ser, Simon
  0 siblings, 0 replies; 28+ messages in thread
From: Ser, Simon @ 2019-06-06  7:26 UTC (permalink / raw)
  To: Hiler, Arkadiusz, guillaume.tucker; +Cc: igt-dev, intel-gfx, Latvala, Petri

On Thu, 2019-06-06 at 10:21 +0300, Arkadiusz Hiler wrote:
> On Mon, Jun 03, 2019 at 12:54:48PM +0100, Guillaume Tucker wrote:
> > Add libatomic to the Fedora docker image so it can link binaries that
> > use __atomic_* functions.
> > 
> > Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
> > ---
> >  Dockerfile.fedora | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/Dockerfile.fedora b/Dockerfile.fedora
> > index 6686e587613d..c84b412b0723 100644
> > --- a/Dockerfile.fedora
> > +++ b/Dockerfile.fedora
> > @@ -1,7 +1,7 @@
> >  FROM fedora:30
> >  
> >  RUN dnf install -y \
> > -	gcc flex bison meson ninja-build xdotool \
> > +	gcc flex bison libatomic meson ninja-build xdotool \
> >  	'pkgconfig(libdrm)' \
> >  	'pkgconfig(pciaccess)' \
> >  	'pkgconfig(libkmod)' \
> 
> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> 
> I wonder how does the libatomic gets installed implicitly in Debian.

It's a dependency of GCC. Probably a good idea to add it anyway?

> _______________________________________________
> igt-dev mailing list
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/4] tests: add libatomic dependency
  2019-06-06  7:18   ` Ser, Simon
@ 2019-06-13 12:55     ` Guillaume Tucker
  -1 siblings, 0 replies; 28+ messages in thread
From: Guillaume Tucker @ 2019-06-13 12:55 UTC (permalink / raw)
  To: Ser, Simon, Hiler, Arkadiusz, Latvala, Petri; +Cc: igt-dev, intel-gfx

On 06/06/2019 08:18, Ser, Simon wrote:
> On Mon, 2019-06-03 at 12:54 +0100, Guillaume Tucker wrote:
>> Add dependency to libatomic in order to be able to use the __atomic_*
>> functions instead of the older __sync_* ones.  This is to enable
>> atomic operations on a wider number of architectures including MIPS.
> 
> Thanks for your patch! I have a few questions because I don't know well
> how libatomic works.

Thanks for the review!

> Do we want to always link against libatomic? For instance LLVM tries to
> compile a program with atomic before falling back to libatomic:
> https://github.com/llvm-mirror/llvm/blob/master/cmake/modules/CheckAtomic.cmake
> 
> Should this dependency be mandatory?

I've had a look around, the short answer is we should make this
dependency optional.  I'm sending a v2 of this series which
addresses this issue.

From what I understand, linking against libatomic is actually
only needed when some atomic operations aren't supported natively
by a CPU architecture.  For example, this is the case with 64-bit
atomics on 32-bit MIPS.  If the CPU can't do an atomic operation
and there's no libatomic available, then it won't build.  So I've
made a test in meson.build to check whether linking against
libatomic is required or not, to drop the dependency when it
isn't.  I've verified that the test passes on x86 (i.e. no
dependency) and fails on 32-bit MIPS (i.e. with dependency).

Guillaume


>> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
>> ---
>>  meson.build       | 1 +
>>  tests/meson.build | 2 +-
>>  2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/meson.build b/meson.build
>> index 6268c58d3634..4e5bb323fa49 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -179,6 +179,7 @@ math = cc.find_library('m')
>>  realtime = cc.find_library('rt')
>>  dlsym = cc.find_library('dl')
>>  zlib = cc.find_library('z')
>> +libatomic = cc.find_library('atomic')
>>  
>>  if cc.has_header('linux/kd.h')
>>  	config.set('HAVE_LINUX_KD_H', 1)
>> diff --git a/tests/meson.build b/tests/meson.build
>> index 806766e51667..6877ccd59235 100644
>> --- a/tests/meson.build
>> +++ b/tests/meson.build
>> @@ -233,7 +233,7 @@ i915_progs = [
>>  	'i915_suspend',
>>  ]
>>  
>> -test_deps = [ igt_deps ]
>> +test_deps = [ igt_deps, libatomic ]
>>  
>>  if libdrm_nouveau.found()
>>  	test_progs += [

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/4] tests: add libatomic dependency
@ 2019-06-13 12:55     ` Guillaume Tucker
  0 siblings, 0 replies; 28+ messages in thread
From: Guillaume Tucker @ 2019-06-13 12:55 UTC (permalink / raw)
  To: Ser, Simon, Hiler, Arkadiusz, Latvala, Petri; +Cc: igt-dev, intel-gfx

On 06/06/2019 08:18, Ser, Simon wrote:
> On Mon, 2019-06-03 at 12:54 +0100, Guillaume Tucker wrote:
>> Add dependency to libatomic in order to be able to use the __atomic_*
>> functions instead of the older __sync_* ones.  This is to enable
>> atomic operations on a wider number of architectures including MIPS.
> 
> Thanks for your patch! I have a few questions because I don't know well
> how libatomic works.

Thanks for the review!

> Do we want to always link against libatomic? For instance LLVM tries to
> compile a program with atomic before falling back to libatomic:
> https://github.com/llvm-mirror/llvm/blob/master/cmake/modules/CheckAtomic.cmake
> 
> Should this dependency be mandatory?

I've had a look around, the short answer is we should make this
dependency optional.  I'm sending a v2 of this series which
addresses this issue.

From what I understand, linking against libatomic is actually
only needed when some atomic operations aren't supported natively
by a CPU architecture.  For example, this is the case with 64-bit
atomics on 32-bit MIPS.  If the CPU can't do an atomic operation
and there's no libatomic available, then it won't build.  So I've
made a test in meson.build to check whether linking against
libatomic is required or not, to drop the dependency when it
isn't.  I've verified that the test passes on x86 (i.e. no
dependency) and fails on 32-bit MIPS (i.e. with dependency).

Guillaume


>> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
>> ---
>>  meson.build       | 1 +
>>  tests/meson.build | 2 +-
>>  2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/meson.build b/meson.build
>> index 6268c58d3634..4e5bb323fa49 100644
>> --- a/meson.build
>> +++ b/meson.build
>> @@ -179,6 +179,7 @@ math = cc.find_library('m')
>>  realtime = cc.find_library('rt')
>>  dlsym = cc.find_library('dl')
>>  zlib = cc.find_library('z')
>> +libatomic = cc.find_library('atomic')
>>  
>>  if cc.has_header('linux/kd.h')
>>  	config.set('HAVE_LINUX_KD_H', 1)
>> diff --git a/tests/meson.build b/tests/meson.build
>> index 806766e51667..6877ccd59235 100644
>> --- a/tests/meson.build
>> +++ b/tests/meson.build
>> @@ -233,7 +233,7 @@ i915_progs = [
>>  	'i915_suspend',
>>  ]
>>  
>> -test_deps = [ igt_deps ]
>> +test_deps = [ igt_deps, libatomic ]
>>  
>>  if libdrm_nouveau.found()
>>  	test_progs += [

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/4] gitlab-ci: add libatomic to Fedora docker image
  2019-06-06  7:26       ` Ser, Simon
@ 2019-06-13 12:56         ` Guillaume Tucker
  -1 siblings, 0 replies; 28+ messages in thread
From: Guillaume Tucker @ 2019-06-13 12:56 UTC (permalink / raw)
  To: Ser, Simon, Hiler, Arkadiusz; +Cc: igt-dev, intel-gfx

On 06/06/2019 08:26, Ser, Simon wrote:
> On Thu, 2019-06-06 at 10:21 +0300, Arkadiusz Hiler wrote:
>> On Mon, Jun 03, 2019 at 12:54:48PM +0100, Guillaume Tucker wrote:
>>> Add libatomic to the Fedora docker image so it can link binaries that
>>> use __atomic_* functions.
>>>
>>> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
>>> ---
>>>  Dockerfile.fedora | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/Dockerfile.fedora b/Dockerfile.fedora
>>> index 6686e587613d..c84b412b0723 100644
>>> --- a/Dockerfile.fedora
>>> +++ b/Dockerfile.fedora
>>> @@ -1,7 +1,7 @@
>>>  FROM fedora:30
>>>  
>>>  RUN dnf install -y \
>>> -	gcc flex bison meson ninja-build xdotool \
>>> +	gcc flex bison libatomic meson ninja-build xdotool \
>>>  	'pkgconfig(libdrm)' \
>>>  	'pkgconfig(pciaccess)' \
>>>  	'pkgconfig(libkmod)' \
>>
>> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
>>
>> I wonder how does the libatomic gets installed implicitly in Debian.
> 
> It's a dependency of GCC. Probably a good idea to add it anyway?
Fair enough, I'm adding it in the v2.

Guillaume
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 2/4] gitlab-ci: add libatomic to Fedora docker image
@ 2019-06-13 12:56         ` Guillaume Tucker
  0 siblings, 0 replies; 28+ messages in thread
From: Guillaume Tucker @ 2019-06-13 12:56 UTC (permalink / raw)
  To: Ser, Simon, Hiler, Arkadiusz; +Cc: igt-dev, intel-gfx

On 06/06/2019 08:26, Ser, Simon wrote:
> On Thu, 2019-06-06 at 10:21 +0300, Arkadiusz Hiler wrote:
>> On Mon, Jun 03, 2019 at 12:54:48PM +0100, Guillaume Tucker wrote:
>>> Add libatomic to the Fedora docker image so it can link binaries that
>>> use __atomic_* functions.
>>>
>>> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
>>> ---
>>>  Dockerfile.fedora | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/Dockerfile.fedora b/Dockerfile.fedora
>>> index 6686e587613d..c84b412b0723 100644
>>> --- a/Dockerfile.fedora
>>> +++ b/Dockerfile.fedora
>>> @@ -1,7 +1,7 @@
>>>  FROM fedora:30
>>>  
>>>  RUN dnf install -y \
>>> -	gcc flex bison meson ninja-build xdotool \
>>> +	gcc flex bison libatomic meson ninja-build xdotool \
>>>  	'pkgconfig(libdrm)' \
>>>  	'pkgconfig(pciaccess)' \
>>>  	'pkgconfig(libkmod)' \
>>
>> Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
>>
>> I wonder how does the libatomic gets installed implicitly in Debian.
> 
> It's a dependency of GCC. Probably a good idea to add it anyway?
Fair enough, I'm adding it in the v2.

Guillaume
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/4] tests: add libatomic dependency
  2019-06-13 12:55     ` Guillaume Tucker
@ 2019-06-13 12:57       ` Ser, Simon
  -1 siblings, 0 replies; 28+ messages in thread
From: Ser, Simon @ 2019-06-13 12:57 UTC (permalink / raw)
  To: guillaume.tucker, Hiler, Arkadiusz, Latvala, Petri; +Cc: igt-dev, intel-gfx

On Thu, 2019-06-13 at 13:55 +0100, Guillaume Tucker wrote:
> On 06/06/2019 08:18, Ser, Simon wrote:
> > On Mon, 2019-06-03 at 12:54 +0100, Guillaume Tucker wrote:
> > > Add dependency to libatomic in order to be able to use the __atomic_*
> > > functions instead of the older __sync_* ones.  This is to enable
> > > atomic operations on a wider number of architectures including MIPS.
> > 
> > Thanks for your patch! I have a few questions because I don't know well
> > how libatomic works.
> 
> Thanks for the review!
> 
> > Do we want to always link against libatomic? For instance LLVM tries to
> > compile a program with atomic before falling back to libatomic:
> > https://github.com/llvm-mirror/llvm/blob/master/cmake/modules/CheckAtomic.cmake
> > 
> > Should this dependency be mandatory?
> 
> I've had a look around, the short answer is we should make this
> dependency optional.  I'm sending a v2 of this series which
> addresses this issue.
> 
> From what I understand, linking against libatomic is actually
> only needed when some atomic operations aren't supported natively
> by a CPU architecture.  For example, this is the case with 64-bit
> atomics on 32-bit MIPS.  If the CPU can't do an atomic operation
> and there's no libatomic available, then it won't build.  So I've
> made a test in meson.build to check whether linking against
> libatomic is required or not, to drop the dependency when it
> isn't.  I've verified that the test passes on x86 (i.e. no
> dependency) and fails on 32-bit MIPS (i.e. with dependency).

Nice! Looks like a good idea to me.

> Guillaume
> 
> 
> > > Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
> > > ---
> > >  meson.build       | 1 +
> > >  tests/meson.build | 2 +-
> > >  2 files changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/meson.build b/meson.build
> > > index 6268c58d3634..4e5bb323fa49 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -179,6 +179,7 @@ math = cc.find_library('m')
> > >  realtime = cc.find_library('rt')
> > >  dlsym = cc.find_library('dl')
> > >  zlib = cc.find_library('z')
> > > +libatomic = cc.find_library('atomic')
> > >  
> > >  if cc.has_header('linux/kd.h')
> > >  	config.set('HAVE_LINUX_KD_H', 1)
> > > diff --git a/tests/meson.build b/tests/meson.build
> > > index 806766e51667..6877ccd59235 100644
> > > --- a/tests/meson.build
> > > +++ b/tests/meson.build
> > > @@ -233,7 +233,7 @@ i915_progs = [
> > >  	'i915_suspend',
> > >  ]
> > >  
> > > -test_deps = [ igt_deps ]
> > > +test_deps = [ igt_deps, libatomic ]
> > >  
> > >  if libdrm_nouveau.found()
> > >  	test_progs += [
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 1/4] tests: add libatomic dependency
@ 2019-06-13 12:57       ` Ser, Simon
  0 siblings, 0 replies; 28+ messages in thread
From: Ser, Simon @ 2019-06-13 12:57 UTC (permalink / raw)
  To: guillaume.tucker, Hiler, Arkadiusz, Latvala, Petri; +Cc: igt-dev, intel-gfx

On Thu, 2019-06-13 at 13:55 +0100, Guillaume Tucker wrote:
> On 06/06/2019 08:18, Ser, Simon wrote:
> > On Mon, 2019-06-03 at 12:54 +0100, Guillaume Tucker wrote:
> > > Add dependency to libatomic in order to be able to use the __atomic_*
> > > functions instead of the older __sync_* ones.  This is to enable
> > > atomic operations on a wider number of architectures including MIPS.
> > 
> > Thanks for your patch! I have a few questions because I don't know well
> > how libatomic works.
> 
> Thanks for the review!
> 
> > Do we want to always link against libatomic? For instance LLVM tries to
> > compile a program with atomic before falling back to libatomic:
> > https://github.com/llvm-mirror/llvm/blob/master/cmake/modules/CheckAtomic.cmake
> > 
> > Should this dependency be mandatory?
> 
> I've had a look around, the short answer is we should make this
> dependency optional.  I'm sending a v2 of this series which
> addresses this issue.
> 
> From what I understand, linking against libatomic is actually
> only needed when some atomic operations aren't supported natively
> by a CPU architecture.  For example, this is the case with 64-bit
> atomics on 32-bit MIPS.  If the CPU can't do an atomic operation
> and there's no libatomic available, then it won't build.  So I've
> made a test in meson.build to check whether linking against
> libatomic is required or not, to drop the dependency when it
> isn't.  I've verified that the test passes on x86 (i.e. no
> dependency) and fails on 32-bit MIPS (i.e. with dependency).

Nice! Looks like a good idea to me.

> Guillaume
> 
> 
> > > Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
> > > ---
> > >  meson.build       | 1 +
> > >  tests/meson.build | 2 +-
> > >  2 files changed, 2 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/meson.build b/meson.build
> > > index 6268c58d3634..4e5bb323fa49 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -179,6 +179,7 @@ math = cc.find_library('m')
> > >  realtime = cc.find_library('rt')
> > >  dlsym = cc.find_library('dl')
> > >  zlib = cc.find_library('z')
> > > +libatomic = cc.find_library('atomic')
> > >  
> > >  if cc.has_header('linux/kd.h')
> > >  	config.set('HAVE_LINUX_KD_H', 1)
> > > diff --git a/tests/meson.build b/tests/meson.build
> > > index 806766e51667..6877ccd59235 100644
> > > --- a/tests/meson.build
> > > +++ b/tests/meson.build
> > > @@ -233,7 +233,7 @@ i915_progs = [
> > >  	'i915_suspend',
> > >  ]
> > >  
> > > -test_deps = [ igt_deps ]
> > > +test_deps = [ igt_deps, libatomic ]
> > >  
> > >  if libdrm_nouveau.found()
> > >  	test_progs += [
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 3/4] i915/gem_create: use __atomic_* instead of __sync_*
  2019-06-06  7:20     ` [Intel-gfx] " Ser, Simon
@ 2019-06-13 13:03       ` Guillaume Tucker
  -1 siblings, 0 replies; 28+ messages in thread
From: Guillaume Tucker @ 2019-06-13 13:03 UTC (permalink / raw)
  To: Ser, Simon, Hiler, Arkadiusz, Latvala, Petri; +Cc: igt-dev, intel-gfx

On 06/06/2019 08:20, Ser, Simon wrote:
> On Mon, 2019-06-03 at 12:54 +0100, Guillaume Tucker wrote:
>> Replace calls to the older __sync_* functions with the new __atomic_*
>> standard ones.  This fixes builds on some architectures, in particular
>> MIPS which doesn't have __sync_add_and_fetch_8 and
>> __sync_val_compare_and_swap_8 for 64-bit variable handling.
> 
> Can't we use the C11 atomics from stdatomic.h instead?
> 
> For instance:
> https://en.cppreference.com/w/c/atomic/atomic_compare_exchange

Yes, thanks for pointing this out.  The stdatomic.h macros also
use the __atomic_* functions so the libatomic dependency remains
the same, but it's a bit better than using the __atomic_*
functions directly.  In particular, stdatomic.h enforces the use
of the _Atomic type modifier which seems very important esp for
pointers to atomic variables.  That's also being fixed in the v2.

Guillaume

>> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
>> ---
>>  tests/Makefile.am       |  2 +-
>>  tests/i915/gem_create.c | 12 ++++++++++--
>>  2 files changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/Makefile.am b/tests/Makefile.am
>> index 5097debf629c..18a0f1f20592 100644
>> --- a/tests/Makefile.am
>> +++ b/tests/Makefile.am
>> @@ -90,7 +90,7 @@ AM_LDFLAGS = -Wl,--as-needed
>>  drm_import_export_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
>>  drm_import_export_LDADD = $(LDADD) -lpthread
>>  gem_create_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
>> -gem_create_LDADD = $(LDADD) -lpthread
>> +gem_create_LDADD = $(LDADD) -lpthread -latomic
>>  gem_close_race_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
>>  gem_close_race_LDADD = $(LDADD) -lpthread
>>  gem_ctx_thrash_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
>> diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
>> index 43cbf45f289b..a4aeb94b3f93 100644
>> --- a/tests/i915/gem_create.c
>> +++ b/tests/i915/gem_create.c
>> @@ -156,6 +156,14 @@ static void invalid_nonaligned_size(int fd)
>>  	gem_close(fd, create.handle);
>>  }
>>  
>> +static uint64_t atomic_compare_swap_u64(uint64_t *ptr, uint64_t oldval,
>> +					uint64_t newval)
>> +{
>> +	__atomic_compare_exchange_n(ptr, &oldval, newval, 0,
>> +				    __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
>> +	return oldval;
>> +}
>> +
>>  static uint64_t get_npages(uint64_t *global, uint64_t npages)
>>  {
>>  	uint64_t try, old, max;
>> @@ -165,7 +173,7 @@ static uint64_t get_npages(uint64_t *global, uint64_t npages)
>>  		old = max;
>>  		try = 1 + npages % (max / 2);
>>  		max -= try;
>> -	} while ((max = __sync_val_compare_and_swap(global, old, max)) != old);
>> +	} while ((max = atomic_compare_swap_u64(global, old, max)) != old);
>>  
>>  	return try;
>>  }
>> @@ -202,7 +210,7 @@ static void *thread_clear(void *data)
>>  		}
>>  		gem_close(i915, create.handle);
>>  
>> -		__sync_add_and_fetch(&arg->max, npages);
>> +		__atomic_add_fetch(&arg->max, npages, __ATOMIC_SEQ_CST);
>>  	}
>>  
>>  	return NULL;

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 3/4] i915/gem_create: use __atomic_* instead of __sync_*
@ 2019-06-13 13:03       ` Guillaume Tucker
  0 siblings, 0 replies; 28+ messages in thread
From: Guillaume Tucker @ 2019-06-13 13:03 UTC (permalink / raw)
  To: Ser, Simon, Hiler, Arkadiusz, Latvala, Petri; +Cc: igt-dev, intel-gfx

On 06/06/2019 08:20, Ser, Simon wrote:
> On Mon, 2019-06-03 at 12:54 +0100, Guillaume Tucker wrote:
>> Replace calls to the older __sync_* functions with the new __atomic_*
>> standard ones.  This fixes builds on some architectures, in particular
>> MIPS which doesn't have __sync_add_and_fetch_8 and
>> __sync_val_compare_and_swap_8 for 64-bit variable handling.
> 
> Can't we use the C11 atomics from stdatomic.h instead?
> 
> For instance:
> https://en.cppreference.com/w/c/atomic/atomic_compare_exchange

Yes, thanks for pointing this out.  The stdatomic.h macros also
use the __atomic_* functions so the libatomic dependency remains
the same, but it's a bit better than using the __atomic_*
functions directly.  In particular, stdatomic.h enforces the use
of the _Atomic type modifier which seems very important esp for
pointers to atomic variables.  That's also being fixed in the v2.

Guillaume

>> Signed-off-by: Guillaume Tucker <guillaume.tucker@collabora.com>
>> ---
>>  tests/Makefile.am       |  2 +-
>>  tests/i915/gem_create.c | 12 ++++++++++--
>>  2 files changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/Makefile.am b/tests/Makefile.am
>> index 5097debf629c..18a0f1f20592 100644
>> --- a/tests/Makefile.am
>> +++ b/tests/Makefile.am
>> @@ -90,7 +90,7 @@ AM_LDFLAGS = -Wl,--as-needed
>>  drm_import_export_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
>>  drm_import_export_LDADD = $(LDADD) -lpthread
>>  gem_create_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
>> -gem_create_LDADD = $(LDADD) -lpthread
>> +gem_create_LDADD = $(LDADD) -lpthread -latomic
>>  gem_close_race_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
>>  gem_close_race_LDADD = $(LDADD) -lpthread
>>  gem_ctx_thrash_CFLAGS = $(AM_CFLAGS) $(THREAD_CFLAGS)
>> diff --git a/tests/i915/gem_create.c b/tests/i915/gem_create.c
>> index 43cbf45f289b..a4aeb94b3f93 100644
>> --- a/tests/i915/gem_create.c
>> +++ b/tests/i915/gem_create.c
>> @@ -156,6 +156,14 @@ static void invalid_nonaligned_size(int fd)
>>  	gem_close(fd, create.handle);
>>  }
>>  
>> +static uint64_t atomic_compare_swap_u64(uint64_t *ptr, uint64_t oldval,
>> +					uint64_t newval)
>> +{
>> +	__atomic_compare_exchange_n(ptr, &oldval, newval, 0,
>> +				    __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
>> +	return oldval;
>> +}
>> +
>>  static uint64_t get_npages(uint64_t *global, uint64_t npages)
>>  {
>>  	uint64_t try, old, max;
>> @@ -165,7 +173,7 @@ static uint64_t get_npages(uint64_t *global, uint64_t npages)
>>  		old = max;
>>  		try = 1 + npages % (max / 2);
>>  		max -= try;
>> -	} while ((max = __sync_val_compare_and_swap(global, old, max)) != old);
>> +	} while ((max = atomic_compare_swap_u64(global, old, max)) != old);
>>  
>>  	return try;
>>  }
>> @@ -202,7 +210,7 @@ static void *thread_clear(void *data)
>>  		}
>>  		gem_close(i915, create.handle);
>>  
>> -		__sync_add_and_fetch(&arg->max, npages);
>> +		__atomic_add_fetch(&arg->max, npages, __ATOMIC_SEQ_CST);
>>  	}
>>  
>>  	return NULL;

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2019-06-13 13:03 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-03 11:54 [PATCH i-g-t 1/4] tests: add libatomic dependency Guillaume Tucker
2019-06-03 11:54 ` [igt-dev] " Guillaume Tucker
2019-06-03 11:54 ` [PATCH i-g-t 2/4] gitlab-ci: add libatomic to Fedora docker image Guillaume Tucker
2019-06-03 11:54   ` [igt-dev] " Guillaume Tucker
2019-06-06  7:21   ` Arkadiusz Hiler
2019-06-06  7:21     ` [igt-dev] " Arkadiusz Hiler
2019-06-06  7:26     ` Ser, Simon
2019-06-06  7:26       ` Ser, Simon
2019-06-13 12:56       ` Guillaume Tucker
2019-06-13 12:56         ` [Intel-gfx] " Guillaume Tucker
2019-06-03 11:54 ` [PATCH i-g-t 3/4] i915/gem_create: use __atomic_* instead of __sync_* Guillaume Tucker
2019-06-03 11:54   ` [igt-dev] " Guillaume Tucker
2019-06-06  7:20   ` Ser, Simon
2019-06-06  7:20     ` [Intel-gfx] " Ser, Simon
2019-06-13 13:03     ` Guillaume Tucker
2019-06-13 13:03       ` Guillaume Tucker
2019-06-03 11:54 ` [PATCH i-g-t 4/4] tests/sw_sync: " Guillaume Tucker
2019-06-03 11:54   ` [Intel-gfx] " Guillaume Tucker
2019-06-03 13:04 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/4] tests: add libatomic dependency Patchwork
2019-06-03 16:38 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-06-06  7:18 ` [igt-dev] [PATCH i-g-t 1/4] " Ser, Simon
2019-06-06  7:18   ` Ser, Simon
2019-06-13 12:55   ` Guillaume Tucker
2019-06-13 12:55     ` Guillaume Tucker
2019-06-13 12:57     ` Ser, Simon
2019-06-13 12:57       ` Ser, Simon
2019-06-06  7:19 ` Arkadiusz Hiler
2019-06-06  7:19   ` [Intel-gfx] " Arkadiusz Hiler

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.