Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH 0/7] igt: Fix musl build
@ 2023-10-22 15:52 Bernd Kuhls
  2023-10-22 15:52 ` [igt-dev] [PATCH 1/7] build: check that outb is present in io.h Bernd Kuhls
                   ` (6 more replies)
  0 siblings, 7 replies; 11+ messages in thread
From: Bernd Kuhls @ 2023-10-22 15:52 UTC (permalink / raw)
  To: igt-dev

Hi,

this is my first patch series I am sending so please be patient ;)

Currently there are efforts underway to add a igt-gpu-tools package to
the buildroot project. Besides glibc buildroot also supports musl- and
uClibc-based toolchains. While testing the new package it turns out that
igt-gpu-tools does not build with other libc's out of the box, see
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138

This patch series tries to solve the request from the bug tracker that
the void-linux patch is "splitted into some functional changes".

During build I added only those parts of the void-linux patch which were
needed to fix build errors, I quoted those errors in each patch message.
Besides that, due to my non-knowledge of C, I can not provide any more
information.

Regards, Bernd


Bernd Kuhls (1):
  build: check that outb is present in io.h

Stefano Ragni (5):
  Include limits.h to fix build with musl libc
  lib/igt_aux.h: Fix musl build
  lib/igt_x86.c: Fix musl/uclibc build
  lib/igt_halffloat.c: Fix musl/uclibc build
  benchmarks/gem_syslatency.c: Fix musl build

mhmdanas (1):
  benchmarks/gem_exec_tracer.c: Fix musl build

 benchmarks/gem_exec_tracer.c  | 4 ++++
 benchmarks/gem_syslatency.c   | 2 ++
 lib/amdgpu/amd_pci_unplug.c   | 1 +
 lib/igt_audio.c               | 1 +
 lib/igt_aux.c                 | 1 +
 lib/igt_aux.h                 | 2 +-
 lib/igt_device_scan.c         | 1 +
 lib/igt_eld.c                 | 1 +
 lib/igt_frame.c               | 1 +
 lib/igt_halffloat.c           | 2 +-
 lib/igt_hwmon.c               | 1 +
 lib/igt_x86.c                 | 2 +-
 meson.build                   | 2 +-
 runner/executor.c             | 1 +
 runner/runner_tests.c         | 1 +
 tests/device_reset.c          | 1 +
 tests/intel/i915_pm_rpm.c     | 1 +
 tests/kms_sysfs_edid_timing.c | 1 +
 tests/testdisplay.c           | 1 +
 tests/tools_test.c            | 1 +
 tools/igt_compliance_utils.c  | 1 +
 21 files changed, 25 insertions(+), 4 deletions(-)

-- 
2.39.2

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

* [igt-dev] [PATCH 1/7] build: check that outb is present in io.h
  2023-10-22 15:52 [igt-dev] [PATCH 0/7] igt: Fix musl build Bernd Kuhls
@ 2023-10-22 15:52 ` Bernd Kuhls
  2023-10-22 15:52 ` [igt-dev] [PATCH 2/7] Include limits.h to fix build with musl libc Bernd Kuhls
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Bernd Kuhls @ 2023-10-22 15:52 UTC (permalink / raw)
  To: igt-dev

With glibc if io.h exists, inb/outb are always defined.
However on musl, io.h always exists but it may not define inb/outb.

Thus, igt-gpu-tools builds with musl on non-x86 platforms will fail to
link. Fix this by checking for both io.h and that outb() is defined.

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index b35a00faa..cee8a7446 100644
--- a/meson.build
+++ b/meson.build
@@ -220,7 +220,7 @@ endif
 if cc.has_header('libgen.h')
 	config.set('HAVE_LIBGEN_H', 1)
 endif
