Skip to contentSkip to conversation

amdgpu/basic_tests.c: check for fork

PATCH In review Fabrice Fontaine 3 participants 6 messages Mar 10, 2019 – Mar 12, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 amdgpu/basic_tests.c: check for fork

amdgpu test program use fork since
https://cgit.freedesktop.org/mesa/drm/commit/tests/amdgpu/basic_tests.c?id=736ef0b61cab55378202c5f49d91799cc2b99091

However, this function is not always available so add a check for it in configure.ac and use it in tests/amdgpu/basic_tests.c

Fixes:
- http://autobuild.buildroot.org/results/8d6194982c1080e173fcef8212fb06e6dc275d58

---
 configure.ac               | 2 ++
 tests/amdgpu/basic_tests.c | 4 ++++
 2 files changed, 6 insertions(+)
configure.ac +2 -0
index d72e84ad..6effb9a2 100644
@@ -193,6 +193,8 @@ AC_CHECK_FUNCS([open_memstream],
                [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 1, [Have open_memstream()])],
                [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 0)])
 
+AC_CHECK_FUNCS([fork])
+
 dnl Use lots of warning flags with with gcc and compatible compilers
 
 dnl Note: if you change the following variable, the cache is automatically
tests/amdgpu/basic_tests.c +4 -0
index dbae4d53..c32a1351 100644
@@ -1646,10 +1646,12 @@ static void amdgpu_userptr_test(void)
 	while (j++ < sdma_write_length)
 		pm4[i++] = 0xdeadbeaf;
 
+#ifdef HAVE_FORK
 	if (!fork()) {
 		pm4[0] = 0x0;
 		exit(0);
 	}
+#endif
 
 	amdgpu_test_exec_cs_helper(context_handle,
 				   AMDGPU_HW_IP_DMA, 0,
@@ -1675,7 +1677,9 @@ static void amdgpu_userptr_test(void)
 	r = amdgpu_cs_ctx_free(context_handle);
 	CU_ASSERT_EQUAL(r, 0);
 
+#ifdef HAVE_FORK
 	wait(NULL);
+#endif
 }
 
 static void amdgpu_sync_dependency_test(void)
Signature · 6 lines
2.20.1

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

Well NAK, cause that obviously would break the test if fork() isn't available.

We certainly don't have any platform where we support amdgpu and fork() is not available, so that change is rather pointless in the first place.

Christian.

Am 10.03.19 um 10:44 schrieb Fabrice Fontaine:

Quoted 46 lines

amdgpu test program use fork since
https://cgit.freedesktop.org/mesa/drm/commit/tests/amdgpu/basic_tests.c?id=736ef0b61cab55378202c5f49d91799cc2b99091

However, this function is not always available so add a check for it in configure.ac and use it in tests/amdgpu/basic_tests.c

Fixes:
- http://autobuild.buildroot.org/results/8d6194982c1080e173fcef8212fb06e6dc275d58

---
  configure.ac               | 2 ++
  tests/amdgpu/basic_tests.c | 4 ++++
  2 files changed, 6 insertions(+)
configure.ac +2 -0
index d72e84ad..6effb9a2 100644
@@ -193,6 +193,8 @@ AC_CHECK_FUNCS([open_memstream],
                 [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 1, [Have open_memstream()])],
                 [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 0)])
 
+AC_CHECK_FUNCS([fork])
+
  dnl Use lots of warning flags with with gcc and compatible compilers
 
  dnl Note: if you change the following variable, the cache is automatically
tests/amdgpu/basic_tests.c +2 -0
index dbae4d53..c32a1351 100644
@@ -1646,10 +1646,12 @@ static void amdgpu_userptr_test(void)
  	while (j++ < sdma_write_length)
  		pm4[i++] = 0xdeadbeaf;
 
+#ifdef HAVE_FORK
  	if (!fork()) {
  		pm4[0] = 0x0;
  		exit(0);
  	}
+#endif
 
  	amdgpu_test_exec_cs_helper(context_handle,
  				   AMDGPU_HW_IP_DMA, 0,

tests/amdgpu/basic_tests.c static void amdgpu_userptr_test(void) · line 1685

Quoted 9 lines
tests/amdgpu/basic_tests.c +2 -0
@@ -1675,7 +1677,9 @@ static void amdgpu_userptr_test(void)
  	r = amdgpu_cs_ctx_free(context_handle);
  	CU_ASSERT_EQUAL(r, 0);
 
+#ifdef HAVE_FORK
  	wait(NULL);
+#endif
  }
 
  static void amdgpu_sync_dependency_test(void)

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

