igt-dev.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 0/2] Fix i-g-t on old systems
@ 2018-07-19 20:54 Lucas De Marchi
  2018-07-19 20:54 ` [igt-dev] [PATCH i-g-t 1/2] build: provide include for missing syscalls Lucas De Marchi
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Lucas De Marchi @ 2018-07-19 20:54 UTC (permalink / raw)
  To: igt-dev

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

-- 
2.17.1

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

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

* [igt-dev] [PATCH i-g-t 1/2] build: provide include for missing syscalls
  2018-07-19 20:54 [igt-dev] [PATCH i-g-t 0/2] Fix i-g-t on old systems Lucas De Marchi
@ 2018-07-19 20:54 ` Lucas De Marchi
  2018-07-19 20:54 ` [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create Lucas De Marchi
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 15+ messages in thread
From: Lucas De Marchi @ 2018-07-19 20:54 UTC (permalink / raw)
  To: igt-dev

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

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 lib/stubs/syscall/README | 6 ++++++
 meson.build              | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 lib/stubs/syscall/README

diff --git a/lib/stubs/syscall/README b/lib/stubs/syscall/README
new file mode 100644
index 00000000..f05b9a6f
--- /dev/null
+++ b/lib/stubs/syscall/README
@@ -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.
diff --git a/meson.build b/meson.build
index 5a931565..c24a3cf4 100644
--- a/meson.build
+++ b/meson.build
@@ -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')
 
-- 
2.17.1

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

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

* [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create
  2018-07-19 20:54 [igt-dev] [PATCH i-g-t 0/2] Fix i-g-t on old systems Lucas De Marchi
  2018-07-19 20:54 ` [igt-dev] [PATCH i-g-t 1/2] build: provide include for missing syscalls Lucas De Marchi
@ 2018-07-19 20:54 ` Lucas De Marchi
  2018-07-19 21:14   ` Antonio Argenziano
  2018-07-19 23:20   ` Antonio Argenziano
  2018-07-19 21:48 ` [igt-dev] ✓ Fi.CI.BAT: success for Fix i-g-t on old systems Patchwork
  2018-07-20  4:15 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  3 siblings, 2 replies; 15+ messages in thread
From: Lucas De Marchi @ 2018-07-19 20:54 UTC (permalink / raw)
  To: igt-dev

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.

Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
 lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
 meson.build                  |  3 +++
 2 files changed, 40 insertions(+)
 create mode 100644 lib/stubs/syscall/sys/mman.h

diff --git a/lib/stubs/syscall/sys/mman.h b/lib/stubs/syscall/sys/mman.h
new file mode 100644
index 00000000..36060bda
--- /dev/null
+++ b/lib/stubs/syscall/sys/mman.h
@@ -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
diff --git a/meson.build b/meson.build
index c24a3cf4..188301ca 100644
--- a/meson.build
+++ b/meson.build
@@ -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')
 
-- 
2.17.1

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

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

* Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create
  2018-07-19 20:54 ` [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create Lucas De Marchi
@ 2018-07-19 21:14   ` Antonio Argenziano
  2018-07-19 21:43     ` De Marchi, Lucas
  2018-07-19 23:20   ` Antonio Argenziano
  1 sibling, 1 reply; 15+ messages in thread
From: Antonio Argenziano @ 2018-07-19 21:14 UTC (permalink / raw)
  To: Lucas De Marchi, igt-dev



On 19/07/18 13:54, Lucas De Marchi wrote:
> 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.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>   lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
>   meson.build                  |  3 +++
>   2 files changed, 40 insertions(+)
>   create mode 100644 lib/stubs/syscall/sys/mman.h
> 
> diff --git a/lib/stubs/syscall/sys/mman.h b/lib/stubs/syscall/sys/mman.h
> new file mode 100644
> index 00000000..36060bda
> --- /dev/null
> +++ b/lib/stubs/syscall/sys/mman.h
> @@ -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
> diff --git a/meson.build b/meson.build
> index c24a3cf4..188301ca 100644
> --- a/meson.build
> +++ b/meson.build

No love for make?

Antonio

