Skip to contentSkip to conversation

Fix i-g-t on old systems

PATCH Superseded Lucas De Marchi 6 participants 15 messages Jul 19, 2018 – Jul 20, 2018 Arm/Amlogic Meson SoC support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Fix i-g-t on old systems

IGT now requires memfd_create() which is not available on old versions of glibc (or some alternative libcs). This provides a minimal intrusive way to keep building on those old systems without polluting the code with a compatibility layer.

The approach is similar to what I've been using in other projects like systemd, kmod, ardupilot, etc. The syscall numbers came from systemd.

Lucas De Marchi (2):
build: provide include for missing syscalls
stubs: provide implementation for memfd_create

 lib/stubs/syscall/README     |  6 ++++++
 lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
 meson.build                  |  5 ++++-
 3 files changed, 47 insertions(+), 1 deletion(-)
 create mode 100644 lib/stubs/syscall/README
 create mode 100644 lib/stubs/syscall/sys/mman.h
Signature · 6 lines
2.17.1

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

PATCH 1/2 build: provide include for missing syscalls

Add directory with README file to allow missing syscalls to be defined. The syscalls themselves will be provided in follow up patches.

---
 lib/stubs/syscall/README | 6 ++++++
 meson.build              | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 lib/stubs/syscall/README
lib/stubs/syscall/README new file +6 -0
new file mode 100644
index 00000000..f05b9a6f
@@ -0,0 +1,6 @@
+This directory contains stub implementations for syscalls missing from libc.
+This provides a way to build IGT on an old system, but it will not run
+correctly if the kernel is missing the functionality provided. In order to
+add a new definition, follow the same directory hierarchy as the standard
+location in which the header is defined so we don't have to clutter the
+codebase to support old systems.
meson.build +1 -1
index 5a931565..c24a3cf4 100644
@@ -64,7 +64,7 @@ _tests_required = build_tests == 'true'
 
 build_info = []
 
-inc = include_directories('include/drm-uapi', 'lib', '.')
+inc = include_directories('include/drm-uapi', 'lib', 'lib/stubs/syscall', '.')
 
 inc_for_gtkdoc = include_directories('lib')
 
Signature · 6 lines
2.17.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#2 lore raw

PATCH 2/2 stubs: provide implementation for memfd_create

In reply to Lucas De Marchi

When libc misses memfd_create(), provide a stub implementation to go through the syscall() route. Syscall numbers are provided for platforms currently supported by i-g-t only.

---
 lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
 meson.build                  |  3 +++
 2 files changed, 40 insertions(+)
 create mode 100644 lib/stubs/syscall/sys/mman.h