#2 lore raw

OK, then will you accept a patch that disable amdgpu test if fork is not available or a patch that disable all tests (for example through a --disable-test-programs option)? Currently, the user can only disable the cairo tests so the whole libdrm package fails to statically build with uclibc-ng on ARM cortex M4
(http://autobuild.buildroot.org/?reason=libdrm-2.4.97).

Best Regards,

Fabrice

Quoted 59 lines · Christian König

Well NAK, cause that obviously would break the test if fork() isn't available.

We certainly don't have any platform where we support amdgpu and fork() is not available, so that change is rather pointless in the first place.

Christian.

Am 10.03.19 um 10:44 schrieb Fabrice Fontaine:

Quoted 49 lines

amdgpu test program use fork since
https://cgit.freedesktop.org/mesa/drm/commit/tests/amdgpu/basic_tests.c?id=736ef0b61cab55378202c5f49d91799cc2b99091

However, this function is not always available so add a check for it in configure.ac and use it in tests/amdgpu/basic_tests.c

Fixes:
- http://autobuild.buildroot.org/results/8d6194982c1080e173fcef8212fb06e6dc275d58

---
  configure.ac               | 2 ++
  tests/amdgpu/basic_tests.c | 4 ++++
  2 files changed, 6 insertions(+)
configure.ac +2 -0
index d72e84ad..6effb9a2 100644
@@ -193,6 +193,8 @@ AC_CHECK_FUNCS([open_memstream],
                 [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 1, [Have open_memstream()])],
                 [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 0)])
 
+AC_CHECK_FUNCS([fork])
+
  dnl Use lots of warning flags with with gcc and compatible compilers
 
  dnl Note: if you change the following variable, the cache is automatically
tests/amdgpu/basic_tests.c +2 -0
index dbae4d53..c32a1351 100644
@@ -1646,10 +1646,12 @@ static void amdgpu_userptr_test(void)
      while (j++ < sdma_write_length)
              pm4[i++] = 0xdeadbeaf;
 
+#ifdef HAVE_FORK
      if (!fork()) {
              pm4[0] = 0x0;
              exit(0);
      }
+#endif
 
      amdgpu_test_exec_cs_helper(context_handle,
                                 AMDGPU_HW_IP_DMA, 0,
@@ -1675,7 +1677,9 @@ static void amdgpu_userptr_test(void)
      r = amdgpu_cs_ctx_free(context_handle);
      CU_ASSERT_EQUAL(r, 0);
 
Quoted 7 lines

tests/amdgpu/basic_tests.c static void amdgpu_userptr_test(void) · line 1685

Quoted 6 lines
tests/amdgpu/basic_tests.c +2 -0
+#ifdef HAVE_FORK
      wait(NULL);
+#endif
  }
 
  static void amdgpu_sync_dependency_test(void)

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

#3 lore raw

Am 11.03.19 um 18:17 schrieb Fabrice Fontaine:

Quoted 3 lines

OK, then will you accept a patch that disable amdgpu test if fork is not available or a patch that disable all tests (for example through a --disable-test-programs option)?

No, we really need to test the correct behavior of fork() with userptrs.

So how do we spawn a child process with uclibc-ng?

I mean it is one of the most fundamental Unix functions, isn't it?

Christian.

Quoted 69 lines

Currently, the user can only disable
the cairo tests so the whole libdrm package fails to statically build with uclibc-ng on ARM cortex M4
(http://autobuild.buildroot.org/?reason=libdrm-2.4.97).

Best Regards,

Fabrice

Quoted 58 lines · Christian König

Well NAK, cause that obviously would break the test if fork() isn't available.

We certainly don't have any platform where we support amdgpu and fork() is not available, so that change is rather pointless in the first place.

Christian.

Am 10.03.19 um 10:44 schrieb Fabrice Fontaine:

Quoted 49 lines

amdgpu test program use fork since
https://cgit.freedesktop.org/mesa/drm/commit/tests/amdgpu/basic_tests.c?id=736ef0b61cab55378202c5f49d91799cc2b99091

However, this function is not always available so add a check for it in configure.ac and use it in tests/amdgpu/basic_tests.c

Fixes:
- http://autobuild.buildroot.org/results/8d6194982c1080e173fcef8212fb06e6dc275d58

---
   configure.ac               | 2 ++
   tests/amdgpu/basic_tests.c | 4 ++++
   2 files changed, 6 insertions(+)
configure.ac +2 -0
index d72e84ad..6effb9a2 100644
@@ -193,6 +193,8 @@ AC_CHECK_FUNCS([open_memstream],
                  [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 1, [Have open_memstream()])],
                  [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 0)])
 