> @@ -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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create
  2018-07-19 21:14   ` Antonio Argenziano
@ 2018-07-19 21:43     ` De Marchi, Lucas
  2018-07-19 22:17       ` Antonio Argenziano
  2018-07-20  9:48       ` Tvrtko Ursulin
  0 siblings, 2 replies; 15+ messages in thread
From: De Marchi, Lucas @ 2018-07-19 21:43 UTC (permalink / raw)
  To: igt-dev@lists.freedesktop.org, Argenziano, Antonio

On Thu, 2018-07-19 at 14:14 -0700, Antonio Argenziano wrote:
> 
> On 19/07/18 13:54, Lucas De Marchi wrote:
> > 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.
> > 
> > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > ---
> >   lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
> >   meson.build                  |  3 +++
> >   2 files changed, 40 insertions(+)
> >   create mode 100644 lib/stubs/syscall/sys/mman.h
> > 
> > diff --git a/lib/stubs/syscall/sys/mman.h b/lib/stubs/syscall/sys/mman.h
> > new file mode 100644
> > index 00000000..36060bda
> > --- /dev/null
> > +++ b/lib/stubs/syscall/sys/mman.h
> > @@ -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
> > diff --git a/meson.build b/meson.build
> > index c24a3cf4..188301ca 100644
> > --- a/meson.build
> > +++ b/meson.build
> 
> 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