-if cc.has_header('sys/io.h')
+if cc.has_header('sys/io.h') and cc.has_function('outb', prefix: '#include <sys/io.h>')
 	config.set('HAVE_SYS_IO_H', 1)
 endif
 if cc.links('''
-- 
2.39.2

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

* [igt-dev] [PATCH 2/7] Include limits.h to fix build with musl libc
  2023-10-22 15:52 [igt-dev] [PATCH 0/7] igt: Fix musl build Bernd Kuhls
  2023-10-22 15:52 ` [igt-dev] [PATCH 1/7] build: check that outb is present in io.h Bernd Kuhls
@ 2023-10-22 15:52 ` Bernd Kuhls
  2023-10-24 15:59   ` Kamil Konieczny
  2023-10-22 15:52 ` [igt-dev] [PATCH 3/7] lib/igt_aux.h: Fix musl build Bernd Kuhls
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Bernd Kuhls @ 2023-10-22 15:52 UTC (permalink / raw)
  To: igt-dev; +Cc: Stefano Ragni

From: Stefano Ragni <st3r4g@protonmail.com>

Original patch was added to void-linux:
https://github.com/void-linux/void-packages/commit/ddfc1f66a0c571b420303c33aed29fd38ace4fc7

Bug report with request to split the original patch into some
functional changes:
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
 lib/amdgpu/amd_pci_unplug.c   | 1 +
 lib/igt_audio.c               | 1 +
 lib/igt_aux.c                 | 1 +
 lib/igt_device_scan.c         | 1 +
 lib/igt_eld.c                 | 1 +
 lib/igt_frame.c               | 1 +
 lib/igt_hwmon.c               | 1 +
 runner/executor.c             | 1 +
 runner/runner_tests.c         | 1 +
 tests/device_reset.c          | 1 +
 tests/intel/i915_pm_rpm.c     | 1 +
 tests/kms_sysfs_edid_timing.c | 1 +
 tests/testdisplay.c           | 1 +
 tests/tools_test.c            | 1 +
 tools/igt_compliance_utils.c  | 1 +
 15 files changed, 15 insertions(+)

diff --git a/lib/amdgpu/amd_pci_unplug.c b/lib/amdgpu/amd_pci_unplug.c
index 078398b5e..554f489c6 100644
--- a/lib/amdgpu/amd_pci_unplug.c
+++ b/lib/amdgpu/amd_pci_unplug.c
@@ -21,6 +21,7 @@
  *
 */
 #include <linux/limits.h>
+#include <limits.h> // PATH_MAX
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <pthread.h>
diff --git a/lib/igt_audio.c b/lib/igt_audio.c
index e0b1bafe1..dd5e0d2c1 100644
--- a/lib/igt_audio.c
+++ b/lib/igt_audio.c
@@ -26,6 +26,7 @@
 
 #include "config.h"
 
+#include <limits.h> // PATH_MAX
 #include <errno.h>
 #include <fcntl.h>
 #include <gsl/gsl_fft_real.h>
diff --git a/lib/igt_aux.c b/lib/igt_aux.c
index 18edc5ef9..d6aeb876b 100644
--- a/lib/igt_aux.c
+++ b/lib/igt_aux.c
@@ -31,6 +31,7 @@
 #endif
 #include <stdio.h>
 #include <fcntl.h>
+#include <limits.h> // PATH_MAX
 #include <pwd.h>
 #include <sys/stat.h>
 #include <sys/ioctl.h>
diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
index f4f95fef3..23b17a715 100644
--- a/lib/igt_device_scan.c
+++ b/lib/igt_device_scan.c
@@ -27,6 +27,7 @@
 #include "igt_list.h"
 #include "intel_chipset.h"
 
+#include <limits.h> // PATH_MAX
 #include <ctype.h>
 #include <dirent.h>
 #include <fcntl.h>
diff --git a/lib/igt_eld.c b/lib/igt_eld.c
index ef6625df1..3e9b8a404 100644
--- a/lib/igt_eld.c
+++ b/lib/igt_eld.c
@@ -26,6 +26,7 @@
 #include "config.h"
 
 #include <dirent.h>
+#include <limits.h> // PATH_MAX
 #include <errno.h>
 #include <glob.h>
 #include <stdint.h>
diff --git a/lib/igt_frame.c b/lib/igt_frame.c
index 45523a79f..86b8aad4d 100644
--- a/lib/igt_frame.c
+++ b/lib/igt_frame.c
@@ -26,6 +26,7 @@
 
 #include "config.h"
 
+#include <limits.h> // PATH_MAX
 #include <fcntl.h>
 #include <pixman.h>
 #include <cairo.h>
diff --git a/lib/igt_hwmon.c b/lib/igt_hwmon.c
index f37ced2d9..53c346e73 100644
--- a/lib/igt_hwmon.c
+++ b/lib/igt_hwmon.c
@@ -2,6 +2,7 @@
 /*
  * Copyright © 2022 Intel Corporation
  */
+#include <limits.h> // PATH_MAX
 #include <sys/stat.h>
 #include <sys/sysmacros.h>
 #include <dirent.h>
diff --git a/runner/executor.c b/runner/executor.c
index d3e6296dd..d2737af89 100644
--- a/runner/executor.c
+++ b/runner/executor.c
@@ -1,6 +1,7 @@
 #include <ctype.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <limits.h> // PATH_MAX
 #include <glib.h>
 #ifdef __linux__
 #include <linux/watchdog.h>
diff --git a/runner/runner_tests.c b/runner/runner_tests.c
index a7e968f85..6d605251f 100644
--- a/runner/runner_tests.c
+++ b/runner/runner_tests.c
@@ -1,5 +1,6 @@
 #include <dirent.h>
 #include <fcntl.h>
+#include <limits.h> // PATH_MAX
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
diff --git a/tests/device_reset.c b/tests/device_reset.c
index 9ebd479df..ecb01d29f 100644
--- a/tests/device_reset.c
+++ b/tests/device_reset.c
@@ -3,6 +3,7 @@
  * Copyright(c) 2020 Intel Corporation. All rights reserved.
  */
 #include <fcntl.h>
+#include <limits.h> // PATH_MAX
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <signal.h>
diff --git a/tests/intel/i915_pm_rpm.c b/tests/intel/i915_pm_rpm.c
index 2b0a63bde..289dfc508 100644
--- a/tests/intel/i915_pm_rpm.c
+++ b/tests/intel/i915_pm_rpm.c
@@ -27,6 +27,7 @@
 
 #include "config.h"
 
+#include <limits.h> // PATH_MAX
 #include <stdio.h>
 #include <stdint.h>
 #include <stdbool.h>
diff --git a/tests/kms_sysfs_edid_timing.c b/tests/kms_sysfs_edid_timing.c
index ee47a024e..5df2da533 100644
--- a/tests/kms_sysfs_edid_timing.c
+++ b/tests/kms_sysfs_edid_timing.c
@@ -22,6 +22,7 @@
  */
 #include "igt.h"
 
+#include <limits.h> // PATH_MAX
 #include <dirent.h>
 #include <fcntl.h>
 #include <sys/stat.h>
diff --git a/tests/testdisplay.c b/tests/testdisplay.c
index 42218210f..4c31c0e59 100644
--- a/tests/testdisplay.c
+++ b/tests/testdisplay.c
@@ -58,6 +58,7 @@
 #include <strings.h>
 #include <unistd.h>
 #include <termios.h>
+#include <limits.h> // PATH_MAX
 #include <sys/poll.h>
 #include <sys/time.h>
 #include <sys/ioctl.h>
diff --git a/tests/tools_test.c b/tests/tools_test.c
index 8412ba521..f36a61927 100644
--- a/tests/tools_test.c
+++ b/tests/tools_test.c
@@ -26,6 +26,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
+#include <limits.h> // PATH_MAX
 #include <libgen.h>
 #include <unistd.h>
 #ifdef __linux__
diff --git a/tools/igt_compliance_utils.c b/tools/igt_compliance_utils.c
index 0faf3fc87..f6bd970e3 100644
--- a/tools/igt_compliance_utils.c
+++ b/tools/igt_compliance_utils.c
@@ -24,6 +24,7 @@
  */
 
 #include "igt.h"
+#include <limits.h> // PATH_MAX
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
-- 
2.39.2

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

* [igt-dev] [PATCH 3/7] lib/igt_aux.h: Fix musl build
  2023-10-22 15:52 [igt-dev] [PATCH 0/7] igt: Fix musl build Bernd Kuhls
  2023-10-22 15:52 ` [igt-dev] [PATCH 1/7] build: check that outb is present in io.h Bernd Kuhls
  2023-10-22 15:52 ` [igt-dev] [PATCH 2/7] Include limits.h to fix build with musl libc Bernd Kuhls
@ 2023-10-22 15:52 ` Bernd Kuhls
  2023-10-24 16:16   ` Kamil Konieczny
  2023-10-22 15:52 ` [igt-dev] [PATCH 4/7] lib/igt_x86.c: Fix musl/uclibc build Bernd Kuhls
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 11+ messages in thread
From: Bernd Kuhls @ 2023-10-22 15:52 UTC (permalink / raw)
  To: igt-dev; +Cc: Stefano Ragni

From: Stefano Ragni <st3r4g@protonmail.com>

Original patch was added to void-linux:
https://github.com/void-linux/void-packages/commit/ddfc1f66a0c571b420303c33aed29fd38ace4fc7

Bug report with request to split the original patch into some
functional changes:
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138

Fixes build error:
../lib/igt_aux.c:191:20: error: ‘struct sigevent’ has no member named ‘_sigev_un’
  191 |                 sev.sigev_notify_thread_id = __igt_sigiter.tid;

../lib/igt_aux.c:1994:12: error: ‘struct sigevent’ has no member named ‘_sigev_un’
 1994 |         sev.sigev_notify_thread_id = gettid();

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
 lib/igt_aux.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index fb76b0313..a13e8156a 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -48,7 +48,7 @@
 # ifndef HAVE_GETTID
 #  define gettid() (pid_t)(syscall(__NR_gettid))
 # endif
-# define sigev_notify_thread_id _sigev_un._tid
+# define sigev_notify_thread_id sigev_notify_function
 #endif
 
 /* auxialiary igt helpers from igt_aux.c */
-- 
2.39.2

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

* [igt-dev] [PATCH 4/7] lib/igt_x86.c: Fix musl/uclibc build
  2023-10-22 15:52 [igt-dev] [PATCH 0/7] igt: Fix musl build Bernd Kuhls
                   ` (2 preceding siblings ...)
  2023-10-22 15:52 ` [igt-dev] [PATCH 3/7] lib/igt_aux.h: Fix musl build Bernd Kuhls
@ 2023-10-22 15:52 ` Bernd Kuhls
  2023-10-22 15:52 ` [igt-dev] [PATCH 5/7] lib/igt_halffloat.c: " Bernd Kuhls
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 11+ messages in thread
From: Bernd Kuhls @ 2023-10-22 15:52 UTC (permalink / raw)
  To: igt-dev; +Cc: Stefano Ragni

From: Stefano Ragni <st3r4g@protonmail.com>

Original patch was added to void-linux:
https://github.com/void-linux/void-packages/commit/ddfc1f66a0c571b420303c33aed29fd38ace4fc7

Bug report with request to split the original patch into some
functional changes:
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138

Fixes build error:
../lib/igt_x86.c:295:6: error: ‘ifunc’ is not supported on this target
  295 | void igt_memcpy_from_wc(void *dst, const void *src, unsigned long len)

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
 lib/igt_x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_x86.c b/lib/igt_x86.c
index 6ac700df0..8c102fd13 100644
--- a/lib/igt_x86.c
+++ b/lib/igt_x86.c
@@ -190,7 +190,7 @@ char *igt_x86_features_to_string(unsigned features, char *line)
 }
 #endif
 
-#if defined(__x86_64__) && !defined(__clang__)
+#if defined(__x86_64__) && !defined(__clang__) && defined(__GLIBC__) && !defined(__UCLIBC__)
 #pragma GCC push_options
 #pragma GCC target("sse4.1")
 #pragma GCC diagnostic ignored "-Wpointer-arith"
-- 
2.39.2

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

* [igt-dev] [PATCH 5/7] lib/igt_halffloat.c: Fix musl/uclibc build
  2023-10-22 15:52 [igt-dev] [PATCH 0/7] igt: Fix musl build Bernd Kuhls
                   ` (3 preceding siblings ...)
  2023-10-22 15:52 ` [igt-dev] [PATCH 4/7] lib/igt_x86.c: Fix musl/uclibc build Bernd Kuhls
@ 2023-10-22 15:52 ` Bernd Kuhls
  2023-10-22 15:52 ` [igt-dev] [PATCH 6/7] benchmarks/gem_exec_tracer.c: Fix musl build Bernd Kuhls
  2023-10-22 15:52 ` [igt-dev] [PATCH 7/7] benchmarks/gem_syslatency.c: " Bernd Kuhls
  6 siblings, 0 replies; 11+ messages in thread
From: Bernd Kuhls @ 2023-10-22 15:52 UTC (permalink / raw)
  To: igt-dev; +Cc: Stefano Ragni

From: Stefano Ragni <st3r4g@protonmail.com>

Original patch was added to void-linux:
https://github.com/void-linux/void-packages/commit/ddfc1f66a0c571b420303c33aed29fd38ace4fc7

Bug report with request to split the original patch into some
functional changes:
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138

Fixes build error:
../lib/igt_halffloat.c:205:6: error: ‘ifunc’ is not supported on this target
  205 | void igt_float_to_half(const float *f, uint16_t *h, unsigned int num)

../lib/igt_halffloat.c:216:6: error: ‘ifunc’ is not supported on this target
  216 | void igt_half_to_float(const uint16_t *h, float *f, unsigned int num)

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
 lib/igt_halffloat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/igt_halffloat.c b/lib/igt_halffloat.c
index 08ab05fce..5dbe08e01 100644
--- a/lib/igt_halffloat.c
+++ b/lib/igt_halffloat.c
@@ -162,7 +162,7 @@ static inline float _half_to_float(uint16_t val)
 	return fi.f;
 }
 
-#if defined(__x86_64__) && !defined(__clang__)
+#if defined(__x86_64__) && !defined(__clang__) && defined(__GLIBC__) && !defined(__UCLIBC__)
 #pragma GCC push_options
 #pragma GCC target("f16c")
 
-- 
2.39.2

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

* [igt-dev] [PATCH 6/7] benchmarks/gem_exec_tracer.c: Fix musl build
  2023-10-22 15:52 [igt-dev] [PATCH 0/7] igt: Fix musl build Bernd Kuhls
                   ` (4 preceding siblings ...)
  2023-10-22 15:52 ` [igt-dev] [PATCH 5/7] lib/igt_halffloat.c: " Bernd Kuhls
@ 2023-10-22 15:52 ` Bernd Kuhls
  2023-10-24 16:09   ` Kamil Konieczny
  2023-10-22 15:52 ` [igt-dev] [PATCH 7/7] benchmarks/gem_syslatency.c: " Bernd Kuhls
  6 siblings, 1 reply; 11+ messages in thread
From: Bernd Kuhls @ 2023-10-22 15:52 UTC (permalink / raw)
  To: igt-dev; +Cc: mhmdanas

From: mhmdanas <triallax@tutanota.com>

Original patch was added to void-linux:
https://github.com/void-linux/void-packages/commit/111918317d06598fe1459dbe139923404f3f4b9d

Bug report with request to split the original patch into some
functional changes:
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138

Fixes build error:
../benchmarks/gem_exec_tracer.c:274:1: error: conflicting types for ‘ioctl’; have ‘int(int,  long unsigned int, ...)’
  274 | ioctl(int fd, unsigned long request, ...)

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
 benchmarks/gem_exec_tracer.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/benchmarks/gem_exec_tracer.c b/benchmarks/gem_exec_tracer.c
index 7e86473e4..3156dfc23 100644
--- a/benchmarks/gem_exec_tracer.c
+++ b/benchmarks/gem_exec_tracer.c
@@ -271,7 +271,11 @@ static int is_i915(int fd)
 }
 
 int
+#ifdef __GLIBC__
 ioctl(int fd, unsigned long request, ...)
+#else
+ioctl(int fd, int request, ...)
+#endif
 {
 	struct trace *t, **p;
 	va_list args;
-- 
2.39.2

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

* [igt-dev] [PATCH 7/7] benchmarks/gem_syslatency.c: Fix musl build
  2023-10-22 15:52 [igt-dev] [PATCH 0/7] igt: Fix musl build Bernd Kuhls
                   ` (5 preceding siblings ...)
  2023-10-22 15:52 ` [igt-dev] [PATCH 6/7] benchmarks/gem_exec_tracer.c: Fix musl build Bernd Kuhls
@ 2023-10-22 15:52 ` Bernd Kuhls
  6 siblings, 0 replies; 11+ messages in thread
From: Bernd Kuhls @ 2023-10-22 15:52 UTC (permalink / raw)
  To: igt-dev; +Cc: Stefano Ragni

From: Stefano Ragni <st3r4g@protonmail.com>

Original patch was added to void-linux:
https://github.com/void-linux/void-packages/commit/ddfc1f66a0c571b420303c33aed29fd38ace4fc7

Bug report with request to split the original patch into some
functional changes:
https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138

Fixes build error:
../benchmarks/gem_syslatency.c:166:13: error: ‘union <anonymous>’ has no member named ‘sigev_notify_thread_id’
  166 |         sev.sigev_notify_thread_id = gettid();

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
 benchmarks/gem_syslatency.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/benchmarks/gem_syslatency.c b/benchmarks/gem_syslatency.c
index 312c428b7..e0740fc11 100644
--- a/benchmarks/gem_syslatency.c
+++ b/benchmarks/gem_syslatency.c
@@ -46,6 +46,8 @@
 #include <linux/unistd.h>
 #endif
 
+#define sigev_notify_thread_id sigev_notify_function
+
 #include "i915/gem_create.h"
 #include "i915/gem_ring.h"
 #include "igt_aux.h"
-- 
2.39.2

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

* Re: [igt-dev] [PATCH 2/7] Include limits.h to fix build with musl libc
  2023-10-22 15:52 ` [igt-dev] [PATCH 2/7] Include limits.h to fix build with musl libc Bernd Kuhls
@ 2023-10-24 15:59   ` Kamil Konieczny
  0 siblings, 0 replies; 11+ messages in thread
From: Kamil Konieczny @ 2023-10-24 15:59 UTC (permalink / raw)
  To: igt-dev; +Cc: Bernd Kuhls, Stefano Ragni

Hi Bernd,
On 2023-10-22 at 17:52:21 +0200, Bernd Kuhls wrote:
> From: Stefano Ragni <st3r4g@protonmail.com>
> 
> Original patch was added to void-linux:
> https://github.com/void-linux/void-packages/commit/ddfc1f66a0c571b420303c33aed29fd38ace4fc7
> 
> Bug report with request to split the original patch into some
> functional changes:
> https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138
> 

Add here s-o-b from Stefano:

Signed-off-by: Stefano Ragni <st3r4g@protonmail.com>
> Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
> ---
>  lib/amdgpu/amd_pci_unplug.c   | 1 +
>  lib/igt_audio.c               | 1 +
>  lib/igt_aux.c                 | 1 +
>  lib/igt_device_scan.c         | 1 +
>  lib/igt_eld.c                 | 1 +
>  lib/igt_frame.c               | 1 +
>  lib/igt_hwmon.c               | 1 +
>  runner/executor.c             | 1 +
>  runner/runner_tests.c         | 1 +
>  tests/device_reset.c          | 1 +
>  tests/intel/i915_pm_rpm.c     | 1 +
-------------- ^^^^^^^^^^^^^
There is no MAX_PATH in this file?

>  tests/kms_sysfs_edid_timing.c | 1 +
>  tests/testdisplay.c           | 1 +
>  tests/tools_test.c            | 1 +
>  tools/igt_compliance_utils.c  | 1 +
>  15 files changed, 15 insertions(+)
> 
> diff --git a/lib/amdgpu/amd_pci_unplug.c b/lib/amdgpu/amd_pci_unplug.c
> index 078398b5e..554f489c6 100644
> --- a/lib/amdgpu/amd_pci_unplug.c
> +++ b/lib/amdgpu/amd_pci_unplug.c
> @@ -21,6 +21,7 @@
>   *
>  */
>  #include <linux/limits.h>
------------------ ^^^^^^^^
> +#include <limits.h> // PATH_MAX
------------ ^^^^^^^^
Looks like it already have limits there?

>  #include <fcntl.h>
>  #include <sys/stat.h>
>  #include <pthread.h>
> diff --git a/lib/igt_audio.c b/lib/igt_audio.c
> index e0b1bafe1..dd5e0d2c1 100644
> --- a/lib/igt_audio.c
> +++ b/lib/igt_audio.c
> @@ -26,6 +26,7 @@
>  
>  #include "config.h"
>  
> +#include <limits.h> // PATH_MAX
------------ ^^^^^^^^
Put this in alphabetical order.

>  #include <errno.h>
>  #include <fcntl.h>
>  #include <gsl/gsl_fft_real.h>
> diff --git a/lib/igt_aux.c b/lib/igt_aux.c
> index 18edc5ef9..d6aeb876b 100644
> --- a/lib/igt_aux.c
> +++ b/lib/igt_aux.c
> @@ -31,6 +31,7 @@
>  #endif
>  #include <stdio.h>
>  #include <fcntl.h>
> +#include <limits.h> // PATH_MAX
>  #include <pwd.h>
>  #include <sys/stat.h>
>  #include <sys/ioctl.h>
> diff --git a/lib/igt_device_scan.c b/lib/igt_device_scan.c
> index f4f95fef3..23b17a715 100644
> --- a/lib/igt_device_scan.c
> +++ b/lib/igt_device_scan.c
> @@ -27,6 +27,7 @@
>  #include "igt_list.h"
>  #include "intel_chipset.h"
>  
> +#include <limits.h> // PATH_MAX
------------ ^^^^^^^^
Put this in alphabetical order.

>  #include <ctype.h>
>  #include <dirent.h>
>  #include <fcntl.h>
> diff --git a/lib/igt_eld.c b/lib/igt_eld.c
> index ef6625df1..3e9b8a404 100644
> --- a/lib/igt_eld.c
> +++ b/lib/igt_eld.c
> @@ -26,6 +26,7 @@
>  #include "config.h"
>  
>  #include <dirent.h>
> +#include <limits.h> // PATH_MAX
------------ ^^^^^^^^
Put this in alphabetical order.

>  #include <errno.h>
>  #include <glob.h>
>  #include <stdint.h>
> diff --git a/lib/igt_frame.c b/lib/igt_frame.c
> index 45523a79f..86b8aad4d 100644
> --- a/lib/igt_frame.c
> +++ b/lib/igt_frame.c
> @@ -26,6 +26,7 @@
>  
>  #include "config.h"
>  
> +#include <limits.h> // PATH_MAX
------------ ^^^^^^^^
Put this in alphabetical order.

>  #include <fcntl.h>
>  #include <pixman.h>
>  #include <cairo.h>
> diff --git a/lib/igt_hwmon.c b/lib/igt_hwmon.c
> index f37ced2d9..53c346e73 100644
> --- a/lib/igt_hwmon.c
> +++ b/lib/igt_hwmon.c
> @@ -2,6 +2,7 @@
>  /*
>   * Copyright © 2022 Intel Corporation
>   */
> +#include <limits.h> // PATH_MAX
>  #include <sys/stat.h>
>  #include <sys/sysmacros.h>
>  #include <dirent.h>
> diff --git a/runner/executor.c b/runner/executor.c
> index d3e6296dd..d2737af89 100644
> --- a/runner/executor.c
> +++ b/runner/executor.c
> @@ -1,6 +1,7 @@
>  #include <ctype.h>
>  #include <errno.h>
>  #include <fcntl.h>
> +#include <limits.h> // PATH_MAX
------------ ^^^^^^^^
Put this in alphabetical order.

>  #include <glib.h>
>  #ifdef __linux__
>  #include <linux/watchdog.h>
> diff --git a/runner/runner_tests.c b/runner/runner_tests.c
> index a7e968f85..6d605251f 100644
> --- a/runner/runner_tests.c
> +++ b/runner/runner_tests.c
> @@ -1,5 +1,6 @@
>  #include <dirent.h>
>  #include <fcntl.h>
> +#include <limits.h> // PATH_MAX
>  #include <sys/stat.h>
>  #include <sys/types.h>
>  #include <unistd.h>
> diff --git a/tests/device_reset.c b/tests/device_reset.c
> index 9ebd479df..ecb01d29f 100644
> --- a/tests/device_reset.c
> +++ b/tests/device_reset.c
> @@ -3,6 +3,7 @@
>   * Copyright(c) 2020 Intel Corporation. All rights reserved.
>   */
>  #include <fcntl.h>
> +#include <limits.h> // PATH_MAX
>  #include <sys/ioctl.h>
>  #include <sys/stat.h>
>  #include <signal.h>
> diff --git a/tests/intel/i915_pm_rpm.c b/tests/intel/i915_pm_rpm.c
> index 2b0a63bde..289dfc508 100644
> --- a/tests/intel/i915_pm_rpm.c
> +++ b/tests/intel/i915_pm_rpm.c
> @@ -27,6 +27,7 @@
>  
>  #include "config.h"
>  
> +#include <limits.h> // PATH_MAX

Remove this change, there is no PATH_MAX in this file.

>  #include <stdio.h>
>  #include <stdint.h>
>  #include <stdbool.h>
> diff --git a/tests/kms_sysfs_edid_timing.c b/tests/kms_sysfs_edid_timing.c
> index ee47a024e..5df2da533 100644
> --- a/tests/kms_sysfs_edid_timing.c
> +++ b/tests/kms_sysfs_edid_timing.c
> @@ -22,6 +22,7 @@
>   */
>  #include "igt.h"
>  
> +#include <limits.h> // PATH_MAX
------------ ^^^^^^^^
Put this in alphabetical order.

>  #include <dirent.h>
>  #include <fcntl.h>
>  #include <sys/stat.h>
> diff --git a/tests/testdisplay.c b/tests/testdisplay.c
> index 42218210f..4c31c0e59 100644
> --- a/tests/testdisplay.c
> +++ b/tests/testdisplay.c
> @@ -58,6 +58,7 @@
>  #include <strings.h>
>  #include <unistd.h>
>  #include <termios.h>
> +#include <limits.h> // PATH_MAX
------------ ^^^^^^^^
Put this in alphabetical order.

>  #include <sys/poll.h>
>  #include <sys/time.h>
>  #include <sys/ioctl.h>
> diff --git a/tests/tools_test.c b/tests/tools_test.c
> index 8412ba521..f36a61927 100644
> --- a/tests/tools_test.c
> +++ b/tests/tools_test.c
> @@ -26,6 +26,7 @@
>  #include <sys/types.h>
>  #include <sys/stat.h>
>  #include <fcntl.h>
> +#include <limits.h> // PATH_MAX
------------ ^^^^^^^^
Put this in alphabetical order.

Regards,
Kamil

>  #include <libgen.h>
>  #include <unistd.h>
>  #ifdef __linux__
> diff --git a/tools/igt_compliance_utils.c b/tools/igt_compliance_utils.c
> index 0faf3fc87..f6bd970e3 100644
> --- a/tools/igt_compliance_utils.c
> +++ b/tools/igt_compliance_utils.c
> @@ -24,6 +24,7 @@
>   */
>  
>  #include "igt.h"
> +#include <limits.h> // PATH_MAX
>  #include <stdio.h>
>  #include <string.h>
>  #include <stdlib.h>
> -- 
> 2.39.2
> 

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

* Re: [igt-dev] [PATCH 6/7] benchmarks/gem_exec_tracer.c: Fix musl build
  2023-10-22 15:52 ` [igt-dev] [PATCH 6/7] benchmarks/gem_exec_tracer.c: Fix musl build Bernd Kuhls
@ 2023-10-24 16:09   ` Kamil Konieczny
  0 siblings, 0 replies; 11+ messages in thread
From: Kamil Konieczny @ 2023-10-24 16:09 UTC (permalink / raw)
  To: igt-dev; +Cc: mhmdanas, Bernd Kuhls

Hi Bernd,
On 2023-10-22 at 17:52:25 +0200, Bernd Kuhls wrote:
> From: mhmdanas <triallax@tutanota.com>
------- ^^^^^^^^
Please no nicks in author or s-o-b, write here full name.

+cc Petri

Btw did you check against new igt sources, v1.28?

> 
> Original patch was added to void-linux:
> https://github.com/void-linux/void-packages/commit/111918317d06598fe1459dbe139923404f3f4b9d
> 
> Bug report with request to split the original patch into some
> functional changes:
> https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138

Please move gitlab link below.

> 
> Fixes build error:
> ../benchmarks/gem_exec_tracer.c:274:1: error: conflicting types for ‘ioctl’; have ‘int(int,  long unsigned int, ...)’
>   274 | ioctl(int fd, unsigned long request, ...)

Write "Link: ..." here:

Link: https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138
> Signed-off-by: Bernd Kuhls <bernd@kuhls.net>

Regards,
Kamil

> ---
>  benchmarks/gem_exec_tracer.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/benchmarks/gem_exec_tracer.c b/benchmarks/gem_exec_tracer.c
> index 7e86473e4..3156dfc23 100644
> --- a/benchmarks/gem_exec_tracer.c
> +++ b/benchmarks/gem_exec_tracer.c
> @@ -271,7 +271,11 @@ static int is_i915(int fd)
>  }
>  
>  int
> +#ifdef __GLIBC__
>  ioctl(int fd, unsigned long request, ...)
> +#else
> +ioctl(int fd, int request, ...)
> +#endif
>  {
>  	struct trace *t, **p;
>  	va_list args;
> -- 
> 2.39.2
> 

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

* Re: [igt-dev] [PATCH 3/7] lib/igt_aux.h: Fix musl build
  2023-10-22 15:52 ` [igt-dev] [PATCH 3/7] lib/igt_aux.h: Fix musl build Bernd Kuhls
@ 2023-10-24 16:16   ` Kamil Konieczny
  0 siblings, 0 replies; 11+ messages in thread
From: Kamil Konieczny @ 2023-10-24 16:16 UTC (permalink / raw)
  To: igt-dev; +Cc: Bernd Kuhls, Stefano Ragni

Hi Bernd,

On 2023-10-22 at 17:52:22 +0200, Bernd Kuhls wrote:
> From: Stefano Ragni <st3r4g@protonmail.com>
> 
> Original patch was added to void-linux:
> https://github.com/void-linux/void-packages/commit/ddfc1f66a0c571b420303c33aed29fd38ace4fc7
> 
> Bug report with request to split the original patch into some
> functional changes:
> https://gitlab.freedesktop.org/drm/igt-gpu-tools/-/issues/138
> 
> Fixes build error:
> ../lib/igt_aux.c:191:20: error: ‘struct sigevent’ has no member named ‘_sigev_un’
>   191 |                 sev.sigev_notify_thread_id = __igt_sigiter.tid;
> 
> ../lib/igt_aux.c:1994:12: error: ‘struct sigevent’ has no member named ‘_sigev_un’
>  1994 |         sev.sigev_notify_thread_id = gettid();

While it fixes your build (?) it breaks igt build on current
Ubuntu 22/x86_64, see:

[130/1763] Compiling C object lib/libigt-igt_aux_c.a.p/igt_aux.c.o
../lib/igt_aux.c: In function 'igt_sigiter_start':
../lib/igt_aux.c:191:44: warning: assignment to 'void (*)(__sigval_t)' {aka 'void (*)(union sigval)'} from 'pid_t' {aka 'int'} makes pointer from integer without a cast [-Wint-conversion]
  191 |                 sev.sigev_notify_thread_id = __igt_sigiter.tid;
      |                                            ^

../lib/igt_aux.c: In function 'igt_start_siglatency':
../lib/igt_aux.c:1994:36: warning: assignment to 'void (*)(__sigval_t)' {aka 'void (*)(union sigval)'} from '__pid_t' {aka 'int'} makes pointer from integer without a cast [-Wint-conversion]
 1994 |         sev.sigev_notify_thread_id = gettid();
      |                                    ^
--
[516/1763] Compiling C object tests/gem_close_race.p/intel_gem_close_race.c.o
../tests/intel/gem_close_race.c: In function 'thread':
../tests/intel/gem_close_race.c:269:36: warning: assignment to 'void (*)(__sigval_t)' {aka 'void (*)(union sigval)'} from '__pid_t' {aka 'int'} makes pointer from integer without a cast [-Wint-conversion]
  269 |         sev.sigev_notify_thread_id = gettid();
      |                                    ^
--
[1537/1763] Compiling C object benchmarks/gem_syslatency.p/gem_syslatency.c.o
../benchmarks/gem_syslatency.c: In function 'sys_wait':
../benchmarks/gem_syslatency.c:168:36: warning: assignment to 'void (*)(__sigval_t)' {aka 'void (*)(union sigval)'} from '__pid_t' {aka 'int'} makes pointer from integer without a cast [-Wint-conversion]
  168 |         sev.sigev_notify_thread_id = gettid();
      |                                    ^

Regards,
Kamil

> 
> Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
> ---
>  lib/igt_aux.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/igt_aux.h b/lib/igt_aux.h
> index fb76b0313..a13e8156a 100644
> --- a/lib/igt_aux.h
> +++ b/lib/igt_aux.h
> @@ -48,7 +48,7 @@
>  # ifndef HAVE_GETTID
>  #  define gettid() (pid_t)(syscall(__NR_gettid))
>  # endif
> -# define sigev_notify_thread_id _sigev_un._tid
> +# define sigev_notify_thread_id sigev_notify_function
>  #endif
>  
>  /* auxialiary igt helpers from igt_aux.c */
> -- 
> 2.39.2
> 

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

end of thread, other threads:[~2023-10-24 16:16 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-22 15:52 [igt-dev] [PATCH 0/7] igt: Fix musl build Bernd Kuhls
2023-10-22 15:52 ` [igt-dev] [PATCH 1/7] build: check that outb is present in io.h Bernd Kuhls
2023-10-22 15:52 ` [igt-dev] [PATCH 2/7] Include limits.h to fix build with musl libc Bernd Kuhls
2023-10-24 15:59   ` Kamil Konieczny
2023-10-22 15:52 ` [igt-dev] [PATCH 3/7] lib/igt_aux.h: Fix musl build Bernd Kuhls
2023-10-24 16:16   ` Kamil Konieczny
2023-10-22 15:52 ` [igt-dev] [PATCH 4/7] lib/igt_x86.c: Fix musl/uclibc build Bernd Kuhls
2023-10-22 15:52 ` [igt-dev] [PATCH 5/7] lib/igt_halffloat.c: " Bernd Kuhls
2023-10-22 15:52 ` [igt-dev] [PATCH 6/7] benchmarks/gem_exec_tracer.c: Fix musl build Bernd Kuhls
2023-10-24 16:09   ` Kamil Konieczny
2023-10-22 15:52 ` [igt-dev] [PATCH 7/7] benchmarks/gem_syslatency.c: " Bernd Kuhls

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox