Bug#892295: jemalloc: Please add support for new architecture "riscv64" (RISC-V 64 bits little-endian)

2019-01-09 Thread Manuel A. Fernandez Montecelo
Em qua, 9 de jan de 2019 às 23:03, Manuel A. Fernandez Montecelo
 escreveu:
> 2019-01-08 03:11 Faidon Liambotis:
> >
> >5.1.0-2 was uploaded to unstable shortly before my previous email, so it
> >should start appearing on mirrors etc. soon. This upload involves a
> >transition, so I'll hold any changes until this plays out.
>
> What kind of transition?  The soname didn't change, I think?  (not for
> -1 at least).

Ah I see that now that I was wrong and now it's libjemalloc2, I
somehow missed it :)

-- 
Manuel A. Fernandez Montecelo 



Bug#892295: jemalloc: Please add support for new architecture "riscv64" (RISC-V 64 bits little-endian)

2019-01-09 Thread Manuel A. Fernandez Montecelo

2019-01-08 03:11 Faidon Liambotis:

On Tue, Jan 08, 2019 at 12:35:28AM +0100, Manuel A. Fernandez Montecelo wrote:

I am not sure what are your modifications, but I tried with the
patch/debdiff attached, compared to 5.1.0-1 (-2 is/was not yet in
snapshot or deb.debian.org) and everything went fine:

 Test suite summary: pass: 43/52, skip: 9/52, fail: 0/52


Hm, interesting! Thanks for testing this -- I'm not sure what went wrong
in my setup. Probably something related to qemu-user-static...


Yeah, qemu-user is unreliable for some stuff, specially
"delicate"/"sophisticated" low-level libraries.

That's why we use the much slower qemu-system for buildds.



So, I pushed this patch to the master branch in the salsa repo, and also
pushed this upstream: https://github.com/jemalloc/jemalloc/pull/1402

5.1.0-2 was uploaded to unstable shortly before my previous email, so it
should start appearing on mirrors etc. soon. This upload involves a
transition, so I'll hold any changes until this plays out.


What kind of transition?  The soname didn't change, I think?  (not for
-1 at least).

If it indeed breaks stuff, maybe I made a mistake to upload the new
version to "unreleased" for this port.



I'll take of this once that's done, but I'm curious to hear what
upstream will say in the meantime :)


Good, thanks to you!


--
Manuel A. Fernandez Montecelo 



Bug#892295: jemalloc: Please add support for new architecture "riscv64" (RISC-V 64 bits little-endian)

2019-01-07 Thread Faidon Liambotis
On Tue, Jan 08, 2019 at 12:35:28AM +0100, Manuel A. Fernandez Montecelo wrote:
> I am not sure what are your modifications, but I tried with the
> patch/debdiff attached, compared to 5.1.0-1 (-2 is/was not yet in
> snapshot or deb.debian.org) and everything went fine:
> 
>  Test suite summary: pass: 43/52, skip: 9/52, fail: 0/52

Hm, interesting! Thanks for testing this -- I'm not sure what went wrong
in my setup. Probably something related to qemu-user-static...

So, I pushed this patch to the master branch in the salsa repo, and also
pushed this upstream: https://github.com/jemalloc/jemalloc/pull/1402

5.1.0-2 was uploaded to unstable shortly before my previous email, so it
should start appearing on mirrors etc. soon. This upload involves a
transition, so I'll hold any changes until this plays out.

I'll take of this once that's done, but I'm curious to hear what
upstream will say in the meantime :)

Thanks!
Faidon



Bug#892295: jemalloc: Please add support for new architecture "riscv64" (RISC-V 64 bits little-endian)

2019-01-07 Thread Manuel A. Fernandez Montecelo

Hi!

2019-01-07 23:15 Faidon Liambotis:

reopen 892295
tags 892295 + help - fixed-upstream patch
thanks

[...]

I uploaded 5.1.0-2 to unstable moments ago, which includes the
aforementioned commit.

Unfortunately, it seems like the build fails due to atomics-related
complications, which judging from similar bug reports, could be fixed by
passing -pthread instead of -lpthread. I filed this upstream[1] and that
seemed like a good idea to them.

1: https://github.com/jemalloc/jemalloc/issues/1401

