ruby: Do not use ucontext implementation for coroutines on musl/riscv
PATCH 1/1 ruby: Do not use ucontext implementation for coroutines on musl/riscv
The coroutine implementation in ruby has either arch specific implementations or it falls back to slower ucontext API based implementation assuming libc will provide the needed APIs, however musl does not implement ucontext APIs like glibc, therefore fallback is to use libucontext library on musl. However, libucontext is not ported to riscv yet. which means on musl/riscv ruby is unbuildable, however a third option is to use copy implementation for coroutines, which will be not as good performance-wise, but it will do the job, therefore for now use copy implementation for rv32/rv64 when using musl
--- meta/recipes-devtools/ruby/ruby_3.0.0.bb | 7 +++++++ 1 file changed, 7 insertions(+)
meta/recipes-devtools/ruby/ruby_3.0.0.bb +7 -0
@@ -32,6 +32,13 @@ EXTRA_OECONF_append_libc-musl = "\ ac_cv_func_isinf=yes \ " +EXTRA_OECONF_append_libc-musl_riscv64 = "\ + --with-coroutine=copy \ +" +EXTRA_OECONF_append_libc-musl_riscv32 = "\ + --with-coroutine=copy \ +" + do_install() { oe_runmake 'DESTDIR=${D}' install }
Signature · 1 line
2.30.1
I think I saw something similar on x86 builds (or was it arm32, don't remember) - so it might be worth discussing to make this setting the default and configurable to the user - thoughts?
Quoted 38 lines · Khem Raj
The coroutine implementation in ruby has either arch specific implementations or it falls back to slower ucontext API based implementation assuming libc will provide the needed APIs, however musl does not implement ucontext APIs like glibc, therefore fallback is to use libucontext library on musl. However, libucontext is not ported to riscv yet. which means on musl/riscv ruby is unbuildable, however a third option is to use copy implementation for coroutines, which will be not as good performance-wise, but it will do the job, therefore for now use copy implementation for rv32/rv64 when using musl
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-devtools/ruby/ruby_3.0.0.bb | 7 +++++++ 1 file changed, 7 insertions(+)meta/recipes-devtools/ruby/ruby_3.0.0.bb +7
-0@@ -32,6 +32,13 @@ EXTRA_OECONF_append_libc-musl = "\ ac_cv_func_isinf=yes \ " +EXTRA_OECONF_append_libc-musl_riscv64 = "\ + --with-coroutine=copy \ +" +EXTRA_OECONF_append_libc-musl_riscv32 = "\ + --with-coroutine=copy \ +" + do_install() { oe_runmake 'DESTDIR=${D}' install }
I don’t think it should be default since other options if implemented will perform better so it’s a last resort solution so I would suggest to use it only where it’s needed
Quoted 45 lines · Konrad Weihmann
I think I saw something similar on x86 builds (or was it arm32, don't remember) - so it might be worth discussing to make this setting the default and configurable to the user - thoughts?
Quoted 10 lines · Khem Raj
The coroutine implementation in ruby has either arch specific implementations or it falls back to slower ucontext API based implementation assuming libc will provide the needed APIs, however musl does not implement ucontext APIs like glibc, therefore fallback is to use libucontext library on musl. However, libucontext is not ported to riscv yet. which means on musl/riscv ruby is unbuildable, however a third option is to use copy implementation for coroutines, which will be not as good performance-wise, but it will do the job, therefore for now use copy implementation for rv32/rv64 when using musl
Review
Quoted 6 lines
Signed-off-by Khem Raj <[email protected]>--- meta/recipes-devtools/ruby/ruby_3.0.0.bb | 7 +++++++ 1 file changed, 7 insertions(+)(quoted diff) +0
-0b/meta/recipes-devtools/ruby/ruby_3.0.0.bb
Quoted 22 lines
index
5e143ee87f..28e12c3cd7100644meta/recipes-devtools/ruby/ruby_3.0.0.bb +7
-0@@ -32,6 +32,13 @@ EXTRA_OECONF_append_libc-musl = "\ ac_cv_func_isinf=yes \ " +EXTRA_OECONF_append_libc-musl_riscv64 = "\ + --with-coroutine=copy \ +" +EXTRA_OECONF_append_libc-musl_riscv32 = "\ + --with-coroutine=copy \ +" + do_install() { oe_runmake 'DESTDIR=${D}' install }