+AC_CHECK_FUNCS([fork])
+
   dnl Use lots of warning flags with with gcc and compatible compilers
 
   dnl Note: if you change the following variable, the cache is automatically
tests/amdgpu/basic_tests.c +2 -0
index dbae4d53..c32a1351 100644
@@ -1646,10 +1646,12 @@ static void amdgpu_userptr_test(void)
       while (j++ < sdma_write_length)
               pm4[i++] = 0xdeadbeaf;
 
+#ifdef HAVE_FORK
       if (!fork()) {
               pm4[0] = 0x0;
               exit(0);
       }
+#endif
 
       amdgpu_test_exec_cs_helper(context_handle,
                                  AMDGPU_HW_IP_DMA, 0,
@@ -1675,7 +1677,9 @@ static void amdgpu_userptr_test(void)
       r = amdgpu_cs_ctx_free(context_handle);
       CU_ASSERT_EQUAL(r, 0);
 
Quoted 6 lines
Quoted 6 lines

tests/amdgpu/basic_tests.c static void amdgpu_userptr_test(void) · line 1685

Quoted 6 lines
tests/amdgpu/basic_tests.c +2 -0
+#ifdef HAVE_FORK
       wait(NULL);
+#endif
   }
 
   static void amdgpu_sync_dependency_test(void)

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

#4 lore raw

OK, thanks for your input, I'll disable amdgpu on platforms without MMU.

Fabrice

Quoted 83 lines · Christian

Am 11.03.19 um 18:17 schrieb Fabrice Fontaine:

Quoted 3 lines

OK, then will you accept a patch that disable amdgpu test if fork is not available or a patch that disable all tests (for example through a --disable-test-programs option)?

No, we really need to test the correct behavior of fork() with userptrs.

So how do we spawn a child process with uclibc-ng?

I mean it is one of the most fundamental Unix functions, isn't it?

Christian.

Quoted 69 lines

Currently, the user can only disable
the cairo tests so the whole libdrm package fails to statically build with uclibc-ng on ARM cortex M4
(http://autobuild.buildroot.org/?reason=libdrm-2.4.97).

Best Regards,

Fabrice

Quoted 58 lines · Christian König

Well NAK, cause that obviously would break the test if fork() isn't available.

We certainly don't have any platform where we support amdgpu and fork() is not available, so that change is rather pointless in the first place.

Christian.

Am 10.03.19 um 10:44 schrieb Fabrice Fontaine:

Quoted 49 lines

amdgpu test program use fork since
https://cgit.freedesktop.org/mesa/drm/commit/tests/amdgpu/basic_tests.c?id=736ef0b61cab55378202c5f49d91799cc2b99091

However, this function is not always available so add a check for it in configure.ac and use it in tests/amdgpu/basic_tests.c

Fixes:
- http://autobuild.buildroot.org/results/8d6194982c1080e173fcef8212fb06e6dc275d58

---
   configure.ac               | 2 ++
   tests/amdgpu/basic_tests.c | 4 ++++
   2 files changed, 6 insertions(+)
configure.ac +2 -0
index d72e84ad..6effb9a2 100644
@@ -193,6 +193,8 @@ AC_CHECK_FUNCS([open_memstream],
                  [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 1, [Have open_memstream()])],
                  [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 0)])
 
+AC_CHECK_FUNCS([fork])
+
   dnl Use lots of warning flags with with gcc and compatible compilers
 
   dnl Note: if you change the following variable, the cache is automatically
tests/amdgpu/basic_tests.c +2 -0
index dbae4d53..c32a1351 100644
@@ -1646,10 +1646,12 @@ static void amdgpu_userptr_test(void)
       while (j++ < sdma_write_length)
               pm4[i++] = 0xdeadbeaf;
 
+#ifdef HAVE_FORK
       if (!fork()) {
               pm4[0] = 0x0;
               exit(0);
       }
