All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] ruby: Use arm32 for coroutines on 32bit-arm
@ 2020-03-09 23:44 Khem Raj
  2020-03-09 23:44 ` [PATCH 2/2] valgrind: Fix timerfb syscall test to be 64bit time_t safe Khem Raj
  2020-03-09 23:52 ` [PATCH 1/2] ruby: Use arm32 for coroutines on 32bit-arm Andre McCurdy
  0 siblings, 2 replies; 5+ messages in thread
From: Khem Raj @ 2020-03-09 23:44 UTC (permalink / raw)
  To: openembedded-core

in 2.7 [2] ruby enabled ucontext for coroutines on arm32 but it does not
work for musl since it uses glibc specific functions e.g.
getcontext/swapcontext/swapcontext also see [1]

This patch reverts back to using arm32 implementation for coroutines on
arm

[1] https://bugs.ruby-lang.org/issues/16455#change-83442
[2] https://github.com/ruby/ruby/commit/6c6bf9ffcbfeb8be9d9c342e7604b74ec819e88a#diff-7fccec8474e2184cd2518046bf39d54cL10

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 meta/recipes-devtools/ruby/ruby_2.7.0.bb | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/recipes-devtools/ruby/ruby_2.7.0.bb b/meta/recipes-devtools/ruby/ruby_2.7.0.bb
index 268b4bebd9..884bb0ef44 100644
--- a/meta/recipes-devtools/ruby/ruby_2.7.0.bb
+++ b/meta/recipes-devtools/ruby/ruby_2.7.0.bb
@@ -25,6 +25,8 @@ EXTRA_OECONF = "\
     --with-pkg-config=pkg-config \
 "
 
+EXTRA_OECONF_append_arm_libc-musl = " --with-coroutine=arm32"
+
 do_install() {
     oe_runmake 'DESTDIR=${D}' install
 }
-- 
2.25.1



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

* [PATCH 2/2] valgrind: Fix timerfb syscall test to be 64bit time_t safe
  2020-03-09 23:44 [PATCH 1/2] ruby: Use arm32 for coroutines on 32bit-arm Khem Raj
@ 2020-03-09 23:44 ` Khem Raj
  2020-03-09 23:52 ` [PATCH 1/2] ruby: Use arm32 for coroutines on 32bit-arm Andre McCurdy
  1 sibling, 0 replies; 5+ messages in thread
From: Khem Raj @ 2020-03-09 23:44 UTC (permalink / raw)
  To: openembedded-core

This helps compile the testcase with musl on 32bit arches

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...check-tests-Fix-timerfd-syscall-test.patch | 210 ++++++++++++++++++
 .../valgrind/valgrind_3.15.0.bb               |   1 +
 2 files changed, 211 insertions(+)
 create mode 100644 meta/recipes-devtools/valgrind/valgrind/0001-memcheck-tests-Fix-timerfd-syscall-test.patch