lib/stubs/syscall/sys/mman.h new file +37 -0
new file mode 100644
index 00000000..36060bda
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: MIT */
+
+#pragma once
+
+#include_next <sys/mman.h>
+
+#if !HAVE_MEMFD_CREATE
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef __NR_memfd_create
+#if defined __x86_64__
+#define __NR_memfd_create 319
+#elif defined __i386__
+#define __NR_memfd_create 356
+#elif defined __arm__
+#define __NR_memfd_create 385
+#else
+#warning "__NR_memfd_create unknown for your architecture"
+#endif
+#endif
+
+static inline int missing_memfd_create(const char *name, unsigned int flags)
+{
+#ifdef __NR_memfd_create
+	return syscall(__NR_memfd_create, name, flags);
+#else
+	errno = ENOSYS;
+	return -1;
+#endif
+}
+
+#define memfd_create missing_memfd_create
+
+#endif
meson.build +3 -0
index c24a3cf4..188301ca 100644
@@ -196,6 +196,9 @@ if cc.has_member('struct sysinfo', 'totalram',
 	config.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
 endif
 
+have = cc.has_function('memfd_create', prefix : '''#include <sys/mman.h>''', args : '-D_GNU_SOURCE')
+config.set10('HAVE_MEMFD_CREATE', have)
+
 add_project_arguments('-D_GNU_SOURCE', language : 'c')
 add_project_arguments('-include', 'config.h', language : 'c')
 
Signature · 6 lines
2.17.1

_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#3 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create

meson.build

Quoted 58 lines · Lucas De Marchi

When libc misses memfd_create(), provide a stub implementation to go through the syscall() route. Syscall numbers are provided for platforms currently supported by i-g-t only.

---
  lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
  meson.build                  |  3 +++
  2 files changed, 40 insertions(+)

create mode 100644 lib/stubs/syscall/sys/mman.h

lib/stubs/syscall/sys/mman.h new file +37 -0
new file mode 100644
index 00000000..36060bda
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: MIT */
+
+#pragma once
+
+#include_next <sys/mman.h>
+
+#if !HAVE_MEMFD_CREATE
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef __NR_memfd_create
+#if defined __x86_64__
+#define __NR_memfd_create 319
+#elif defined __i386__
+#define __NR_memfd_create 356
+#elif defined __arm__
+#define __NR_memfd_create 385
+#else
+#warning "__NR_memfd_create unknown for your architecture"
+#endif
+#endif
+
+static inline int missing_memfd_create(const char *name, unsigned int flags)
+{
+#ifdef __NR_memfd_create
+	return syscall(__NR_memfd_create, name, flags);
+#else
+	errno = ENOSYS;
+	return -1;
+#endif
+}
+
+#define memfd_create missing_memfd_create
+
+#endif
meson.build +0 -0
index c24a3cf4..188301ca 100644

No love for make?

Antonio

meson.build if cc.has_member('struct sysinfo', 'totalram', · line 204

Quoted 11 lines
meson.build +3 -0
@@ -196,6 +196,9 @@ if cc.has_member('struct sysinfo', 'totalram',
  	config.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
  endif
 
+have = cc.has_function('memfd_create', prefix : '''#include <sys/mman.h>''', args : '-D_GNU_SOURCE')
+config.set10('HAVE_MEMFD_CREATE', have)
+
  add_project_arguments('-D_GNU_SOURCE', language : 'c')
  add_project_arguments('-include', 'config.h', language : 'c')
 

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

#4 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create

Quoted 55 lines · Antonio Argenziano
Quoted 53 lines · Lucas De Marchi

When libc misses memfd_create(), provide a stub implementation to go through the syscall() route. Syscall numbers are provided for platforms currently supported by i-g-t only.

---
  lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
  meson.build                  |  3 +++
  2 files changed, 40 insertions(+)

create mode 100644 lib/stubs/syscall/sys/mman.h

lib/stubs/syscall/sys/mman.h new file +25 -0
new file mode 100644
index 00000000..36060bda
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: MIT */
+
+#pragma once
+
+#include_next <sys/mman.h>
+
+#if !HAVE_MEMFD_CREATE
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef __NR_memfd_create
+#if defined __x86_64__
+#define __NR_memfd_create 319
+#elif defined __i386__
+#define __NR_memfd_create 356
+#elif defined __arm__
+#define __NR_memfd_create 385
+#else
+#warning "__NR_memfd_create unknown for your architecture"
+#endif
+#endif
+
+static inline int missing_memfd_create(const char *name, unsigned int

flags)

lib/stubs/syscall/sys/mman.h new file +10 -0
+{
+#ifdef __NR_memfd_create
+	return syscall(__NR_memfd_create, name, flags);
+#else
+	errno = ENOSYS;
+	return -1;
+#endif
+}
+
+#define memfd_create missing_memfd_create
Quoted 8 lines

meson.build

Quoted 6 lines
lib/stubs/syscall/sys/mman.h new file +2 -0
+
+#endif
meson.build +0 -0
index c24a3cf4..188301ca 100644

No love for make?

no, afaik it's dead, isn't it? Worse than supporting an old build system is having to support it in addition to the new one.

Lucas De Marchi

Quoted 7 lines

Antonio

Quoted 4 lines
meson.build +0 -0
@@ -196,6 +196,9 @@ if cc.has_member('struct sysinfo', 'totalram',
  	config.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
  endif
 
Quoted 8 lines

meson.build if cc.has_member('struct sysinfo', 'totalram', · line 203

Quoted 8 lines
meson.build +3 -0
+have = cc.has_function('memfd_create', prefix : '''#include
 <sys/mman.h>''', args : '-D_GNU_SOURCE')
+config.set10('HAVE_MEMFD_CREATE', have)
+
  add_project_arguments('-D_GNU_SOURCE', language : 'c')
  add_project_arguments('-include', 'config.h', language : 'c')

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

#13 lore raw

[igt-dev] ✓ Fi.CI.BAT: success for Fix i-g-t on old systems

In reply to Lucas De Marchi
== Series Details ==

== Series Details ==

Series: Fix i-g-t on old systems
URL : https://patchwork.freedesktop.org/series/46892/
State : success

== Summary ==

= CI Bug Log - changes from CI_DRM_4509 -> IGTPW_1610 =

== Summary - SUCCESS ==

No regressions found.

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

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@kms_flip@basic-flip-vs-dpms:
      fi-bxt-dsi:         PASS -> INCOMPLETE (fdo#103927)

fdo#103927 https://bugs.freedesktop.org/show_bug.cgi?id=103927

== Participating hosts (46 -> 42) ==

Additional (1): fi-kbl-7560u
Missing (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u

== Build changes ==

* IGT: IGT_4567 -> IGTPW_1610

CI_DRM_4509: e84aa0b47beed78a5a12db93e76fb00eab5db160 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1610: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1610/
IGT_4567: 7f85adc4050182f490c7a5c48db3d57cdb00af4e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

#5 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create

In reply to De Marchi, Lucas
Quoted 65 lines · Lucas
Quoted 55 lines · Antonio Argenziano
Quoted 53 lines · Lucas De Marchi

When libc misses memfd_create(), provide a stub implementation to go through the syscall() route. Syscall numbers are provided for platforms currently supported by i-g-t only.

---
   lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
   meson.build                  |  3 +++
   2 files changed, 40 insertions(+)

create mode 100644 lib/stubs/syscall/sys/mman.h

lib/stubs/syscall/sys/mman.h new file +25 -0
new file mode 100644
index 00000000..36060bda
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: MIT */
+
+#pragma once
+
+#include_next <sys/mman.h>
+
+#if !HAVE_MEMFD_CREATE
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef __NR_memfd_create
+#if defined __x86_64__
+#define __NR_memfd_create 319
+#elif defined __i386__
+#define __NR_memfd_create 356
+#elif defined __arm__
+#define __NR_memfd_create 385
+#else
+#warning "__NR_memfd_create unknown for your architecture"
+#endif
+#endif
+
+static inline int missing_memfd_create(const char *name, unsigned int

flags)

lib/stubs/syscall/sys/mman.h new file +10 -0
+{
+#ifdef __NR_memfd_create
+	return syscall(__NR_memfd_create, name, flags);
+#else
+	errno = ENOSYS;
+	return -1;
+#endif
+}
+
+#define memfd_create missing_memfd_create
Quoted 8 lines

meson.build

Quoted 6 lines
lib/stubs/syscall/sys/mman.h new file +2 -0
+
+#endif
meson.build +0 -0
index c24a3cf4..188301ca 100644

No love for make?

Quoted 2 lines

no, afaik it's dead, isn't it? Worse than supporting an old build system is having to support it in addition to the new one.

Yeah, but we have been duplicating changes for the two systems. I am OK with doing this for meson only.

Series Acked-by: Antonio Argenziano <[email protected]>

Quoted 11 lines

Lucas De Marchi

Quoted 7 lines

Antonio

Quoted 4 lines
meson.build +0 -0
@@ -196,6 +196,9 @@ if cc.has_member('struct sysinfo', 'totalram',
   	config.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
   endif
 
Quoted 7 lines
Quoted 7 lines

meson.build if cc.has_member('struct sysinfo', 'totalram', · line 203

Quoted 7 lines
meson.build +3 -0
+have = cc.has_function('memfd_create', prefix : '''#include
 <sys/mman.h>''', args : '-D_GNU_SOURCE')
+config.set10('HAVE_MEMFD_CREATE', have)
+
   add_project_arguments('-D_GNU_SOURCE', language : 'c')
   add_project_arguments('-include', 'config.h', language : 'c')

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

#9 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create

In reply to Lucas De Marchi
Quoted 17 lines · Lucas De Marchi

When libc misses memfd_create(), provide a stub implementation to go through the syscall() route. Syscall numbers are provided for platforms currently supported by i-g-t only.

---
  lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
  meson.build                  |  3 +++
  2 files changed, 40 insertions(+)

create mode 100644 lib/stubs/syscall/sys/mman.h

lib/stubs/syscall/sys/mman.h new file +0 -0
new file mode 100644
index 00000000..36060bda

lib/stubs/syscall/sys/mman.h line 7

Quoted 7 lines
lib/stubs/syscall/sys/mman.h new file +7 -0
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: MIT */
+
+#pragma once
+
+#include_next <sys/mman.h>
+
+#if !HAVE_MEMFD_CREATE

Maybe include <linux/memfd.h> conditionally. I don't think we need it for anything else.

Thanks,
Antonio

Quoted 36 lines
lib/stubs/syscall/sys/mman.h new file +30 -0
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef __NR_memfd_create
+#if defined __x86_64__
+#define __NR_memfd_create 319
+#elif defined __i386__
+#define __NR_memfd_create 356
+#elif defined __arm__
+#define __NR_memfd_create 385
+#else
+#warning "__NR_memfd_create unknown for your architecture"
+#endif
+#endif
+
+static inline int missing_memfd_create(const char *name, unsigned int flags)
+{
+#ifdef __NR_memfd_create
+	return syscall(__NR_memfd_create, name, flags);
+#else
+	errno = ENOSYS;
+	return -1;
+#endif
+}
+
+#define memfd_create missing_memfd_create
+
+#endif
meson.build +0 -0
index c24a3cf4..188301ca 100644

meson.build if cc.has_member('struct sysinfo', 'totalram', · line 204

Quoted 9 lines
meson.build +3 -0
@@ -196,6 +196,9 @@ if cc.has_member('struct sysinfo', 'totalram',
  	config.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
  endif
 
+have = cc.has_function('memfd_create', prefix : '''#include <sys/mman.h>''', args : '-D_GNU_SOURCE')
+config.set10('HAVE_MEMFD_CREATE', have)
+
  add_project_arguments('-D_GNU_SOURCE', language : 'c')
  add_project_arguments('-include', 'config.h', language : 'c')
 

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

#10 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create

Quoted 15 lines · Antonio Argenziano
Quoted 11 lines · Lucas De Marchi

When libc misses memfd_create(), provide a stub implementation to go through the syscall() route. Syscall numbers are provided for platforms currently supported by i-g-t only.

---
  lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
  meson.build                  |  3 +++
  2 files changed, 40 insertions(+)

create mode 100644 lib/stubs/syscall/sys/mman.h

Quoted 16 lines

lib/stubs/syscall/sys/mman.h line 7

Quoted 13 lines
lib/stubs/syscall/sys/mman.h new file +7 -0
new file mode 100644
index 00000000..36060bda
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: MIT */
+
+#pragma once
+
+#include_next <sys/mman.h>
+
+#if !HAVE_MEMFD_CREATE

Maybe include <linux/memfd.h> conditionally. I don't think we need it for anything else.

oh... I added it to sys/mman.h when in reality should have added to sys/memfd.h it seems?

and the man page is wrong?

NAME
memfd_create - create an anonymous file

SYNOPSIS

       #include <sys/memfd.h>

       int memfd_create(const char *name, unsigned int flags);

Interesting that it worked as is. Where's my coffee?

Lucas De Marchi

Quoted 53 lines

Thanks,
Antonio

Quoted 36 lines
lib/stubs/syscall/sys/mman.h new file +30 -0
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef __NR_memfd_create
+#if defined __x86_64__
+#define __NR_memfd_create 319
+#elif defined __i386__
+#define __NR_memfd_create 356
+#elif defined __arm__
+#define __NR_memfd_create 385
+#else
+#warning "__NR_memfd_create unknown for your architecture"
+#endif
+#endif
+
+static inline int missing_memfd_create(const char *name, unsigned int flags)
+{
+#ifdef __NR_memfd_create
+     return syscall(__NR_memfd_create, name, flags);
+#else
+     errno = ENOSYS;
+     return -1;
+#endif
+}
+
+#define memfd_create missing_memfd_create
+
+#endif
meson.build +0 -0
index c24a3cf4..188301ca 100644

meson.build if cc.has_member('struct sysinfo', 'totalram', · line 204

Quoted 9 lines
meson.build +3 -0
@@ -196,6 +196,9 @@ if cc.has_member('struct sysinfo', 'totalram',
      config.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
  endif
 
+have = cc.has_function('memfd_create', prefix : '''#include <sys/mman.h>''', args : '-D_GNU_SOURCE')
+config.set10('HAVE_MEMFD_CREATE', have)
+
  add_project_arguments('-D_GNU_SOURCE', language : 'c')
  add_project_arguments('-include', 'config.h', language : 'c')
 

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

Signature · 5 lines
Lucas De Marchi
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#11 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create

Quoted 43 lines · Lucas De Marchi
Quoted 15 lines · Antonio Argenziano
Quoted 11 lines · Lucas De Marchi

When libc misses memfd_create(), provide a stub implementation to go through the syscall() route. Syscall numbers are provided for platforms currently supported by i-g-t only.

---
  lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
  meson.build                  |  3 +++
  2 files changed, 40 insertions(+)

create mode 100644 lib/stubs/syscall/sys/mman.h

Quoted 16 lines

lib/stubs/syscall/sys/mman.h line 7

Quoted 13 lines
lib/stubs/syscall/sys/mman.h new file +7 -0
new file mode 100644
index 00000000..36060bda
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: MIT */
+
+#pragma once
+
+#include_next <sys/mman.h>
+
+#if !HAVE_MEMFD_CREATE

Maybe include <linux/memfd.h> conditionally. I don't think we need it for anything else.

oh... I added it to sys/mman.h when in reality should have added to sys/memfd.h it seems?

and the man page is wrong?

NAME
memfd_create - create an anonymous file

Quoted 6 lines

SYNOPSIS

       #include <sys/memfd.h>

       int memfd_create(const char *name, unsigned int flags);

Interesting that it worked as is. Where's my coffee?

humn... it works because it's the right header to use. sys/mman.h -> bits/mman.h -> bits/mman-linux.h -> bits/mman-shared.h, where memfd_create() is declared.
here the workaround is for the libc header, not linux kernel headers. I'm not sure if we should workaround not having linux/memfd.h if we don't need it.

Thanks
Lucas De Marchi

Quoted 61 lines

Lucas De Marchi

Quoted 42 lines

Thanks,
Antonio

Quoted 38 lines
lib/stubs/syscall/sys/mman.h new file +30 -0
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef __NR_memfd_create
+#if defined __x86_64__
+#define __NR_memfd_create 319
+#elif defined __i386__
+#define __NR_memfd_create 356
+#elif defined __arm__
+#define __NR_memfd_create 385
+#else
+#warning "__NR_memfd_create unknown for your architecture"
+#endif
+#endif
+
+static inline int missing_memfd_create(const char *name, unsigned int flags)
+{
+#ifdef __NR_memfd_create
+     return syscall(__NR_memfd_create, name, flags);
+#else
+     errno = ENOSYS;
+     return -1;
+#endif
+}
+
+#define memfd_create missing_memfd_create
+
+#endif
meson.build +0 -0
index c24a3cf4..188301ca 100644
@@ -196,6 +196,9 @@ if cc.has_member('struct sysinfo', 'totalram',
      config.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
  endif
 
Quoted 11 lines

meson.build if cc.has_member('struct sysinfo', 'totalram', · line 204

Quoted 7 lines
meson.build +3 -0
+have = cc.has_function('memfd_create', prefix : '''#include <sys/mman.h>''', args : '-D_GNU_SOURCE')
+config.set10('HAVE_MEMFD_CREATE', have)
+
  add_project_arguments('-D_GNU_SOURCE', language : 'c')
  add_project_arguments('-include', 'config.h', language : 'c')
 

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

--
Lucas De Marchi

Signature · 5 lines
Lucas De Marchi
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev
#14 lore raw

[igt-dev] ✓ Fi.CI.IGT: success for Fix i-g-t on old systems

In reply to Lucas De Marchi
== Series Details ==

== Series Details ==

Series: Fix i-g-t on old systems
URL : https://patchwork.freedesktop.org/series/46892/
State : success

== Summary ==

= CI Bug Log - changes from IGT_4567_full -> IGTPW_1610_full =

== Summary - WARNING ==

Minor unknown changes coming with IGTPW_1610_full need to be verified manually.

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

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

== Possible new issues ==

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

=== IGT changes ===

    ==== Warnings ====

    igt@gem_mocs_settings@mocs-rc6-bsd1:
      shard-kbl:          PASS -> SKIP

    igt@perf_pmu@rc6:
      shard-kbl:          SKIP -> PASS

== Known issues ==

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

=== IGT changes ===

    ==== Issues hit ====

    igt@gem_partial_pwrite_pread@write-display:
      shard-snb:          PASS -> INCOMPLETE (fdo#105411)

    igt@gem_ppgtt@blt-vs-render-ctx0:
      shard-kbl:          PASS -> INCOMPLETE (fdo#106023, fdo#103665)

    igt@gem_workarounds@suspend-resume-fd:
      shard-kbl:          PASS -> INCOMPLETE (fdo#103665)

    igt@kms_available_modes_crc@available_mode_test_crc:
      shard-glk:          NOTRUN -> FAIL (fdo#106641)

    igt@kms_flip@plain-flip-fb-recreate-interruptible:
      shard-glk:          PASS -> FAIL (fdo#100368) +1

    igt@kms_plane_multiple@atomic-pipe-a-tiling-x:
      shard-snb:          PASS -> FAIL (fdo#103166)

    igt@kms_vblank@pipe-c-accuracy-idle:
      shard-glk:          PASS -> FAIL (fdo#102583)

    
    ==== Possible fixes ====

    igt@kms_flip@2x-flip-vs-expired-vblank:
      shard-glk:          FAIL (fdo#105189) -> PASS

    igt@kms_rotation_crc@primary-rotation-180:
      shard-snb:          FAIL (fdo#103925) -> PASS

    igt@kms_setmode@basic:
      shard-apl:          FAIL (fdo#99912) -> PASS
      shard-kbl:          FAIL (fdo#99912) -> PASS

    igt@kms_vblank@pipe-a-ts-continuation-suspend:
      shard-hsw:          FAIL (fdo#104894) -> PASS

    igt@perf@polling:
      shard-hsw:          FAIL (fdo#102252) -> PASS

fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#102583 https://bugs.freedesktop.org/show_bug.cgi?id=102583
fdo#103166 https://bugs.freedesktop.org/show_bug.cgi?id=103166
fdo#103665 https://bugs.freedesktop.org/show_bug.cgi?id=103665
fdo#103925 https://bugs.freedesktop.org/show_bug.cgi?id=103925
fdo#104894 https://bugs.freedesktop.org/show_bug.cgi?id=104894
fdo#105189 https://bugs.freedesktop.org/show_bug.cgi?id=105189
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
fdo#106023 https://bugs.freedesktop.org/show_bug.cgi?id=106023
fdo#106641 https://bugs.freedesktop.org/show_bug.cgi?id=106641
fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912

== Participating hosts (5 -> 5) ==

No changes in participating hosts

== Build changes ==

* IGT: IGT_4567 -> IGTPW_1610
* Linux: CI_DRM_4507 -> CI_DRM_4509

CI_DRM_4507: 3bbfaebaf3ba21d866c7823d9e4febf47b4b7b39 @ git://anongit.freedesktop.org/gfx-ci/linux
CI_DRM_4509: e84aa0b47beed78a5a12db93e76fb00eab5db160 @ git://anongit.freedesktop.org/gfx-ci/linux
IGTPW_1610: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_1610/
IGT_4567: 7f85adc4050182f490c7a5c48db3d57cdb00af4e @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

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

#6 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create

In reply to Antonio Argenziano

Quoting Antonio Argenziano (2018-07-19 23:17:19)

Quoted 68 lines · Lucas
Quoted 65 lines · Antonio Argenziano
Quoted 63 lines · Lucas De Marchi

meson.build

Quoted 59 lines

When libc misses memfd_create(), provide a stub implementation to go through the syscall() route. Syscall numbers are provided for platforms currently supported by i-g-t only.

---
   lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
   meson.build                  |  3 +++
   2 files changed, 40 insertions(+)

create mode 100644 lib/stubs/syscall/sys/mman.h

lib/stubs/syscall/sys/mman.h new file +25 -0
new file mode 100644
index 00000000..36060bda
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: MIT */
+
+#pragma once
+
+#include_next <sys/mman.h>
+
+#if !HAVE_MEMFD_CREATE
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef __NR_memfd_create
+#if defined __x86_64__
+#define __NR_memfd_create 319
+#elif defined __i386__
+#define __NR_memfd_create 356
+#elif defined __arm__
+#define __NR_memfd_create 385
+#else
+#warning "__NR_memfd_create unknown for your architecture"
+#endif
+#endif
+
+static inline int missing_memfd_create(const char *name, unsigned int

flags)

lib/stubs/syscall/sys/mman.h new file +12 -0
+{
+#ifdef __NR_memfd_create
+   return syscall(__NR_memfd_create, name, flags);
+#else
+   errno = ENOSYS;
+   return -1;
+#endif
+}
+
+#define memfd_create missing_memfd_create
+
+#endif
meson.build +0 -0
index c24a3cf4..188301ca 100644

No love for make?

Quoted 2 lines
Quoted 2 lines

no, afaik it's dead, isn't it? Worse than supporting an old build system is having to support it in addition to the new one.

Ffs, I have platforms where meson is no go. meson itself is not yet stable, why force a broken build system on us until it has at least had the decency to declare itself stable and not require trashing its build directory every other week.
-Chris
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#8 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create

In reply to De Marchi, Lucas
Quoted 65 lines · Lucas
Quoted 55 lines · Antonio Argenziano
Quoted 53 lines · Lucas De Marchi

When libc misses memfd_create(), provide a stub implementation to go through the syscall() route. Syscall numbers are provided for platforms currently supported by i-g-t only.

---
   lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
   meson.build                  |  3 +++
   2 files changed, 40 insertions(+)

create mode 100644 lib/stubs/syscall/sys/mman.h

lib/stubs/syscall/sys/mman.h new file +25 -0
new file mode 100644
index 00000000..36060bda
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: MIT */
+
+#pragma once
+
+#include_next <sys/mman.h>
+
+#if !HAVE_MEMFD_CREATE
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef __NR_memfd_create
+#if defined __x86_64__
+#define __NR_memfd_create 319
+#elif defined __i386__
+#define __NR_memfd_create 356
+#elif defined __arm__
+#define __NR_memfd_create 385
+#else
+#warning "__NR_memfd_create unknown for your architecture"
+#endif
+#endif
+
+static inline int missing_memfd_create(const char *name, unsigned int

flags)

lib/stubs/syscall/sys/mman.h new file +10 -0
+{
+#ifdef __NR_memfd_create
+	return syscall(__NR_memfd_create, name, flags);
+#else
+	errno = ENOSYS;
+	return -1;
+#endif
+}
+
+#define memfd_create missing_memfd_create
Quoted 8 lines

meson.build

Quoted 6 lines
lib/stubs/syscall/sys/mman.h new file +2 -0
+
+#endif
meson.build +0 -0
index c24a3cf4..188301ca 100644

No love for make?

Quoted 2 lines

no, afaik it's dead, isn't it? Worse than supporting an old build system is having to support it in addition to the new one.

It's definitely bad having to support two, but until someone gets brave enough to do a git rm on the old one I think we need to keep it functional.

Regards,

Tvrtko
_______________________________________________
igt-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/igt-dev

#7 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create

In reply to Chris Wilson
Quoted 69 lines · Chris Wilson

Quoting Antonio Argenziano (2018-07-19 23:17:19)

Quoted 68 lines · Lucas
Quoted 65 lines · Antonio Argenziano
Quoted 63 lines · Lucas De Marchi

meson.build

Quoted 59 lines

When libc misses memfd_create(), provide a stub implementation to go through the syscall() route. Syscall numbers are provided for platforms currently supported by i-g-t only.

---
   lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
   meson.build                  |  3 +++
   2 files changed, 40 insertions(+)

create mode 100644 lib/stubs/syscall/sys/mman.h

lib/stubs/syscall/sys/mman.h new file +25 -0
new file mode 100644
index 00000000..36060bda
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: MIT */
+
+#pragma once
+
+#include_next <sys/mman.h>
+
+#if !HAVE_MEMFD_CREATE
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef __NR_memfd_create
+#if defined __x86_64__
+#define __NR_memfd_create 319
+#elif defined __i386__
+#define __NR_memfd_create 356
+#elif defined __arm__
+#define __NR_memfd_create 385
+#else
+#warning "__NR_memfd_create unknown for your architecture"
+#endif
+#endif
+
+static inline int missing_memfd_create(const char *name, unsigned int

flags)

lib/stubs/syscall/sys/mman.h new file +12 -0
+{
+#ifdef __NR_memfd_create
+   return syscall(__NR_memfd_create, name, flags);
+#else
+   errno = ENOSYS;
+   return -1;
+#endif
+}
+
+#define memfd_create missing_memfd_create
+
+#endif
meson.build +0 -0
index c24a3cf4..188301ca 100644

No love for make?

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

no, afaik it's dead, isn't it? Worse than supporting an old build system is having to support it in addition to the new one.

Ffs, I have platforms where meson is no go. meson itself is not yet stable, why force a broken build system on us until it has at least had the decency to declare itself stable and not require trashing its build directory every other week.

I come from projects that tried to support 2 (one of them) and 7 (the other) build systems at the same time. It's a pain and so much a waste of time IMO. I think there must be a period of transition and then move on or move back.

The discussion about "forcing" IMO should happen or when a) the new one enters the tree or b) it becomes the default. Here I'm not forcing anything, I'm just following what was established in the project.

I can tweak your words to be "I have platforms where meson is not working and these patches fix them". Sounds better than your "force a broken build system" rant ;)

Lucas De Marchi

Quoted 1 line

-Chris

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

#12 lore raw

Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create

In reply to Lucas De Marchi
Quoted 42 lines · Lucas De Marchi
Quoted 15 lines · Antonio Argenziano
Quoted 11 lines · Lucas De Marchi

When libc misses memfd_create(), provide a stub implementation to go through the syscall() route. Syscall numbers are provided for platforms currently supported by i-g-t only.

---
  lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
  meson.build                  |  3 +++
  2 files changed, 40 insertions(+)

create mode 100644 lib/stubs/syscall/sys/mman.h

Quoted 16 lines

lib/stubs/syscall/sys/mman.h line 7

Quoted 13 lines
lib/stubs/syscall/sys/mman.h new file +7 -0
new file mode 100644
index 00000000..36060bda
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: MIT */
+
+#pragma once
+
+#include_next <sys/mman.h>
+
+#if !HAVE_MEMFD_CREATE

Maybe include <linux/memfd.h> conditionally. I don't think we need it for anything else.

oh... I added it to sys/mman.h when in reality should have added to sys/memfd.h it seems?

and the man page is wrong?

NAME
memfd_create - create an anonymous file

Quoted 6 lines

SYNOPSIS

       #include <sys/memfd.h>

       int memfd_create(const char *name, unsigned int flags);

Interesting that it worked as is. Where's my coffee?

patch to fix the man page was sent. I will spin a new version of this patch to deal with the memfd.h header.

Lucas De Marchi

Quoted 45 lines

Lucas De Marchi

Quoted 42 lines

Thanks,
Antonio

Quoted 38 lines
lib/stubs/syscall/sys/mman.h new file +30 -0
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#ifndef __NR_memfd_create
+#if defined __x86_64__
+#define __NR_memfd_create 319
+#elif defined __i386__
+#define __NR_memfd_create 356
+#elif defined __arm__
+#define __NR_memfd_create 385
+#else
+#warning "__NR_memfd_create unknown for your architecture"
+#endif
+#endif
+
+static inline int missing_memfd_create(const char *name, unsigned int flags)
+{
+#ifdef __NR_memfd_create
+     return syscall(__NR_memfd_create, name, flags);
+#else
+     errno = ENOSYS;
+     return -1;
+#endif
+}
+
+#define memfd_create missing_memfd_create
+
+#endif
meson.build +0 -0
index c24a3cf4..188301ca 100644
@@ -196,6 +196,9 @@ if cc.has_member('struct sysinfo', 'totalram',
      config.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
  endif
 
Quoted 16 lines
Quoted 11 lines

meson.build if cc.has_member('struct sysinfo', 'totalram', · line 204

Quoted 7 lines
meson.build +3 -0
+have = cc.has_function('memfd_create', prefix : '''#include <sys/mman.h>''', args : '-D_GNU_SOURCE')
+config.set10('HAVE_MEMFD_CREATE', have)
+
  add_project_arguments('-D_GNU_SOURCE', language : 'c')
  add_project_arguments('-include', 'config.h', language : 'c')
 

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

Signature · 1 line
Lucas De Marchi

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