I then experimented with building with that option on a riscv64
qemu-user-static container locally, but I came across random issues when
running the test suite, like some allocation issues, or processes
hanging etc. The build with the same option on amd64 seems to have
worked fine. I wonder if this has something to do with jemalloc or my
(weirdly emulated) environment, bug regardless... I would love your
help, if you have a spare moment :)


First of all, thanks for taking care.

I am not sure what are your modifications, but I tried with the
patch/debdiff attached, compared to 5.1.0-1 (-2 is/was not yet in
snapshot or deb.debian.org) and everything went fine:

 Test suite summary: pass: 43/52, skip: 9/52, fail: 0/52

More info about the build, which I'll proceed to upload to unreleased:

 Build Architecture: riscv64
 Build Type: full
 Build-Space: 763036
 Build-Time: 2051
 Distribution: unreleased
 Host Architecture: riscv64
 Install-Time: 40
 Job: .../jemalloc/jemalloc_5.1.0-1+0.riscv64.1.dsc
 Machine Architecture: riscv64
 Package: jemalloc
 Package-Time: 2122
 Source-Version: 5.1.0-1+0.riscv64.1
 Space: 763036
 Status: successful
 Version: 5.1.0-1+0.riscv64.1

This is on real hardware, I trust that it will also work fine in the
buildds (qemu-system), but if not we can take another look.

Not sure if the patch is correct or it's better to fix it in another
way, I hope that you or upstream can figure that out, or if not we can
iterate over it and try different things.

Hope that helps.  Thanks again!

--
Manuel A. Fernandez Montecelo 
Index: jemalloc-5.1.0/Makefile.in
===
--- jemalloc-5.1.0.orig/Makefile.in
+++ jemalloc-5.1.0/Makefile.in
@@ -400,7 +400,7 @@ $(objroot)test/unit/%$(EXE): $(objroot)t
 
 $(objroot)test/integration/%$(EXE): $(objroot)test/integration/%.$(O) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
 	@mkdir -p $(@D)
-	$(CC) $(TEST_LD_MODE) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LJEMALLOC) $(LDFLAGS) $(filter-out -lm,$(filter -lrt -lpthread -lstdc++,$(LIBS))) $(LM) $(EXTRA_LDFLAGS)
+	$(CC) $(TEST_LD_MODE) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LJEMALLOC) $(LDFLAGS) $(filter-out -lm,$(filter -lrt -pthread -lstdc++,$(LIBS))) $(LM) $(EXTRA_LDFLAGS)
 
 $(objroot)test/integration/cpp/%$(EXE): $(objroot)test/integration/cpp/%.$(O) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
 	@mkdir -p $(@D)
Index: jemalloc-5.1.0/configure.ac
===
--- jemalloc-5.1.0.orig/configure.ac
+++ jemalloc-5.1.0/configure.ac
@@ -1503,7 +1503,7 @@ if test "x$abi" != "xpecoff" ; then
   AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])])
   dnl Some systems may embed pthreads functionality in libc; check for libpthread
   dnl first, but try libc too before failing.