> 
> Antonio
> 
> > @@ -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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* [igt-dev] ✓ Fi.CI.BAT: success for Fix i-g-t on old systems
  2018-07-19 20:54 [igt-dev] [PATCH i-g-t 0/2] Fix i-g-t on old systems Lucas De Marchi
  2018-07-19 20:54 ` [igt-dev] [PATCH i-g-t 1/2] build: provide include for missing syscalls Lucas De Marchi
  2018-07-19 20:54 ` [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create Lucas De Marchi
@ 2018-07-19 21:48 ` Patchwork
  2018-07-20  4:15 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  3 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2018-07-19 21:48 UTC (permalink / raw)
  To: De Marchi, Lucas; +Cc: igt-dev

== 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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create
  2018-07-19 21:43     ` De Marchi, Lucas
@ 2018-07-19 22:17       ` Antonio Argenziano
  2018-07-20  7:05         ` Chris Wilson
  2018-07-20  9:48       ` Tvrtko Ursulin
  1 sibling, 1 reply; 15+ messages in thread
From: Antonio Argenziano @ 2018-07-19 22:17 UTC (permalink / raw)
  To: De Marchi, Lucas, igt-dev@lists.freedesktop.org



On 19/07/18 14:43, De Marchi, Lucas wrote:
> On Thu, 2018-07-19 at 14:14 -0700, Antonio Argenziano wrote:
>>
>> On 19/07/18 13:54, Lucas De Marchi wrote:
>>> 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.
>>>
>>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>>> ---
>>>    lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
>>>    meson.build                  |  3 +++
>>>    2 files changed, 40 insertions(+)
>>>    create mode 100644 lib/stubs/syscall/sys/mman.h
>>>
>>> diff --git a/lib/stubs/syscall/sys/mman.h b/lib/stubs/syscall/sys/mman.h
>>> new file mode 100644
>>> index 00000000..36060bda
>>> --- /dev/null
>>> +++ b/lib/stubs/syscall/sys/mman.h
>>> @@ -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
>>> diff --git a/meson.build b/meson.build
>>> index c24a3cf4..188301ca 100644
>>> --- a/meson.build
>>> +++ b/meson.build
>>
>> 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.

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 <antonio.argenziano@intel.com>

> 
> 
> Lucas De Marchi
> 
>>
>> Antonio
>>
>>> @@ -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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create
  2018-07-19 20:54 ` [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create Lucas De Marchi
  2018-07-19 21:14   ` Antonio Argenziano
@ 2018-07-19 23:20   ` Antonio Argenziano
  2018-07-20  0:41     ` Lucas De Marchi
  1 sibling, 1 reply; 15+ messages in thread
From: Antonio Argenziano @ 2018-07-19 23:20 UTC (permalink / raw)
  To: Lucas De Marchi, igt-dev



On 19/07/18 13:54, Lucas De Marchi wrote:
> 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.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>   lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
>   meson.build                  |  3 +++
>   2 files changed, 40 insertions(+)
>   create mode 100644 lib/stubs/syscall/sys/mman.h
> 
> diff --git a/lib/stubs/syscall/sys/mman.h b/lib/stubs/syscall/sys/mman.h
> new file mode 100644
> index 00000000..36060bda
> --- /dev/null
> +++ b/lib/stubs/syscall/sys/mman.h
> @@ -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

> +#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
> diff --git a/meson.build b/meson.build
> index c24a3cf4..188301ca 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create
  2018-07-19 23:20   ` Antonio Argenziano
@ 2018-07-20  0:41     ` Lucas De Marchi
  2018-07-20  0:56       ` Lucas De Marchi
  2018-07-20 19:06       ` Lucas De Marchi
  0 siblings, 2 replies; 15+ messages in thread
From: Lucas De Marchi @ 2018-07-20  0:41 UTC (permalink / raw)
  To: antonio.argenziano; +Cc: igt-dev, Lucas De Marchi

On Thu, Jul 19, 2018 at 4:20 PM Antonio Argenziano
<antonio.argenziano@intel.com> wrote:
>
>
>
> On 19/07/18 13:54, Lucas De Marchi wrote:
> > 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.
> >
> > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > ---
> >   lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
> >   meson.build                  |  3 +++
> >   2 files changed, 40 insertions(+)
> >   create mode 100644 lib/stubs/syscall/sys/mman.h
> >
> > diff --git a/lib/stubs/syscall/sys/mman.h b/lib/stubs/syscall/sys/mman.h
> > new file mode 100644
> > index 00000000..36060bda
> > --- /dev/null
> > +++ b/lib/stubs/syscall/sys/mman.h
> > @@ -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

>
> Thanks,
> Antonio
>
> > +#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
> > diff --git a/meson.build b/meson.build
> > index c24a3cf4..188301ca 100644
> > --- a/meson.build
> > +++ b/meson.build
> > @@ -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
> igt-dev@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/igt-dev



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

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

* Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create
  2018-07-20  0:41     ` Lucas De Marchi
@ 2018-07-20  0:56       ` Lucas De Marchi
  2018-07-20 19:06       ` Lucas De Marchi
  1 sibling, 0 replies; 15+ messages in thread
From: Lucas De Marchi @ 2018-07-20  0:56 UTC (permalink / raw)
  To: antonio.argenziano; +Cc: igt-dev, Lucas De Marchi

On Thu, Jul 19, 2018 at 5:41 PM Lucas De Marchi
<lucas.de.marchi@gmail.com> wrote:
>
> On Thu, Jul 19, 2018 at 4:20 PM Antonio Argenziano
> <antonio.argenziano@intel.com> wrote:
> >
> >
> >
> > On 19/07/18 13:54, Lucas De Marchi wrote:
> > > 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.
> > >
> > > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > > ---
> > >   lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
> > >   meson.build                  |  3 +++
> > >   2 files changed, 40 insertions(+)
> > >   create mode 100644 lib/stubs/syscall/sys/mman.h
> > >
> > > diff --git a/lib/stubs/syscall/sys/mman.h b/lib/stubs/syscall/sys/mman.h
> > > new file mode 100644
> > > index 00000000..36060bda
> > > --- /dev/null
> > > +++ b/lib/stubs/syscall/sys/mman.h
> > > @@ -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?

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

>
> Lucas De Marchi
>
> >
> > Thanks,
> > Antonio
> >
> > > +#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
> > > diff --git a/meson.build b/meson.build
> > > index c24a3cf4..188301ca 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -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
> > igt-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/igt-dev
>
>
>
> --
> Lucas De Marchi



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

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

* [igt-dev] ✓ Fi.CI.IGT: success for Fix i-g-t on old systems
  2018-07-19 20:54 [igt-dev] [PATCH i-g-t 0/2] Fix i-g-t on old systems Lucas De Marchi
                   ` (2 preceding siblings ...)
  2018-07-19 21:48 ` [igt-dev] ✓ Fi.CI.BAT: success for Fix i-g-t on old systems Patchwork
@ 2018-07-20  4:15 ` Patchwork
  3 siblings, 0 replies; 15+ messages in thread
From: Patchwork @ 2018-07-20  4:15 UTC (permalink / raw)
  To: De Marchi, Lucas; +Cc: igt-dev

== 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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create
  2018-07-19 22:17       ` Antonio Argenziano
@ 2018-07-20  7:05         ` Chris Wilson
  2018-07-20 19:05           ` Lucas De Marchi
  0 siblings, 1 reply; 15+ messages in thread
From: Chris Wilson @ 2018-07-20  7:05 UTC (permalink / raw)
  To: De Marchi, Lucas, igt-dev@lists.freedesktop.org,
	Antonio Argenziano

Quoting Antonio Argenziano (2018-07-19 23:17:19)
> 
> 
> On 19/07/18 14:43, De Marchi, Lucas wrote:
> > On Thu, 2018-07-19 at 14:14 -0700, Antonio Argenziano wrote:
> >>
> >> On 19/07/18 13:54, Lucas De Marchi wrote:
> >>> 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.
> >>>
> >>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> >>> ---
> >>>    lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
> >>>    meson.build                  |  3 +++
> >>>    2 files changed, 40 insertions(+)
> >>>    create mode 100644 lib/stubs/syscall/sys/mman.h
> >>>
> >>> diff --git a/lib/stubs/syscall/sys/mman.h b/lib/stubs/syscall/sys/mman.h
> >>> new file mode 100644
> >>> index 00000000..36060bda
> >>> --- /dev/null
> >>> +++ b/lib/stubs/syscall/sys/mman.h
> >>> @@ -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
> >>> diff --git a/meson.build b/meson.build
> >>> index c24a3cf4..188301ca 100644
> >>> --- a/meson.build
> >>> +++ b/meson.build
> >>
> >> 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.

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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create
  2018-07-19 21:43     ` De Marchi, Lucas
  2018-07-19 22:17       ` Antonio Argenziano
@ 2018-07-20  9:48       ` Tvrtko Ursulin
  1 sibling, 0 replies; 15+ messages in thread
From: Tvrtko Ursulin @ 2018-07-20  9:48 UTC (permalink / raw)
  To: De Marchi, Lucas, igt-dev@lists.freedesktop.org,
	Argenziano, Antonio


On 19/07/2018 22:43, De Marchi, Lucas wrote:
> On Thu, 2018-07-19 at 14:14 -0700, Antonio Argenziano wrote:
>>
>> On 19/07/18 13:54, Lucas De Marchi wrote:
>>> 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.
>>>
>>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>>> ---
>>>    lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
>>>    meson.build                  |  3 +++
>>>    2 files changed, 40 insertions(+)
>>>    create mode 100644 lib/stubs/syscall/sys/mman.h
>>>
>>> diff --git a/lib/stubs/syscall/sys/mman.h b/lib/stubs/syscall/sys/mman.h
>>> new file mode 100644
>>> index 00000000..36060bda
>>> --- /dev/null
>>> +++ b/lib/stubs/syscall/sys/mman.h
>>> @@ -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
>>> diff --git a/meson.build b/meson.build
>>> index c24a3cf4..188301ca 100644
>>> --- a/meson.build
>>> +++ b/meson.build
>>
>> 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.

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
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

* Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create
  2018-07-20  7:05         ` Chris Wilson
@ 2018-07-20 19:05           ` Lucas De Marchi
  0 siblings, 0 replies; 15+ messages in thread
From: Lucas De Marchi @ 2018-07-20 19:05 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev@lists.freedesktop.org

On Fri, Jul 20, 2018 at 08:05:46AM +0100, Chris Wilson wrote:
> Quoting Antonio Argenziano (2018-07-19 23:17:19)
> > 
> > 
> > On 19/07/18 14:43, De Marchi, Lucas wrote:
> > > On Thu, 2018-07-19 at 14:14 -0700, Antonio Argenziano wrote:
> > >>
> > >> On 19/07/18 13:54, Lucas De Marchi wrote:
> > >>> 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.
> > >>>
> > >>> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > >>> ---
> > >>>    lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
> > >>>    meson.build                  |  3 +++
> > >>>    2 files changed, 40 insertions(+)
> > >>>    create mode 100644 lib/stubs/syscall/sys/mman.h
> > >>>
> > >>> diff --git a/lib/stubs/syscall/sys/mman.h b/lib/stubs/syscall/sys/mman.h
> > >>> new file mode 100644
> > >>> index 00000000..36060bda
> > >>> --- /dev/null
> > >>> +++ b/lib/stubs/syscall/sys/mman.h
> > >>> @@ -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
> > >>> diff --git a/meson.build b/meson.build
> > >>> index c24a3cf4..188301ca 100644
> > >>> --- a/meson.build
> > >>> +++ b/meson.build
> > >>
> > >> 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.
> 
> 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

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

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

* Re: [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create
  2018-07-20  0:41     ` Lucas De Marchi
  2018-07-20  0:56       ` Lucas De Marchi
@ 2018-07-20 19:06       ` Lucas De Marchi
  1 sibling, 0 replies; 15+ messages in thread
From: Lucas De Marchi @ 2018-07-20 19:06 UTC (permalink / raw)
  To: Lucas De Marchi; +Cc: igt-dev

On Thu, Jul 19, 2018 at 05:41:55PM -0700, Lucas De Marchi wrote:
> On Thu, Jul 19, 2018 at 4:20 PM Antonio Argenziano
> <antonio.argenziano@intel.com> wrote:
> >
> >
> >
> > On 19/07/18 13:54, Lucas De Marchi wrote:
> > > 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.
> > >
> > > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > > ---
> > >   lib/stubs/syscall/sys/mman.h | 37 ++++++++++++++++++++++++++++++++++++
> > >   meson.build                  |  3 +++
> > >   2 files changed, 40 insertions(+)
> > >   create mode 100644 lib/stubs/syscall/sys/mman.h
> > >
> > > diff --git a/lib/stubs/syscall/sys/mman.h b/lib/stubs/syscall/sys/mman.h
> > > new file mode 100644
> > > index 00000000..36060bda
> > > --- /dev/null
> > > +++ b/lib/stubs/syscall/sys/mman.h
> > > @@ -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?

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

> 
> Lucas De Marchi
> 
> >
> > Thanks,
> > Antonio
> >
> > > +#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
> > > diff --git a/meson.build b/meson.build
> > > index c24a3cf4..188301ca 100644
> > > --- a/meson.build
> > > +++ b/meson.build
> > > @@ -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
> > igt-dev@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/igt-dev
> 
> 
> 
> -- 
> Lucas De Marchi
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

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

end of thread, other threads:[~2018-07-20 19:06 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-19 20:54 [igt-dev] [PATCH i-g-t 0/2] Fix i-g-t on old systems Lucas De Marchi
2018-07-19 20:54 ` [igt-dev] [PATCH i-g-t 1/2] build: provide include for missing syscalls Lucas De Marchi
2018-07-19 20:54 ` [igt-dev] [PATCH i-g-t 2/2] stubs: provide implementation for memfd_create Lucas De Marchi
2018-07-19 21:14   ` Antonio Argenziano
2018-07-19 21:43     ` De Marchi, Lucas
2018-07-19 22:17       ` Antonio Argenziano
2018-07-20  7:05         ` Chris Wilson
2018-07-20 19:05           ` Lucas De Marchi
2018-07-20  9:48       ` Tvrtko Ursulin
2018-07-19 23:20   ` Antonio Argenziano
2018-07-20  0:41     ` Lucas De Marchi
2018-07-20  0:56       ` Lucas De Marchi
2018-07-20 19:06       ` Lucas De Marchi
2018-07-19 21:48 ` [igt-dev] ✓ Fi.CI.BAT: success for Fix i-g-t on old systems Patchwork
2018-07-20  4:15 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).