diff --git a/meta/recipes-devtools/valgrind/valgrind/0001-memcheck-tests-Fix-timerfd-syscall-test.patch b/meta/recipes-devtools/valgrind/valgrind/0001-memcheck-tests-Fix-timerfd-syscall-test.patch
new file mode 100644
index 0000000000..d1d96a0eff
--- /dev/null
+++ b/meta/recipes-devtools/valgrind/valgrind/0001-memcheck-tests-Fix-timerfd-syscall-test.patch
@@ -0,0 +1,210 @@
+From 5d411fd147d652e9d7bb259f4048693c6e4742aa Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Mon, 9 Mar 2020 16:30:19 -0700
+Subject: [PATCH] memcheck/tests: Fix timerfd syscall test
+
+modern libc provides these functions, moreover this also ensures that we
+are 64bit time_t safe. Fallback to existing definitions if libc does not
+have the implementation or syscall is not defined
+
+Upstream-Status: Submitted [https://sourceforge.net/p/valgrind/mailman/message/36943866/]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ config.h                               |  9 +++++++++
+ config.h.in                            |  9 +++++++++
+ configure                              |  3 +++
+ configure.ac                           |  3 +++
+ memcheck/tests/linux/timerfd-syscall.c | 10 ++++++++--
+ 5 files changed, 32 insertions(+), 2 deletions(-)
+
+--- a/config.h
++++ b/config.h
+@@ -47,20 +47,20 @@
+ /* #undef ENABLE_LTO */
+ 
+ /* path to GDB */
+-#define GDB_PATH "/usr/bin/gdb"
++#define GDB_PATH "/no/gdb/was/found/at/configure/time"
+ 
+ /* Define to 1 if index() and strlen() have been optimized heavily (x86 glibc
+    >= 2.12) */
+-#define GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT 1
++/* #undef GLIBC_MANDATORY_INDEX_AND_STRLEN_REDIRECT */
+ 
+ /* Define to 1 if strlen() has been optimized heavily (amd64 glibc >= 2.10) */
+-#define GLIBC_MANDATORY_STRLEN_REDIRECT 1
++/* #undef GLIBC_MANDATORY_STRLEN_REDIRECT */
+ 
+ /* Define to 1 if you have the <asm/unistd.h> header file. */
+ #define HAVE_ASM_UNISTD_H 1
+ 
+ /* Define to 1 if as supports fxsave64/fxrstor64. */
+-#define HAVE_AS_AMD64_FXSAVE64 1
++/* #undef HAVE_AS_AMD64_FXSAVE64 */
+ 
+ /* Define to 1 if as supports floating point phased out category. */
+ /* #undef HAVE_AS_PPC_FPPO */
+@@ -92,7 +92,7 @@
+ #define HAVE_CLOCK_MONOTONIC 1
+ 
+ /* Define to 1 if you have a dlinfo that can do RTLD_DI_TLS_MODID. */
+-#define HAVE_DLINFO_RTLD_DI_TLS_MODID 1
++/* #undef HAVE_DLINFO_RTLD_DI_TLS_MODID */
+ 
+ /* Define to 1 if the system has the type `Elf32_Chdr'. */
+ #define HAVE_ELF32_CHDR 1
+@@ -134,7 +134,7 @@
+ /* #undef HAVE_LIBSCF */
+ 
+ /* Define to 1 if you have the `mallinfo' function. */
+-#define HAVE_MALLINFO 1
++/* #undef HAVE_MALLINFO */
+ 
+ /* Define to 1 if you have the `memchr' function. */
+ #define HAVE_MEMCHR 1
+@@ -176,26 +176,26 @@
+ /* #undef HAVE_PTHREAD_CREATE_GLIBC_2_0 */
+ 
+ /* Define to 1 if you have the `PTHREAD_MUTEX_ADAPTIVE_NP' constant. */
+-#define HAVE_PTHREAD_MUTEX_ADAPTIVE_NP 1
++/* #undef HAVE_PTHREAD_MUTEX_ADAPTIVE_NP */
+ 
+ /* Define to 1 if you have the `PTHREAD_MUTEX_ERRORCHECK_NP' constant. */
+-#define HAVE_PTHREAD_MUTEX_ERRORCHECK_NP 1
++/* #undef HAVE_PTHREAD_MUTEX_ERRORCHECK_NP */
+ 
+ /* Define to 1 if you have the `PTHREAD_MUTEX_RECURSIVE_NP' constant. */
+-#define HAVE_PTHREAD_MUTEX_RECURSIVE_NP 1
++/* #undef HAVE_PTHREAD_MUTEX_RECURSIVE_NP */
+ 
+ /* Define to 1 if you have the `pthread_mutex_timedlock' function. */
+ #define HAVE_PTHREAD_MUTEX_TIMEDLOCK 1
+ 
+ /* Define to 1 if pthread_mutex_t has a member __data.__kind. */
+-#define HAVE_PTHREAD_MUTEX_T__DATA__KIND 1
++/* #undef HAVE_PTHREAD_MUTEX_T__DATA__KIND */
+ 
+ /* Define to 1 if pthread_mutex_t has a member called __m_kind. */
+ /* #undef HAVE_PTHREAD_MUTEX_T__M_KIND */
+ 
+ /* Define to 1 if you have the `PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP'
+    constant. */
+-#define HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP 1
++/* #undef HAVE_PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP */
+ 
+ /* Define to 1 if you have the `pthread_rwlock_t' type. */
+ #define HAVE_PTHREAD_RWLOCK_T 1
+@@ -213,7 +213,7 @@
+ #define HAVE_PTHREAD_SPIN_LOCK 1
+ 
+ /* Define to 1 if you have the `pthread_yield' function. */
+-#define HAVE_PTHREAD_YIELD 1
++/* #undef HAVE_PTHREAD_YIELD */
+ 
+ /* Define to 1 if you have the `PTRACE_GETREGS' ptrace request. */
+ #define HAVE_PTRACE_GETREGS 1
+@@ -309,7 +309,16 @@
+ #define HAVE_SYS_TYPES_H 1
+ 
+ /* Define to 1 if <sys/user.h> defines struct user_regs_struct */
+-#define HAVE_SYS_USER_REGS 1
++/* #undef HAVE_SYS_USER_REGS */
++
++/* Define to 1 if you have the `timerfd_create' function. */
++#define HAVE_TIMERFD_CREATE 1
++
++/* Define to 1 if you have the `timerfd_gettime' function. */
++#define HAVE_TIMERFD_GETTIME 1
++
++/* Define to 1 if you have the `timerfd_settime' function. */
++#define HAVE_TIMERFD_SETTIME 1
+ 
+ /* can use __thread to define thread-local variables */
+ #define HAVE_TLS 1
+@@ -324,7 +333,7 @@
+ #define HAVE_UTIMENSAT 1
+ 
+ /* Define to 1 if you're using Musl libc */
+-/* #undef MUSL_LIBC */
++#define MUSL_LIBC 1
+ 
+ /* Name of package */
+ #define PACKAGE "valgrind"
+--- a/config.h.in
++++ b/config.h.in
+@@ -310,6 +310,15 @@
+ /* Define to 1 if <sys/user.h> defines struct user_regs_struct */
+ #undef HAVE_SYS_USER_REGS
+ 
++/* Define to 1 if you have the `timerfd_create' function. */
++#undef HAVE_TIMERFD_CREATE
++
++/* Define to 1 if you have the `timerfd_gettime' function. */
++#undef HAVE_TIMERFD_GETTIME
++
++/* Define to 1 if you have the `timerfd_settime' function. */
++#undef HAVE_TIMERFD_SETTIME
++
+ /* can use __thread to define thread-local variables */
+ #undef HAVE_TLS
+ 
+--- a/configure.ac
++++ b/configure.ac
+@@ -4169,6 +4169,9 @@ AC_CHECK_FUNCS([     \
+         strrchr      \
+         strstr       \
+         syscall      \
++        timerfd_create    \
++        timerfd_gettime   \
++        timerfd_settime   \
+         utimensat    \
+         process_vm_readv  \
+         process_vm_writev \
+--- a/memcheck/tests/linux/timerfd-syscall.c
++++ b/memcheck/tests/linux/timerfd-syscall.c
+@@ -54,7 +54,7 @@
+  * timerfd_* system call numbers introduced in 2.6.23. These constants are
+  * not yet in the glibc 2.7 headers, that is why they are defined here.
+  */
+-#ifndef __NR_timerfd_create
++#if !defined(__NR_timerfd_create) && !defined(HAVE_TIMERFD_CREATE)
+ #if defined(__x86_64__)
+ #define __NR_timerfd_create  283
+ #elif defined(__i386__)
+@@ -68,7 +68,7 @@
+ #endif
+ #endif
+ 
+-#ifndef __NR_timerfd_settime
++#if !defined(__NR_timerfd_settime) && !defined(HAVE_TIMERFD_SETTIME)
+ #if defined(__x86_64__)
+ #define __NR_timerfd_settime 286
+ #define __NR_timerfd_gettime 287
+@@ -127,21 +127,27 @@ void set_timespec(struct timespec *tmr,
+   tmr->tv_nsec = (long) (1000ULL * (ustime % 1000000ULL));
+ }
+ 
++#if !defined(HAVE_TIMERFD_CREATE)
+ int timerfd_create(int clockid, int flags)
+ {
+   return syscall(__NR_timerfd_create, clockid, flags);
+ }
++#endif
+ 
++#if !defined(HAVE_TIMERFD_SETTIME)
+ int timerfd_settime(int ufc, int flags, const struct itimerspec *utmr,
+ 		    struct itimerspec *otmr)
+ {
+   return syscall(__NR_timerfd_settime, ufc, flags, utmr, otmr);
+ }
++#endif
+ 
++#if !defined(HAVE_TIMERFD_GETTIME)
+ int timerfd_gettime(int ufc, struct itimerspec *otmr)
+ {
+   return syscall(__NR_timerfd_gettime, ufc, otmr);
+ }
++#endif
+ 
+ long waittmr(int tfd, int timeo)
+ {
diff --git a/meta/recipes-devtools/valgrind/valgrind_3.15.0.bb b/meta/recipes-devtools/valgrind/valgrind_3.15.0.bb
index 1475ff841e..7954437a1a 100644
--- a/meta/recipes-devtools/valgrind/valgrind_3.15.0.bb
+++ b/meta/recipes-devtools/valgrind/valgrind_3.15.0.bb
@@ -41,6 +41,7 @@ SRC_URI = "https://sourceware.org/pub/valgrind/valgrind-${PV}.tar.bz2 \
            file://s390x_vec_op_t.patch \
            file://0001-none-tests-fdleak_cmsg.stderr.exp-adjust-tmp-paths.patch \
            file://0001-tests-Make-pthread_detatch-call-portable-across-plat.patch \
+           file://0001-memcheck-tests-Fix-timerfd-syscall-test.patch \
            "
 SRC_URI[md5sum] = "46e5fbdcbc3502a5976a317a0860a975"
 SRC_URI[sha256sum] = "417c7a9da8f60dd05698b3a7bc6002e4ef996f14c13f0ff96679a16873e78ab1"
-- 
2.25.1



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

* Re: [PATCH 1/2] ruby: Use arm32 for coroutines on 32bit-arm
  2020-03-09 23:44 [PATCH 1/2] ruby: Use arm32 for coroutines on 32bit-arm Khem Raj
  2020-03-09 23:44 ` [PATCH 2/2] valgrind: Fix timerfb syscall test to be 64bit time_t safe Khem Raj
@ 2020-03-09 23:52 ` Andre McCurdy
  2020-03-10  0:33   ` Khem Raj
  1 sibling, 1 reply; 5+ messages in thread
From: Andre McCurdy @ 2020-03-09 23:52 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE Core mailing list

On Mon, Mar 9, 2020 at 4:44 PM Khem Raj <raj.khem@gmail.com> wrote:
>
> in 2.7 [2] ruby enabled ucontext for coroutines on arm32 but it does not
> work for musl since it uses glibc specific functions e.g.
> getcontext/swapcontext/swapcontext also see [1]
>
> This patch reverts back to using arm32 implementation for coroutines on
> arm
>
> [1] https://bugs.ruby-lang.org/issues/16455#change-83442
> [2] https://github.com/ruby/ruby/commit/6c6bf9ffcbfeb8be9d9c342e7604b74ec819e88a#diff-7fccec8474e2184cd2518046bf39d54cL10
>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  meta/recipes-devtools/ruby/ruby_2.7.0.bb | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/meta/recipes-devtools/ruby/ruby_2.7.0.bb b/meta/recipes-devtools/ruby/ruby_2.7.0.bb
> index 268b4bebd9..884bb0ef44 100644
> --- a/meta/recipes-devtools/ruby/ruby_2.7.0.bb
> +++ b/meta/recipes-devtools/ruby/ruby_2.7.0.bb
> @@ -25,6 +25,8 @@ EXTRA_OECONF = "\
>      --with-pkg-config=pkg-config \
>  "
>
> +EXTRA_OECONF_append_arm_libc-musl = " --with-coroutine=arm32"

Generally any _arm over-ride should either be duplicated for _armeb
too (or the commit message should explain why the over-ride is
specific to little endian ARM only).

>  do_install() {
>      oe_runmake 'DESTDIR=${D}' install
>  }
> --
> 2.25.1
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core


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

* Re: [PATCH 1/2] ruby: Use arm32 for coroutines on 32bit-arm
  2020-03-09 23:52 ` [PATCH 1/2] ruby: Use arm32 for coroutines on 32bit-arm Andre McCurdy
@ 2020-03-10  0:33   ` Khem Raj
  2020-03-10  1:11     ` Andre McCurdy
  0 siblings, 1 reply; 5+ messages in thread
From: Khem Raj @ 2020-03-10  0:33 UTC (permalink / raw)
  To: Andre McCurdy; +Cc: OE Core mailing list


[-- Attachment #1.1: Type: text/plain, Size: 1762 bytes --]



On 3/9/20 4:52 PM, Andre McCurdy wrote:
> On Mon, Mar 9, 2020 at 4:44 PM Khem Raj <raj.khem@gmail.com> wrote:
>>
>> in 2.7 [2] ruby enabled ucontext for coroutines on arm32 but it does not
>> work for musl since it uses glibc specific functions e.g.
>> getcontext/swapcontext/swapcontext also see [1]
>>
>> This patch reverts back to using arm32 implementation for coroutines on
>> arm
>>
>> [1] https://bugs.ruby-lang.org/issues/16455#change-83442
>> [2] https://github.com/ruby/ruby/commit/6c6bf9ffcbfeb8be9d9c342e7604b74ec819e88a#diff-7fccec8474e2184cd2518046bf39d54cL10
>>
>> Signed-off-by: Khem Raj <raj.khem@gmail.com>
>> ---
>>  meta/recipes-devtools/ruby/ruby_2.7.0.bb | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/meta/recipes-devtools/ruby/ruby_2.7.0.bb b/meta/recipes-devtools/ruby/ruby_2.7.0.bb
>> index 268b4bebd9..884bb0ef44 100644
>> --- a/meta/recipes-devtools/ruby/ruby_2.7.0.bb
>> +++ b/meta/recipes-devtools/ruby/ruby_2.7.0.bb
>> @@ -25,6 +25,8 @@ EXTRA_OECONF = "\
>>      --with-pkg-config=pkg-config \
>>  "
>>
>> +EXTRA_OECONF_append_arm_libc-musl = " --with-coroutine=arm32"
> 
> Generally any _arm over-ride should either be duplicated for _armeb
> too (or the commit message should explain why the over-ride is
> specific to little endian ARM only).

its just that I did not test it on armeb, and its assembly piece which
would need some testing on BE before it is enabled.

> 
>>  do_install() {
>>      oe_runmake 'DESTDIR=${D}' install
>>  }
>> --
>> 2.25.1
>>
>> --
>> _______________________________________________
>> Openembedded-core mailing list
>> Openembedded-core@lists.openembedded.org
>> http://lists.openembedded.org/mailman/listinfo/openembedded-core


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 201 bytes --]

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

* Re: [PATCH 1/2] ruby: Use arm32 for coroutines on 32bit-arm
  2020-03-10  0:33   ` Khem Raj
@ 2020-03-10  1:11     ` Andre McCurdy
  0 siblings, 0 replies; 5+ messages in thread
From: Andre McCurdy @ 2020-03-10  1:11 UTC (permalink / raw)
  To: Khem Raj; +Cc: OE Core mailing list

On Mon, Mar 9, 2020 at 5:33 PM Khem Raj <raj.khem@gmail.com> wrote:
>
> On 3/9/20 4:52 PM, Andre McCurdy wrote:
> > On Mon, Mar 9, 2020 at 4:44 PM Khem Raj <raj.khem@gmail.com> wrote:
> >>
> >> in 2.7 [2] ruby enabled ucontext for coroutines on arm32 but it does not
> >> work for musl since it uses glibc specific functions e.g.
> >> getcontext/swapcontext/swapcontext also see [1]
> >>
> >> This patch reverts back to using arm32 implementation for coroutines on
> >> arm
> >>
> >> [1] https://bugs.ruby-lang.org/issues/16455#change-83442
> >> [2] https://github.com/ruby/ruby/commit/6c6bf9ffcbfeb8be9d9c342e7604b74ec819e88a#diff-7fccec8474e2184cd2518046bf39d54cL10
> >>
> >> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> >> ---
> >>  meta/recipes-devtools/ruby/ruby_2.7.0.bb | 2 ++
> >>  1 file changed, 2 insertions(+)
> >>
> >> diff --git a/meta/recipes-devtools/ruby/ruby_2.7.0.bb b/meta/recipes-devtools/ruby/ruby_2.7.0.bb
> >> index 268b4bebd9..884bb0ef44 100644
> >> --- a/meta/recipes-devtools/ruby/ruby_2.7.0.bb
> >> +++ b/meta/recipes-devtools/ruby/ruby_2.7.0.bb
> >> @@ -25,6 +25,8 @@ EXTRA_OECONF = "\
> >>      --with-pkg-config=pkg-config \
> >>  "
> >>
> >> +EXTRA_OECONF_append_arm_libc-musl = " --with-coroutine=arm32"
> >
> > Generally any _arm over-ride should either be duplicated for _armeb
> > too (or the commit message should explain why the over-ride is
> > specific to little endian ARM only).
>
> its just that I did not test it on armeb, and its assembly piece which
> would need some testing on BE before it is enabled.

The default should be to keep arm and armeb in sync, unless there's a
clear reason not to. If you want to test big endian ARM then that's
great, but if you don't then just keeping the two targets in sync is
better than leaving big endian ARM unfixed _and_ untested.

> >>  do_install() {> >>      oe_runmake 'DESTDIR=${D}' install
> >>  }
> >> --
> >> 2.25.1
> >>
> >> --
> >> _______________________________________________
> >> Openembedded-core mailing list
> >> Openembedded-core@lists.openembedded.org
> >> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>


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

end of thread, other threads:[~2020-03-10  1:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-09 23:44 [PATCH 1/2] ruby: Use arm32 for coroutines on 32bit-arm Khem Raj
2020-03-09 23:44 ` [PATCH 2/2] valgrind: Fix timerfb syscall test to be 64bit time_t safe Khem Raj
2020-03-09 23:52 ` [PATCH 1/2] ruby: Use arm32 for coroutines on 32bit-arm Andre McCurdy
2020-03-10  0:33   ` Khem Raj
2020-03-10  1:11     ` Andre McCurdy

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