-  AC_CHECK_LIB([pthread], [pthread_create], [JE_APPEND_VS(LIBS, -lpthread)],
+  AC_CHECK_LIB([pthread], [pthread_create], [JE_APPEND_VS(LIBS, -pthread)],
[AC_SEARCH_LIBS([pthread_create], , ,
AC_MSG_ERROR([libpthread is missing]))])
   wrap_syms="${wrap_syms} pthread_create"
diff -Nru jemalloc-5.1.0/debian/changelog jemalloc-5.1.0/debian/changelog
--- jemalloc-5.1.0/debian/changelog 2018-05-26 23:36:03.0 +0200
+++ jemalloc-5.1.0/debian/changelog 2019-01-07 23:28:11.0 +0100
@@ -1,3 +1,10 @@
+jemalloc (5.1.0-1+0.riscv64.1) unreleased; urgency=medium
+
+  * Non-maintainer upload.
+  * riscv64: use -pthread
+
+ -- Manuel A. Fernandez Montecelo   Mon, 07 Jan 2019 22:28:11 
+
+
 jemalloc (5.1.0-1) experimental; urgency=medium
 
   * New upstream release.
diff -Nru jemalloc-5.1.0/debian/patches/riscv64-support.dch 
jemalloc-5.1.0/debian/patches/riscv64-support.dch
--- jemalloc-5.1.0/debian/patches/riscv64-support.dch   1970-01-01 
01:00:00.0 +0100
+++ jemalloc-5.1.0/debian/patches/riscv64-support.dch   2019-01-07 
23:28:11.0 +0100
@@ -0,0 +1,26 @@
+Index: jemalloc-5.1.0/Makefile.in
+===
+--- jemalloc-5.1.0.orig/Makefile.in
 jemalloc-5.1.0/Makefile.in
+@@ -400,7 +400,7 @@ $(objroot)test/unit/%$(EXE): $(objroot)t
+ 
+ $(objroot)test/integration/%$(EXE): $(objroot)test/integration/%.$(O) 
$(C_TESTLIB_INTEGRATION_OBJS) 

Bug#892295: jemalloc: Please add support for new architecture "riscv64" (RISC-V 64 bits little-endian)

2019-01-07 Thread Faidon Liambotis
reopen 892295
tags 892295 + help - fixed-upstream patch
thanks

Hi Manuel,

On Wed, Mar 07, 2018 at 10:44:25PM +0100, Manuel A. Fernandez Montecelo wrote:
> We need support in this package for RISC-V, to bootstrap the riscv64
> architecture.
> 
> Patches have been submitted upstream months ago, targetting development
> versions:
> 
>   
> https://github.com/jemalloc/jemalloc/commit/749caf14ae73a9ab1c48e538a8af09addbb35ee7
> 
>   (the file was named differently before, I didn't bother to get the VCS 
> history
>   to chase all commits, but it's clear enough).
> 
> Since we're still including older versions in unstable (and even 
> experimental),
> and in Debian we can get by by defining LG_QUANTUM in d/rules, instead of
> patching the upstream source code I propose a patch for debian/rules instead,
> attached.
> 
> It would be great if you could include it as a patch and release a new version
> for unstable.

I uploaded 5.1.0-2 to unstable moments ago, which includes the
aforementioned commit.

Unfortunately, it seems like the build fails due to atomics-related
complications, which judging from similar bug reports, could be fixed by
passing -pthread instead of -lpthread. I filed this upstream[1] and that
seemed like a good idea to them.

1: https://github.com/jemalloc/jemalloc/issues/1401

I then experimented with building with that option on a riscv64
qemu-user-static container locally, but I came across random issues when
running the test suite, like some allocation issues, or processes
hanging etc. The build with the same option on amd64 seems to have
worked fine. I wonder if this has something to do with jemalloc or my
(weirdly emulated) environment, bug regardless... I would love your
help, if you have a spare moment :)

Regards,
Faidon



Bug#892295: jemalloc: Please add support for new architecture "riscv64" (RISC-V 64 bits little-endian)

2018-03-07 Thread Manuel A. Fernandez Montecelo
Source: jemalloc
Version: 3.6.0-11
Severity: normal
Tags: patch upstream fixed-upstream
User: debian-ri...@lists.debian.org
Usertags: riscv64
Forwarded: https://github.com/jemalloc/jemalloc/pull/1081

Hello,

We need support in this package for RISC-V, to bootstrap the riscv64
architecture.

Patches have been submitted upstream months ago, targetting development
versions:

  
https://github.com/jemalloc/jemalloc/commit/749caf14ae73a9ab1c48e538a8af09addbb35ee7

  (the file was named differently before, I didn't bother to get the VCS history
  to chase all commits, but it's clear enough).

Since we're still including older versions in unstable (and even experimental),
and in Debian we can get by by defining LG_QUANTUM in d/rules, instead of
patching the upstream source code I propose a patch for debian/rules instead,
attached.

It would be great if you could include it as a patch and release a new version
for unstable.

If we can help by NMUing the package or anything else, please let me/us know.


Thanks and cheers.
--
Manuel A. Fernandez Montecelo 
--- a/debian/rules  2017-08-25 17:51:57.0 +0200
+++ b/debian/rules  2018-03-07 22:41:08.615157261 +0100
@@ -6,7 +6,7 @@
 include /usr/share/dpkg/architecture.mk
 include /usr/share/dpkg/pkg-info.mk
 
-ifneq (,$(findstring $(DEB_HOST_ARCH),sh3 sparc sparc64))
+ifneq (,$(findstring $(DEB_HOST_ARCH),riscv64 sh3 sparc sparc64))
   DEB_CPPFLAGS_MAINT_APPEND += -DLG_QUANTUM=4
 endif