+#endif
 
       amdgpu_test_exec_cs_helper(context_handle,
                                  AMDGPU_HW_IP_DMA, 0,
@@ -1675,7 +1677,9 @@ static void amdgpu_userptr_test(void)
       r = amdgpu_cs_ctx_free(context_handle);
       CU_ASSERT_EQUAL(r, 0);
 
Quoted 7 lines
Quoted 6 lines
Quoted 6 lines

tests/amdgpu/basic_tests.c static void amdgpu_userptr_test(void) · line 1685

Quoted 6 lines
tests/amdgpu/basic_tests.c +2 -0
+#ifdef HAVE_FORK
       wait(NULL);
+#endif
   }
 
   static void amdgpu_sync_dependency_test(void)

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

#5 lore raw

AH, enlightenment!

Yeah, the whole kernel driver won't work on no-mmu platforms. So compiling the userspace parts doesn't make any sense either.

Thanks for clearing that up, it wasn't obvious to me why we had this limitation here.

Regards,
Christian.

Am 11.03.19 um 23:25 schrieb Fabrice Fontaine:

Quoted 88 lines

OK, thanks for your input, I'll disable amdgpu on platforms without MMU.

Fabrice

Quoted 81 lines · Christian

Am 11.03.19 um 18:17 schrieb Fabrice Fontaine:

Quoted 3 lines

OK, then will you accept a patch that disable amdgpu test if fork is not available or a patch that disable all tests (for example through a --disable-test-programs option)?

No, we really need to test the correct behavior of fork() with userptrs.

So how do we spawn a child process with uclibc-ng?

I mean it is one of the most fundamental Unix functions, isn't it?

Christian.

Quoted 69 lines

Currently, the user can only disable
the cairo tests so the whole libdrm package fails to statically build with uclibc-ng on ARM cortex M4
(http://autobuild.buildroot.org/?reason=libdrm-2.4.97).

Best Regards,

Fabrice

Quoted 58 lines · Christian König

Well NAK, cause that obviously would break the test if fork() isn't available.

We certainly don't have any platform where we support amdgpu and fork() is not available, so that change is rather pointless in the first place.

Christian.

Am 10.03.19 um 10:44 schrieb Fabrice Fontaine:

Quoted 49 lines

amdgpu test program use fork since
https://cgit.freedesktop.org/mesa/drm/commit/tests/amdgpu/basic_tests.c?id=736ef0b61cab55378202c5f49d91799cc2b99091

However, this function is not always available so add a check for it in configure.ac and use it in tests/amdgpu/basic_tests.c

Fixes:
- http://autobuild.buildroot.org/results/8d6194982c1080e173fcef8212fb06e6dc275d58

---
    configure.ac               | 2 ++
    tests/amdgpu/basic_tests.c | 4 ++++
    2 files changed, 6 insertions(+)
configure.ac +2 -0
index d72e84ad..6effb9a2 100644
@@ -193,6 +193,8 @@ AC_CHECK_FUNCS([open_memstream],
                   [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 1, [Have open_memstream()])],
                   [AC_DEFINE([HAVE_OPEN_MEMSTREAM], 0)])
 
+AC_CHECK_FUNCS([fork])
+
    dnl Use lots of warning flags with with gcc and compatible compilers
 
    dnl Note: if you change the following variable, the cache is automatically
tests/amdgpu/basic_tests.c +2 -0
index dbae4d53..c32a1351 100644
@@ -1646,10 +1646,12 @@ static void amdgpu_userptr_test(void)
        while (j++ < sdma_write_length)
                pm4[i++] = 0xdeadbeaf;
 
+#ifdef HAVE_FORK
        if (!fork()) {
                pm4[0] = 0x0;
                exit(0);
        }
+#endif
 
        amdgpu_test_exec_cs_helper(context_handle,
                                   AMDGPU_HW_IP_DMA, 0,
@@ -1675,7 +1677,9 @@ static void amdgpu_userptr_test(void)
        r = amdgpu_cs_ctx_free(context_handle);
        CU_ASSERT_EQUAL(r, 0);
 
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

tests/amdgpu/basic_tests.c static void amdgpu_userptr_test(void) · line 1685

Quoted 6 lines
tests/amdgpu/basic_tests.c +2 -0
+#ifdef HAVE_FORK
        wait(NULL);
+#endif
    }
 
    static void amdgpu_sync_dependency_test(void)

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