Discussion:
Helping out with JDK 9 on BSD
(too old to reply)
Magnus Ihse Bursie
2016-01-31 10:54:12 UTC
Permalink
Hi,

[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's not
clear where to put them, or how.]

I'm working at Oracle on the OpenJDK build team and is responsible for
large parts of the build system of OpenJDK. Lately, I've been playing
around with FreeBSD (and other BSDs) in my free time, and I've written a
patch that will add build system support for FreeBSD, OpenBSD and NetBSD
in JDK 9 (tracked in https://bugs.openjdk.java.net/browse/JDK-8147795).

I started writing this when I realized that the jdk9 branch in the
OpenJDK bsd-port repository did not contain any BSD-specific changes at
all, and the old JDK 8 changes will not readily be portable, due to
major changes in the build system between JDK 8 and JDK 9.

I thought it would be a no-brainer to integrate these changes into the
JDK 9 mainline, so they would be in place for whenever you guys would
start to attack porting the code base. However, some of my collegues
thought otherwise. The end result, I think, is that they wanted to see
someone (not necessarily a company, the FreeBSD organisation for
instance seemed to be okay), to step forward and say "we take
responsibility for the BSD port", and give some kind of commitment to
actually use these build changes in producing a viable port. You can
read the mail conversation here:
http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html

An alternative to pushing this code into the JDK 9 mainline is of course
to push it to the bsd-port/jdk9 repo (given that the owners of that repo
approves), but that seems like a less favourable solution. Having the
code in the mainline does not mean that it gets tested automatically,
but it means that it will be part of e.g. refactoring, that would
otherwise break a downstream patchset.

I cc:ed this conversation to the bsd-port-***@openjdk.java.net mailing
list, but never got any kind of official response there. Since this list
seems more active, I'm trying here instead. :)

So, I'm offering two patches here, one that applies to the build system,
is nice and clean, and possible to integrate into JDK 9 mainline, if my
collegues are convinced that someone is backing up the BSD port. And
there's a second patch, which fixes broken C/C++/Java code and results
in a product that can at least run "javac HelloWorld", but this is not
yet clean enough for integration anywere, at least not the JDK 9
mainline. (I don't know enough of the BSD internals to fix all problems,
so there's some "#if 0" code here and there.)

/Magnus
Magnus Ihse Bursie
2016-01-31 11:00:19 UTC
Permalink
Post by Magnus Ihse Bursie
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's not
clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is responsible for
large parts of the build system of OpenJDK. Lately, I've been playing
around with FreeBSD (and other BSDs) in my free time, and I've written
a patch that will add build system support for FreeBSD, OpenBSD and
NetBSD in JDK 9 (tracked in
https://bugs.openjdk.java.net/browse/JDK-8147795).
I started writing this when I realized that the jdk9 branch in the
OpenJDK bsd-port repository did not contain any BSD-specific changes
at all, and the old JDK 8 changes will not readily be portable, due to
major changes in the build system between JDK 8 and JDK 9.
I thought it would be a no-brainer to integrate these changes into the
JDK 9 mainline, so they would be in place for whenever you guys would
start to attack porting the code base. However, some of my collegues
thought otherwise. The end result, I think, is that they wanted to see
someone (not necessarily a company, the FreeBSD organisation for
instance seemed to be okay), to step forward and say "we take
responsibility for the BSD port", and give some kind of commitment to
actually use these build changes in producing a viable port. You can
http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html
I forgot to add that I'm willing to help with build issues for the BSD
port, as far as my (like everybode else's) limited free time allows me.
Unfortunately, I'm still a noob at BSD internals and can't really help
with much apart from that.

/Magnus
Post by Magnus Ihse Bursie
An alternative to pushing this code into the JDK 9 mainline is of
course to push it to the bsd-port/jdk9 repo (given that the owners of
that repo approves), but that seems like a less favourable solution.
Having the code in the mainline does not mean that it gets tested
automatically, but it means that it will be part of e.g. refactoring,
that would otherwise break a downstream patchset.
list, but never got any kind of official response there. Since this
list seems more active, I'm trying here instead. :)
So, I'm offering two patches here, one that applies to the build
system, is nice and clean, and possible to integrate into JDK 9
mainline, if my collegues are convinced that someone is backing up the
BSD port. And there's a second patch, which fixes broken C/C++/Java
code and results in a product that can at least run "javac
HelloWorld", but this is not yet clean enough for integration anywere,
at least not the JDK 9 mainline. (I don't know enough of the BSD
internals to fix all problems, so there's some "#if 0" code here and
there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
Brian Gardner
2016-01-31 14:57:26 UTC
Permalink
I’m interested in helping. I ported openjdk6 to freebsd and also helped out with openjdk8.

Brian Gardner
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's not clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is responsible for large parts of the build system of OpenJDK. Lately, I've been playing around with FreeBSD (and other BSDs) in my free time, and I've written a patch that will add build system support for FreeBSD, OpenBSD and NetBSD in JDK 9 (tracked in https://bugs.openjdk.java.net/browse/JDK-8147795).
I started writing this when I realized that the jdk9 branch in the OpenJDK bsd-port repository did not contain any BSD-specific changes at all, and the old JDK 8 changes will not readily be portable, due to major changes in the build system between JDK 8 and JDK 9.
I thought it would be a no-brainer to integrate these changes into the JDK 9 mainline, so they would be in place for whenever you guys would start to attack porting the code base. However, some of my collegues thought otherwise. The end result, I think, is that they wanted to see someone (not necessarily a company, the FreeBSD organisation for instance seemed to be okay), to step forward and say "we take responsibility for the BSD port", and give some kind of commitment to actually use these build changes in producing a viable port. You can read the mail conversation here: http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html
I forgot to add that I'm willing to help with build issues for the BSD port, as far as my (like everybode else's) limited free time allows me. Unfortunately, I'm still a noob at BSD internals and can't really help with much apart from that.
/Magnus
An alternative to pushing this code into the JDK 9 mainline is of course to push it to the bsd-port/jdk9 repo (given that the owners of that repo approves), but that seems like a less favourable solution. Having the code in the mainline does not mean that it gets tested automatically, but it means that it will be part of e.g. refactoring, that would otherwise break a downstream patchset.
So, I'm offering two patches here, one that applies to the build system, is nice and clean, and possible to integrate into JDK 9 mainline, if my collegues are convinced that someone is backing up the BSD port. And there's a second patch, which fixes broken C/C++/Java code and results in a product that can at least run "javac HelloWorld", but this is not yet clean enough for integration anywere, at least not the JDK 9 mainline. (I don't know enough of the BSD internals to fix all problems, so there's some "#if 0" code here and there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
Brian Gardner
2016-02-01 00:00:54 UTC
Permalink
Hi Magnus,
I was able to clone the jdk9/dev repo, apply your patches, and compile on FreeBSD 10.1 amd64, with some changes to the Serviceability Agent ported from bad-port/jdk8 repo, however when I try to run javac I get a bunch of messages like:
Thread 832744400 has exited with leftover thread-specific data after 4 destructor iterations

I’m curious where you left off in getting "javac HelloWorld” working on FreeBSD?

Brian Gardner
Post by Brian Gardner
I’m interested in helping. I ported openjdk6 to freebsd and also helped out with openjdk8.
Brian Gardner
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's not clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is responsible for large parts of the build system of OpenJDK. Lately, I've been playing around with FreeBSD (and other BSDs) in my free time, and I've written a patch that will add build system support for FreeBSD, OpenBSD and NetBSD in JDK 9 (tracked in https://bugs.openjdk.java.net/browse/JDK-8147795).
I started writing this when I realized that the jdk9 branch in the OpenJDK bsd-port repository did not contain any BSD-specific changes at all, and the old JDK 8 changes will not readily be portable, due to major changes in the build system between JDK 8 and JDK 9.
I thought it would be a no-brainer to integrate these changes into the JDK 9 mainline, so they would be in place for whenever you guys would start to attack porting the code base. However, some of my collegues thought otherwise. The end result, I think, is that they wanted to see someone (not necessarily a company, the FreeBSD organisation for instance seemed to be okay), to step forward and say "we take responsibility for the BSD port", and give some kind of commitment to actually use these build changes in producing a viable port. You can read the mail conversation here: http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html
I forgot to add that I'm willing to help with build issues for the BSD port, as far as my (like everybode else's) limited free time allows me. Unfortunately, I'm still a noob at BSD internals and can't really help with much apart from that.
/Magnus
An alternative to pushing this code into the JDK 9 mainline is of course to push it to the bsd-port/jdk9 repo (given that the owners of that repo approves), but that seems like a less favourable solution. Having the code in the mainline does not mean that it gets tested automatically, but it means that it will be part of e.g. refactoring, that would otherwise break a downstream patchset.
So, I'm offering two patches here, one that applies to the build system, is nice and clean, and possible to integrate into JDK 9 mainline, if my collegues are convinced that someone is backing up the BSD port. And there's a second patch, which fixes broken C/C++/Java code and results in a product that can at least run "javac HelloWorld", but this is not yet clean enough for integration anywere, at least not the JDK 9 mainline. (I don't know enough of the BSD internals to fix all problems, so there's some "#if 0" code here and there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
Magnus Ihse Bursie
2016-02-01 12:00:49 UTC
Permalink
Post by Brian Gardner
Hi Magnus,
I was able to clone the jdk9/dev repo, apply your patches, and compile
on FreeBSD 10.1 amd64, with some changes to the Serviceability Agent
ported from bad-port/jdk8 repo, however when I try to run javac I get
Thread 832744400 has exited with leftover thread-specific data after 4
destructor iterations
I’m curious where you left off in getting "javac HelloWorld” working
on FreeBSD?
Somewhere around there. :-) I got it "working" on FreeBSD, OpenBSD and
NetBSD, with some caveats. I did not say it worked perfectly. :) I don't
remember exactly right now what workarounds were needed in what
circumstances, but on one of the platforms I needed to set
LD_LIBRARY_PATH, and on some other I needed to set an -X option to
specify memory sizes (which were not correctly read from the system).

The message you describe is a warning due to lack of proper code to
cleanup some kind of TLS data, if I remember correctly. It's harmless,
but annoying. The fix is relative straightforward, but I didn't bother
doing it.

/Magnus
Post by Brian Gardner
Brian Gardner
Post by Brian Gardner
I’m interested in helping. I ported openjdk6 to freebsd and also
helped out with openjdk8.
Brian Gardner
On Jan 31, 2016, at 3:00 AM, Magnus Ihse Bursie
Post by Magnus Ihse Bursie
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's
not clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is responsible
for large parts of the build system of OpenJDK. Lately, I've been
playing around with FreeBSD (and other BSDs) in my free time, and
I've written a patch that will add build system support for
FreeBSD, OpenBSD and NetBSD in JDK 9 (tracked in
https://bugs.openjdk.java.net/browse/JDK-8147795).
I started writing this when I realized that the jdk9 branch in the
OpenJDK bsd-port repository did not contain any BSD-specific
changes at all, and the old JDK 8 changes will not readily be
portable, due to major changes in the build system between JDK 8
and JDK 9.
I thought it would be a no-brainer to integrate these changes into
the JDK 9 mainline, so they would be in place for whenever you guys
would start to attack porting the code base. However, some of my
collegues thought otherwise. The end result, I think, is that they
wanted to see someone (not necessarily a company, the FreeBSD
organisation for instance seemed to be okay), to step forward and
say "we take responsibility for the BSD port", and give some kind
of commitment to actually use these build changes in producing a
http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html
I forgot to add that I'm willing to help with build issues for the
BSD port, as far as my (like everybode else's) limited free time
allows me. Unfortunately, I'm still a noob at BSD internals and
can't really help with much apart from that.
/Magnus
Post by Magnus Ihse Bursie
An alternative to pushing this code into the JDK 9 mainline is of
course to push it to the bsd-port/jdk9 repo (given that the owners
of that repo approves), but that seems like a less favourable
solution. Having the code in the mainline does not mean that it
gets tested automatically, but it means that it will be part of
e.g. refactoring, that would otherwise break a downstream patchset.
any kind of official response there. Since this list seems more
active, I'm trying here instead. :)
So, I'm offering two patches here, one that applies to the build
system, is nice and clean, and possible to integrate into JDK 9
mainline, if my collegues are convinced that someone is backing up
the BSD port. And there's a second patch, which fixes broken
C/C++/Java code and results in a product that can at least run
"javac HelloWorld", but this is not yet clean enough for
integration anywere, at least not the JDK 9 mainline. (I don't know
enough of the BSD internals to fix all problems, so there's some
"#if 0" code here and there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
_______________________________________________
mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-java<https://lists.freebsd.org/mailman/listinfo/freebsd-java>
To unsubscribe, send any mail to
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to
Brian Gardner
2016-02-01 15:46:32 UTC
Permalink
Hi Magnus,
I’ve been looking into it further and it lead me to a couple of change sets:
http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/469835cd5494 <http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/469835cd5494>
and then this change set:
http://hg.openjdk.java.net/jdk9/dev/hotspot/rev/f7dc8eebc3f5 <http://hg.openjdk.java.net/jdk9/dev/hotspot/rev/f7dc8eebc3f5>

The second change set titled, Replace ThreadLocalStorage with compiler/language-based thread-local variables,
seems to add in logic for doing compiler based thread local storage THREAD_LOCAL_DECL, but fails to actually replace the ThreadLocalStorage usage when persisting the current thread. I couldn’t understand why you would want to persist both ways. In any case it seemed harmless, and I’m trying to get gdb working with my images so I can debug the TLS issue further.

It sounds like you already have an idea how to fix it though. Any ideas or pointers would be greatly appreciated.

Brian Gardner
Post by Brian Gardner
Hi Magnus,
Thread 832744400 has exited with leftover thread-specific data after 4 destructor iterations
I’m curious where you left off in getting "javac HelloWorld” working on FreeBSD?
Somewhere around there. :-) I got it "working" on FreeBSD, OpenBSD and NetBSD, with some caveats. I did not say it worked perfectly. :) I don't remember exactly right now what workarounds were needed in what circumstances, but on one of the platforms I needed to set LD_LIBRARY_PATH, and on some other I needed to set an -X option to specify memory sizes (which were not correctly read from the system).
The message you describe is a warning due to lack of proper code to cleanup some kind of TLS data, if I remember correctly. It's harmless, but annoying. The fix is relative straightforward, but I didn't bother doing it.
/Magnus
Post by Brian Gardner
Brian Gardner
Post by Brian Gardner
I’m interested in helping. I ported openjdk6 to freebsd and also helped out with openjdk8.
Brian Gardner
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's not clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is responsible for large parts of the build system of OpenJDK. Lately, I've been playing around with FreeBSD (and other BSDs) in my free time, and I've written a patch that will add build system support for FreeBSD, OpenBSD and NetBSD in JDK 9 (tracked in <https://bugs.openjdk.java.net/browse/JDK-8147795>https://bugs.openjdk.java.net/browse/JDK-8147795 <https://bugs.openjdk.java.net/browse/JDK-8147795>).
I started writing this when I realized that the jdk9 branch in the OpenJDK bsd-port repository did not contain any BSD-specific changes at all, and the old JDK 8 changes will not readily be portable, due to major changes in the build system between JDK 8 and JDK 9.
I thought it would be a no-brainer to integrate these changes into the JDK 9 mainline, so they would be in place for whenever you guys would start to attack porting the code base. However, some of my collegues thought otherwise. The end result, I think, is that they wanted to see someone (not necessarily a company, the FreeBSD organisation for instance seemed to be okay), to step forward and say "we take responsibility for the BSD port", and give some kind of commitment to actually use these build changes in producing a viable port. You can read the mail conversation here: <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html>http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html>
I forgot to add that I'm willing to help with build issues for the BSD port, as far as my (like everybode else's) limited free time allows me. Unfortunately, I'm still a noob at BSD internals and can't really help with much apart from that.
/Magnus
An alternative to pushing this code into the JDK 9 mainline is of course to push it to the bsd-port/jdk9 repo (given that the owners of that repo approves), but that seems like a less favourable solution. Having the code in the mainline does not mean that it gets tested automatically, but it means that it will be part of e.g. refactoring, that would otherwise break a downstream patchset.
So, I'm offering two patches here, one that applies to the build system, is nice and clean, and possible to integrate into JDK 9 mainline, if my collegues are convinced that someone is backing up the BSD port. And there's a second patch, which fixes broken C/C++/Java code and results in a product that can at least run "javac HelloWorld", but this is not yet clean enough for integration anywere, at least not the JDK 9 mainline. (I don't know enough of the BSD internals to fix all problems, so there's some "#if 0" code here and there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> < <https://lists.freebsd.org/mailman/listinfo/freebsd-java>https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
Magnus Ihse Bursie
2016-02-01 22:11:06 UTC
Permalink
_______________________________________________
freebsd-***@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "freebsd-java-***@freebsd.org"
Magnus Ihse Bursie
2016-02-01 22:21:44 UTC
Permalink
_______________________________________________
freebsd-***@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "freebsd-java-***@freebsd.org"
Magnus Ihse Bursie
2016-02-01 22:29:04 UTC
Permalink
Post by Magnus Ihse Bursie
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
I'm not sure what's happening here. My emails are being stripped of
content. :-( I'll try to resend using my private SMTP server.

/Magnus
Magnus Ihse Bursie
2016-02-01 22:34:47 UTC
Permalink
_______________________________________________
freebsd-***@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "freebsd-java-***@freebsd.org"
Magnus Ihse Bursie
2016-02-01 22:55:44 UTC
Permalink
Post by Magnus Ihse Bursie
Post by Magnus Ihse Bursie
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
I'm not sure what's happening here. My emails are being stripped of
content. :-( I'll try to resend using my private SMTP server.
Didn't work either. I give up. Seems the content is filtered by mailman? :(

I'll try to post a few highlights anyway:

This might be due to a different interpretation/implementation of
pthreads in FreeBSD, see e.g.
https://lists.freebsd.org/pipermail/freebsd-threads/2009-June/004563.html.
I can't really say this situation applies (I can't find usages of
pthread_key_delete) but maybe there's a similar issue.

One approach would be to compile a debug build (configure
--enable-debug) and see if the "initializing TLS more than once" assert
is triggered.

Or try recompiling with -DUSE_LIBRARY_BASED_TLS_ONLY. I don't think it
should matter, but maybe.

/Magnus
Post by Magnus Ihse Bursie
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
Magnus Ihse Bursie
2016-02-01 22:32:07 UTC
Permalink
Resending.

/Magnus
Post by Magnus Ihse Bursie
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
I'm not sure what happened there.
Post by Magnus Ihse Bursie
Hi Magnus,
http://hg.openjdk.java.net/jdk9/hs-rt/hotspot/rev/469835cd5494
http://hg.openjdk.java.net/jdk9/dev/hotspot/rev/f7dc8eebc3f5
The second change set titled, Replace ThreadLocalStorage with compiler/language-based thread-local variables,
seems to add in logic for doing compiler based thread local storage THREAD_LOCAL_DECL, but fails to actually replace the ThreadLocalStorage usage when persisting the current thread. I couldn’t understand why you would want to persist both ways.
I believe the reason for this is given in the bug description (https://bugs.openjdk.java.net/browse/JDK-8132510):
"The code underpinning __thread use is not async-signal-safe, which is not really a surprise as pthread_get/setspecific are not designated async-signal-safe either.

[...]

So I've reinstated a very basic ThreadLocalStorage class which will only need two implementations: a POSIX one, and a Windows one. This class is always initialized and ThreadLocalStorage::thread() is used from the signal handlers (as today). "
Post by Magnus Ihse Bursie
In any case it seemed harmless, and I’m trying to get gdb working with my images so I can debug the TLS issue further.
It sounds like you already have an idea how to fix it though. Any ideas or pointers would be greatly appreciated.
I think you've dug up about as much as I did. I believe the main cause for the problems is JDK-8132510 (the second of your changesets) which rewrote the entire infrastructure on how TLS is used in hotspot. And this was not tested on bsd. I know it took some iterations to get it right on the platforms it was tested on. I think one approach is to study this changeset more in detail on how linux and macosx is handled, which will likely give some hints on what's missing for bsd. It seems you've might have been finding some discrepancies already.

The first of your changesets indicate a way this same problem was fixed previously. It seems to me that this fix (creating the key with a restore_thread_pointer callback) is implemented in JDK-8132510, but maybe it doesn't work. Perhaps there is some difference in the implementation of this on FreeBSD? From the manpage for pthread_key_create I read:

If, after all the destructors have been called for all non-NULL values
with associated destructors, there are still some non-NULL values with
associated destructors, then the process is repeated. If, after at least
[PTHREAD_DESTRUCTOR_ITERATIONS] iterations of destructor calls for out-
standing non-NULL values, there are still some non-NULL values with asso-
ciated destructors, the implementation stops calling destructors.

It seems that PTHREAD_DESTRUCTOR_ITERATIONS is 4 on FreeBSD. Maybe it's larger on other systems? (Checking on my Ubuntu, I read 4 there as well). Hm, so maybe something is iterating out of control here.


I have some ideas of it's cause, at least. I'll provide what info I have.

This was (probably) introduced by JDK-8132510 (the second of your changesets), which rewrote the entire infrastructure on how TLS is used in hotspot. And this was not adapted to bsd. I think one approach is to study this changeset more in detail on how linux and macosx is handled, which will likely give some hints on what's missing for bsd.

I'm currently trying to recompile with -DUSE_LIBRARY_BASED_TLS_ONLY, to see if that modifies the behavior. I don't really think it will, but if it does, it'll shed some light on the problem.

Another approach is to compile a debug build (configure --enable-debug) and see if this assert is triggered:
assert(!_initialized, "initializing TLS more than once!");

/Magnus
Brian Gardner
2016-02-02 15:35:41 UTC
Permalink
I’ve been working on getting the debug build running. I’m stuck on a SIGBUS error trickling up from a new test, test_safefetch32 at StubRoutines.cpp line:599. It seems like it’s trying to test an passing an invalid address but expects to get a response and to be able to handle it, but can’t. I haven’t looked into the change sets yet to determine what they are trying to achieve with this new code, and what the expected behavior is. I’ll continue with that tomorrow.

Brian
Post by Magnus Ihse Bursie
Post by Magnus Ihse Bursie
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
I'm not sure what's happening here. My emails are being stripped of content. :-( I'll try to resend using my private SMTP server.
Didn't work either. I give up. Seems the content is filtered by mailman? :(
This might be due to a different interpretation/implementation of pthreads in FreeBSD, see e.g. https://lists.freebsd.org/pipermail/freebsd-threads/2009-June/004563.html. I can't really say this situation applies (I can't find usages of pthread_key_delete) but maybe there's a similar issue.
One approach would be to compile a debug build (configure --enable-debug) and see if the "initializing TLS more than once" assert is triggered.
Or try recompiling with -DUSE_LIBRARY_BASED_TLS_ONLY. I don't think it should matter, but maybe.
/Magnus
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
Greg Lewis
2016-02-03 03:40:53 UTC
Permalink
I???m interested in helping. I ported openjdk6 to freebsd and also helped out with openjdk8.
Brian Gardner
I'd love to see as much of these changes get into the jdk9 mainline. My time
is really limited for the next couple of weeks though. If it would help you
or Magnus to use the bsd-port repo to stage changes then that would be
great too. Let me do a merge to make sure it is up to date with mainline.
Notionally we'd have to do a vote to get you both access I think? But I
can shepherd changes in if that will help with sharing them.

FWIW, in terms of taking responsibility, I've been regularly updating the
repos for jdk8 and jdk7 for a couple of years. I'm happy to keep jdk9
building if that is what is being looked for there and also port more of
the BSD changes for jdk8 as appropriate.

- Greg
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's not clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is responsible for large parts of the build system of OpenJDK. Lately, I've been playing around with FreeBSD (and other BSDs) in my free time, and I've written a patch that will add build system support for FreeBSD, OpenBSD and NetBSD in JDK 9 (tracked in https://bugs.openjdk.java.net/browse/JDK-8147795).
I started writing this when I realized that the jdk9 branch in the OpenJDK bsd-port repository did not contain any BSD-specific changes at all, and the old JDK 8 changes will not readily be portable, due to major changes in the build system between JDK 8 and JDK 9.
I thought it would be a no-brainer to integrate these changes into the JDK 9 mainline, so they would be in place for whenever you guys would start to attack porting the code base. However, some of my collegues thought otherwise. The end result, I think, is that they wanted to see someone (not necessarily a company, the FreeBSD organisation for instance seemed to be okay), to step forward and say "we take responsibility for the BSD port", and give some kind of commitment to actually use these build changes in producing a viable port. You can read the mail conversation here: http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html
I forgot to add that I'm willing to help with build issues for the BSD port, as far as my (like everybode else's) limited free time allows me. Unfortunately, I'm still a noob at BSD internals and can't really help with much apart from that.
/Magnus
An alternative to pushing this code into the JDK 9 mainline is of course to push it to the bsd-port/jdk9 repo (given that the owners of that repo approves), but that seems like a less favourable solution. Having the code in the mainline does not mean that it gets tested automatically, but it means that it will be part of e.g. refactoring, that would otherwise break a downstream patchset.
So, I'm offering two patches here, one that applies to the build system, is nice and clean, and possible to integrate into JDK 9 mainline, if my collegues are convinced that someone is backing up the BSD port. And there's a second patch, which fixes broken C/C++/Java code and results in a product that can at least run "javac HelloWorld", but this is not yet clean enough for integration anywere, at least not the JDK 9 mainline. (I don't know enough of the BSD internals to fix all problems, so there's some "#if 0" code here and there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
--
Greg Lewis Email : ***@eyesbeyond.com
Eyes Beyond Web : http://www.eyesbeyond.com
Information Technology FreeBSD : ***@FreeBSD.org
Brian Gardner
2016-02-04 00:29:50 UTC
Permalink
Hi Greg,
Great to hear from you, it’s been a while since I took on one of these projects, but I do follow the ***@freebsd mailing list and see all the work you put in. I must tell you how greatly your work is appreciated by me and I’m sure the rest of the community. I have good news, with fairly minimal changes I have it compiling, building HelloWorld, and running HelloWorld all without errors.

I think it’ll break down into 4 change sets,
NM - I ported some code from bsd-port/jdk8/hotspot/make/bsd/makefiles/build_vm_def.sh that fixes a compile error
SUPPORT_RESERVED_STACK_AREA - define SUPPORT_RESERVED_STACK_AREA for _ALLBSD_SOURCE
Serviceability Agent - ported from bad-port/jdk8, currently compiles but hasn’t been tested
TLS - there is problems with the TLS in jdk9 used for Thread::current(). This caused several issues for me and while the fix was relatively straight forward in using THREAD_LOCAL_DECL completely in place of TLS completely, I’d imagine there was a reason it was implemented in sort of a Hybrid fashion alongside TLS.

It would be great if I could post these as web reviews for others to review. Greg, would getting access to bsd-port/jdk9 allow us to collaborate through web reviews? Magnus, do you think using bsd-port/jdk9 for this purpose be a step towards getting these basic changes into the jdk9 mainline, or would your colleagues think "if they have bsd-port/jdk9, why bother with integrating them into the jdk9 mainline?”

Brian Gardner
Post by Greg Lewis
I???m interested in helping. I ported openjdk6 to freebsd and also helped out with openjdk8.
Brian Gardner
I'd love to see as much of these changes get into the jdk9 mainline. My time
is really limited for the next couple of weeks though. If it would help you
or Magnus to use the bsd-port repo to stage changes then that would be
great too. Let me do a merge to make sure it is up to date with mainline.
Notionally we'd have to do a vote to get you both access I think? But I
can shepherd changes in if that will help with sharing them.
FWIW, in terms of taking responsibility, I've been regularly updating the
repos for jdk8 and jdk7 for a couple of years. I'm happy to keep jdk9
building if that is what is being looked for there and also port more of
the BSD changes for jdk8 as appropriate.
- Greg
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's not clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is responsible for large parts of the build system of OpenJDK. Lately, I've been playing around with FreeBSD (and other BSDs) in my free time, and I've written a patch that will add build system support for FreeBSD, OpenBSD and NetBSD in JDK 9 (tracked in https://bugs.openjdk.java.net/browse/JDK-8147795).
I started writing this when I realized that the jdk9 branch in the OpenJDK bsd-port repository did not contain any BSD-specific changes at all, and the old JDK 8 changes will not readily be portable, due to major changes in the build system between JDK 8 and JDK 9.
I thought it would be a no-brainer to integrate these changes into the JDK 9 mainline, so they would be in place for whenever you guys would start to attack porting the code base. However, some of my collegues thought otherwise. The end result, I think, is that they wanted to see someone (not necessarily a company, the FreeBSD organisation for instance seemed to be okay), to step forward and say "we take responsibility for the BSD port", and give some kind of commitment to actually use these build changes in producing a viable port. You can read the mail conversation here: http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html
I forgot to add that I'm willing to help with build issues for the BSD port, as far as my (like everybode else's) limited free time allows me. Unfortunately, I'm still a noob at BSD internals and can't really help with much apart from that.
/Magnus
An alternative to pushing this code into the JDK 9 mainline is of course to push it to the bsd-port/jdk9 repo (given that the owners of that repo approves), but that seems like a less favourable solution. Having the code in the mainline does not mean that it gets tested automatically, but it means that it will be part of e.g. refactoring, that would otherwise break a downstream patchset.
So, I'm offering two patches here, one that applies to the build system, is nice and clean, and possible to integrate into JDK 9 mainline, if my collegues are convinced that someone is backing up the BSD port. And there's a second patch, which fixes broken C/C++/Java code and results in a product that can at least run "javac HelloWorld", but this is not yet clean enough for integration anywere, at least not the JDK 9 mainline. (I don't know enough of the BSD internals to fix all problems, so there's some "#if 0" code here and there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
--
Eyes Beyond Web : http://www.eyesbeyond.com <http://www.eyesbeyond.com/>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
Magnus Ihse Bursie
2016-02-05 07:50:43 UTC
Permalink
_______________________________________________
freebsd-***@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to "freebsd-java-***@freebsd.org"
Magnus Ihse Bursie
2016-02-05 08:02:03 UTC
Permalink
Post by Greg Lewis
I???m interested in helping. I ported openjdk6 to freebsd and also helped out with openjdk8.
Brian Gardner
I'd love to see as much of these changes get into the jdk9 mainline. My time
is really limited for the next couple of weeks though. If it would help you
or Magnus to use the bsd-port repo to stage changes then that would be
great too. Let me do a merge to make sure it is up to date with mainline.
Notionally we'd have to do a vote to get you both access I think? But I
can shepherd changes in if that will help with sharing them.
To make Brian and me committers on the bsd-port project will require a
community vote with a 2 weeks voting time, yes. Unless Brian already is
an OpenJDK Author (that is, has an OpenJDK account), getting the account
created after the vote, has in the past been a long wait for the OpenJDK
ops to do their thing as well. :(

So the quickest and easiest way, at least if we're just talking a few
number of patches, is that you shepherd them in.
Post by Greg Lewis
FWIW, in terms of taking responsibility, I've been regularly updating the
repos for jdk8 and jdk7 for a couple of years. I'm happy to keep jdk9
building if that is what is being looked for there and also port more of
the BSD changes for jdk8 as appropriate.
I think "regularly building" is kind of the basic they're looking for
here, and maybe such a promise is good enough to get my build changes
into the mainline.

Apparently the FreeBSD foundation has a license to use the official TCK
test suite. Getting a port to completely pass the TCK is likely to be
quite some work, but if it does it can be integrated as a core supported
platform in the JDK9 mainline (and then, automatically, in future
versions of the JDK). Maybe it's not even a requirement to pass the full
TCK for a community effort. Perhaps it's fine to just run the TCK
sort-of regularly and tracking the results so that the number of
failures does not drastically increase, and having some kind of long
term goal/vision of having zero TCK failures. But I'm not sure about
these things. We should probably involve Dalibor Topic in that discussion.

/Magnus
Post by Greg Lewis
- Greg
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's not clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is responsible for large parts of the build system of OpenJDK. Lately, I've been playing around with FreeBSD (and other BSDs) in my free time, and I've written a patch that will add build system support for FreeBSD, OpenBSD and NetBSD in JDK 9 (tracked in https://bugs.openjdk.java.net/browse/JDK-8147795).
I started writing this when I realized that the jdk9 branch in the OpenJDK bsd-port repository did not contain any BSD-specific changes at all, and the old JDK 8 changes will not readily be portable, due to major changes in the build system between JDK 8 and JDK 9.
I thought it would be a no-brainer to integrate these changes into the JDK 9 mainline, so they would be in place for whenever you guys would start to attack porting the code base. However, some of my collegues thought otherwise. The end result, I think, is that they wanted to see someone (not necessarily a company, the FreeBSD organisation for instance seemed to be okay), to step forward and say "we take responsibility for the BSD port", and give some kind of commitment to actually use these build changes in producing a viable port. You can read the mail conversation here: http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html
I forgot to add that I'm willing to help with build issues for the BSD port, as far as my (like everybode else's) limited free time allows me. Unfortunately, I'm still a noob at BSD internals and can't really help with much apart from that.
/Magnus
An alternative to pushing this code into the JDK 9 mainline is of course to push it to the bsd-port/jdk9 repo (given that the owners of that repo approves), but that seems like a less favourable solution. Having the code in the mainline does not mean that it gets tested automatically, but it means that it will be part of e.g. refactoring, that would otherwise break a downstream patchset.
So, I'm offering two patches here, one that applies to the build system, is nice and clean, and possible to integrate into JDK 9 mainline, if my collegues are convinced that someone is backing up the BSD port. And there's a second patch, which fixes broken C/C++/Java code and results in a product that can at least run "javac HelloWorld", but this is not yet clean enough for integration anywere, at least not the JDK 9 mainline. (I don't know enough of the BSD internals to fix all problems, so there's some "#if 0" code here and there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
pathiaki2 via freebsd-java
2016-02-06 19:38:31 UTC
Permalink
and getting it to pass the test suite would be very much appreciated by
a lot of us. There's some serious java applications that are very
useful out there that used to work the OpenJDK port for FreeBSD but no
longer.

I mention this as I wanted to create a port for OpenNMS as it is truly,
IMHO, more advanced than most other enterprise monitoring systems.

I created a page on how easy it is to setup with their own installer,
but, despite the stabilization of OJDK 8, instead of crashing in less
than two hours, it will crash in a little over 24 now. :-(

https://www.opennms.org/wiki/Installing_on_FreeBSD_10.x_with_OpenJDK

It's coming up on a year, I've now verified the issue still exists with
OpenNMS 1.17.x . It would be very much appreciated to get the OpenJDK
core figured out as something just goes South. I'm willing to do builds
and produce cores as needed, but the fact this runs fine on Linux using
Oracle JDK and OpenJDK, just kind of irks me as FreeBSD is just so tight
regarding everything else.

Thank you all for your efforts and from all the people who want to see
OpenNMS running native on FreeBSD.

P.
Post by Magnus Ihse Bursie
Post by Greg Lewis
I???m interested in helping. I ported openjdk6 to freebsd and also
helped out with openjdk8.
Brian Gardner
I'd love to see as much of these changes get into the jdk9 mainline.
My time
is really limited for the next couple of weeks though. If it would
help you
or Magnus to use the bsd-port repo to stage changes then that would be
great too. Let me do a merge to make sure it is up to date with
mainline.
Notionally we'd have to do a vote to get you both access I think? But I
can shepherd changes in if that will help with sharing them.
To make Brian and me committers on the bsd-port project will require a
community vote with a 2 weeks voting time, yes. Unless Brian already
is an OpenJDK Author (that is, has an OpenJDK account), getting the
account created after the vote, has in the past been a long wait for
the OpenJDK ops to do their thing as well. :(
So the quickest and easiest way, at least if we're just talking a few
number of patches, is that you shepherd them in.
Post by Greg Lewis
FWIW, in terms of taking responsibility, I've been regularly updating
the
repos for jdk8 and jdk7 for a couple of years. I'm happy to keep jdk9
building if that is what is being looked for there and also port more of
the BSD changes for jdk8 as appropriate.
I think "regularly building" is kind of the basic they're looking for
here, and maybe such a promise is good enough to get my build changes
into the mainline.
Apparently the FreeBSD foundation has a license to use the official
TCK test suite. Getting a port to completely pass the TCK is likely to
be quite some work, but if it does it can be integrated as a core
supported platform in the JDK9 mainline (and then, automatically, in
future versions of the JDK). Maybe it's not even a requirement to pass
the full TCK for a community effort. Perhaps it's fine to just run the
TCK sort-of regularly and tracking the results so that the number of
failures does not drastically increase, and having some kind of long
term goal/vision of having zero TCK failures. But I'm not sure about
these things. We should probably involve Dalibor Topic in that
discussion.
/Magnus
Post by Greg Lewis
- Greg
On Jan 31, 2016, at 3:00 AM, Magnus Ihse Bursie
Post by Magnus Ihse Bursie
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's
not clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is responsible
for large parts of the build system of OpenJDK. Lately, I've been
playing around with FreeBSD (and other BSDs) in my free time, and
I've written a patch that will add build system support for
FreeBSD, OpenBSD and NetBSD in JDK 9 (tracked in
https://bugs.openjdk.java.net/browse/JDK-8147795).
I started writing this when I realized that the jdk9 branch in the
OpenJDK bsd-port repository did not contain any BSD-specific
changes at all, and the old JDK 8 changes will not readily be
portable, due to major changes in the build system between JDK 8
and JDK 9.
I thought it would be a no-brainer to integrate these changes into
the JDK 9 mainline, so they would be in place for whenever you
guys would start to attack porting the code base. However, some of
my collegues thought otherwise. The end result, I think, is that
they wanted to see someone (not necessarily a company, the FreeBSD
organisation for instance seemed to be okay), to step forward and
say "we take responsibility for the BSD port", and give some kind
of commitment to actually use these build changes in producing a
http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html
I forgot to add that I'm willing to help with build issues for the
BSD port, as far as my (like everybode else's) limited free time
allows me. Unfortunately, I'm still a noob at BSD internals and
can't really help with much apart from that.
/Magnus
Post by Magnus Ihse Bursie
An alternative to pushing this code into the JDK 9 mainline is of
course to push it to the bsd-port/jdk9 repo (given that the owners
of that repo approves), but that seems like a less favourable
solution. Having the code in the mainline does not mean that it
gets tested automatically, but it means that it will be part of
e.g. refactoring, that would otherwise break a downstream patchset.
mailing list, but never got any kind of official response there.
Since this list seems more active, I'm trying here instead. :)
So, I'm offering two patches here, one that applies to the build
system, is nice and clean, and possible to integrate into JDK 9
mainline, if my collegues are convinced that someone is backing up
the BSD port. And there's a second patch, which fixes broken
C/C++/Java code and results in a product that can at least run
"javac HelloWorld", but this is not yet clean enough for
integration anywere, at least not the JDK 9 mainline. (I don't
know enough of the BSD internals to fix all problems, so there's
some "#if 0" code here and there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to
_______________________________________________
list
https://lists.freebsd.org/mailman/listinfo/freebsd-java
<https://lists.freebsd.org/mailman/listinfo/freebsd-java>
To unsubscribe, send any mail to
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
Paul
2016-02-06 20:01:21 UTC
Permalink
+1
Post by pathiaki2 via freebsd-java
and getting it to pass the test suite would be very much appreciated
by a lot of us. There's some serious java applications that are very
useful out there that used to work the OpenJDK port for FreeBSD but no
longer.
I mention this as I wanted to create a port for OpenNMS as it is
truly, IMHO, more advanced than most other enterprise monitoring systems.
I created a page on how easy it is to setup with their own installer,
but, despite the stabilization of OJDK 8, instead of crashing in less
than two hours, it will crash in a little over 24 now. :-(
https://www.opennms.org/wiki/Installing_on_FreeBSD_10.x_with_OpenJDK
It's coming up on a year, I've now verified the issue still exists
with OpenNMS 1.17.x . It would be very much appreciated to get the
OpenJDK core figured out as something just goes South. I'm willing to
do builds and produce cores as needed, but the fact this runs fine on
Linux using Oracle JDK and OpenJDK, just kind of irks me as FreeBSD is
just so tight regarding everything else.
Thank you all for your efforts and from all the people who want to see
OpenNMS running native on FreeBSD.
P.
Post by Magnus Ihse Bursie
Post by Greg Lewis
I???m interested in helping. I ported openjdk6 to freebsd and also
helped out with openjdk8.
Brian Gardner
I'd love to see as much of these changes get into the jdk9
mainline. My time
is really limited for the next couple of weeks though. If it would
help you
or Magnus to use the bsd-port repo to stage changes then that would be
great too. Let me do a merge to make sure it is up to date with
mainline.
Notionally we'd have to do a vote to get you both access I think?
But I
can shepherd changes in if that will help with sharing them.
To make Brian and me committers on the bsd-port project will require
a community vote with a 2 weeks voting time, yes. Unless Brian
already is an OpenJDK Author (that is, has an OpenJDK account),
getting the account created after the vote, has in the past been a
long wait for the OpenJDK ops to do their thing as well. :(
So the quickest and easiest way, at least if we're just talking a few
number of patches, is that you shepherd them in.
Post by Greg Lewis
FWIW, in terms of taking responsibility, I've been regularly
updating the
repos for jdk8 and jdk7 for a couple of years. I'm happy to keep jdk9
building if that is what is being looked for there and also port
more of
the BSD changes for jdk8 as appropriate.
I think "regularly building" is kind of the basic they're looking for
here, and maybe such a promise is good enough to get my build changes
into the mainline.
Apparently the FreeBSD foundation has a license to use the official
TCK test suite. Getting a port to completely pass the TCK is likely
to be quite some work, but if it does it can be integrated as a core
supported platform in the JDK9 mainline (and then, automatically, in
future versions of the JDK). Maybe it's not even a requirement to
pass the full TCK for a community effort. Perhaps it's fine to just
run the TCK sort-of regularly and tracking the results so that the
number of failures does not drastically increase, and having some
kind of long term goal/vision of having zero TCK failures. But I'm
not sure about these things. We should probably involve Dalibor Topic
in that discussion.
/Magnus
Post by Greg Lewis
- Greg
On Jan 31, 2016, at 3:00 AM, Magnus Ihse Bursie
Post by Magnus Ihse Bursie
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but
it's not clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is
responsible for large parts of the build system of OpenJDK.
Lately, I've been playing around with FreeBSD (and other BSDs) in
my free time, and I've written a patch that will add build system
support for FreeBSD, OpenBSD and NetBSD in JDK 9 (tracked in
https://bugs.openjdk.java.net/browse/JDK-8147795).
I started writing this when I realized that the jdk9 branch in
the OpenJDK bsd-port repository did not contain any BSD-specific
changes at all, and the old JDK 8 changes will not readily be
portable, due to major changes in the build system between JDK 8
and JDK 9.
I thought it would be a no-brainer to integrate these changes
into the JDK 9 mainline, so they would be in place for whenever
you guys would start to attack porting the code base. However,
some of my collegues thought otherwise. The end result, I think,
is that they wanted to see someone (not necessarily a company,
the FreeBSD organisation for instance seemed to be okay), to step
forward and say "we take responsibility for the BSD port", and
give some kind of commitment to actually use these build changes
in producing a viable port. You can read the mail conversation
http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html
I forgot to add that I'm willing to help with build issues for the
BSD port, as far as my (like everybode else's) limited free time
allows me. Unfortunately, I'm still a noob at BSD internals and
can't really help with much apart from that.
/Magnus
Post by Magnus Ihse Bursie
An alternative to pushing this code into the JDK 9 mainline is of
course to push it to the bsd-port/jdk9 repo (given that the
owners of that repo approves), but that seems like a less
favourable solution. Having the code in the mainline does not
mean that it gets tested automatically, but it means that it will
be part of e.g. refactoring, that would otherwise break a
downstream patchset.
mailing list, but never got any kind of official response there.
Since this list seems more active, I'm trying here instead. :)
So, I'm offering two patches here, one that applies to the build
system, is nice and clean, and possible to integrate into JDK 9
mainline, if my collegues are convinced that someone is backing
up the BSD port. And there's a second patch, which fixes broken
C/C++/Java code and results in a product that can at least run
"javac HelloWorld", but this is not yet clean enough for
integration anywere, at least not the JDK 9 mainline. (I don't
know enough of the BSD internals to fix all problems, so there's
some "#if 0" code here and there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to
_______________________________________________
list
https://lists.freebsd.org/mailman/listinfo/freebsd-java
<https://lists.freebsd.org/mailman/listinfo/freebsd-java>
To unsubscribe, send any mail to
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
Brian Gardner
2016-02-09 22:36:24 UTC
Permalink
Hi Greg and Magnus,
I’ve attached the patches needed to build and compile on Freebsd. I’ve reverted my changes to TLS, and done more debugging there. There appears to be two separate issues. One issue was that the implementation of OS::bad::gettid() was somehow clearing the current thread previously set with pthread_setspecific. I was able to fix this by porting logic from bad-port/jdk8, see hotspot__os_bd_cpp__getthreadid.patch. The second issue seems to be related to certain types of threads never getting their destructor called and therefor not clearing pthread_setspecific and resulting in Thread 803c59000 has exited with leftover thread-specific data after 4 destructor iterations, errors. This one I haven’t tracked down yet and will continue looking into. While I can compile and execute HelloWorld, I’m getting a ton of these benign yet annoying messages from ConcurrentGC and Worker threads. I’ll continue looking into that next week.
Post by Brian Gardner
Hi Greg,
I think it’ll break down into 4 change sets,
NM - I ported some code from bsd-port/jdk8/hotspot/make/bsd/makefiles/build_vm_def.sh that fixes a compile error
SUPPORT_RESERVED_STACK_AREA - define SUPPORT_RESERVED_STACK_AREA for _ALLBSD_SOURCE
Serviceability Agent - ported from bad-port/jdk8, currently compiles but hasn’t been tested
TLS - there is problems with the TLS in jdk9 used for Thread::current(). This caused several issues for me and while the fix was relatively straight forward in using THREAD_LOCAL_DECL completely in place of TLS completely, I’d imagine there was a reason it was implemented in sort of a Hybrid fashion alongside TLS.
https://bugs.openjdk.java.net/browse/JDK-8132510?focusedCommentId=13866505 <https://bugs.openjdk.java.net/browse/JDK-8132510?focusedCommentId=13866505>
The TL;DR: in some circumstances the JVM can crash if we do not set up an initial TLS. On the other hand, this was for glibc, so maybe this situation does not arise for FreeBSD.
Post by Brian Gardner
It would be great if I could post these as web reviews for others to review. Greg, would getting access to bsd-port/jdk9 allow us to collaborate through web reviews?
Magnus, do you think using bsd-port/jdk9 for this purpose be a step towards getting these basic changes into the jdk9 mainline, or would your colleagues think "if they have bsd-port/jdk9, why bother with integrating them into the jdk9 mainline?”
I think putting these changes in bsd-port/jdk9 is very reasonable, and I do not believe it will in any way hinder their acceptance into jdk9 mainline. The only thing to be careful about there, though, is that all contributors have signed the OCA (Oracle contributor agreement). Mixing in "legally bad" code can present a real problem for adoption into mainline.
/Magnus
Post by Brian Gardner
Brian Gardner
Post by Greg Lewis
I???m interested in helping. I ported openjdk6 to freebsd and also helped out with openjdk8.
Brian Gardner
I'd love to see as much of these changes get into the jdk9 mainline. My time
is really limited for the next couple of weeks though. If it would help you
or Magnus to use the bsd-port repo to stage changes then that would be
great too. Let me do a merge to make sure it is up to date with mainline.
Notionally we'd have to do a vote to get you both access I think? But I
can shepherd changes in if that will help with sharing them.
FWIW, in terms of taking responsibility, I've been regularly updating the
repos for jdk8 and jdk7 for a couple of years. I'm happy to keep jdk9
building if that is what is being looked for there and also port more of
the BSD changes for jdk8 as appropriate.
- Greg
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's not clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is responsible for large parts of the build system of OpenJDK. Lately, I've been playing around with FreeBSD (and other BSDs) in my free time, and I've written a patch that will add build system support for FreeBSD, OpenBSD and NetBSD in JDK 9 (tracked in <https://bugs.openjdk.java.net/browse/JDK-8147795>https://bugs.openjdk.java.net/browse/JDK-8147795 <https://bugs.openjdk.java.net/browse/JDK-8147795>).
I started writing this when I realized that the jdk9 branch in the OpenJDK bsd-port repository did not contain any BSD-specific changes at all, and the old JDK 8 changes will not readily be portable, due to major changes in the build system between JDK 8 and JDK 9.
I thought it would be a no-brainer to integrate these changes into the JDK 9 mainline, so they would be in place for whenever you guys would start to attack porting the code base. However, some of my collegues thought otherwise. The end result, I think, is that they wanted to see someone (not necessarily a company, the FreeBSD organisation for instance seemed to be okay), to step forward and say "we take responsibility for the BSD port", and give some kind of commitment to actually use these build changes in producing a viable port. You can read the mail conversation here: <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html>http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html>
I forgot to add that I'm willing to help with build issues for the BSD port, as far as my (like everybode else's) limited free time allows me. Unfortunately, I'm still a noob at BSD internals and can't really help with much apart from that.
/Magnus
An alternative to pushing this code into the JDK 9 mainline is of course to push it to the bsd-port/jdk9 repo (given that the owners of that repo approves), but that seems like a less favourable solution. Having the code in the mainline does not mean that it gets tested automatically, but it means that it will be part of e.g. refactoring, that would otherwise break a downstream patchset.
So, I'm offering two patches here, one that applies to the build system, is nice and clean, and possible to integrate into JDK 9 mainline, if my collegues are convinced that someone is backing up the BSD port. And there's a second patch, which fixes broken C/C++/Java code and results in a product that can at least run "javac HelloWorld", but this is not yet clean enough for integration anywere, at least not the JDK 9 mainline. (I don't know enough of the BSD internals to fix all problems, so there's some "#if 0" code here and there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
--
Eyes Beyond Web : <http://www.eyesbeyond.com/>http://www.eyesbeyond.com <http://www.eyesbeyond.com/>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
Greg Lewis
2016-02-13 08:09:45 UTC
Permalink
After giving it some thought, I???ve created an alternate patch for the clear_current_thread issue. I like this solution better because it is isolated to java_start function in os_bsd.cpp, and it makes java_start responsible for cleaning up the current_thread since it also initializes it.
Sounds good! What can I do to help get all the changes up for review?

-- Greg
Hello again Greg and Magnus,
I finished up researching the leftover thread-specific data after 4 destructor iterations issue. It looks like it???s currently functioning on Freebsd the same way it does on Linux, the only difference is that Freebsd output that warning were Linux silently stops after it???s forth try. I looked into how openjdk8 was working and it looks like there were calls to TLS::set_thread(NULL) scattered throughout the code base at the end of some ::run methods. I???ve mimicked that behavior in the necessary spots with the following patch. I can???t help but think there must be a better way to get these Thread???s destructors called, and I tried that in place of making clear_thread_current public and calling it directly, but it resulted in deadlock.
<hotspot__clear_thread_current.patch>
Post by Brian Gardner
Hi Greg and Magnus,
I???ve attached the patches needed to build and compile on Freebsd. I???ve reverted my changes to TLS, and done more debugging there. There appears to be two separate issues. One issue was that the implementation of OS::bad::gettid() was somehow clearing the current thread previously set with pthread_setspecific. I was able to fix this by porting logic from bad-port/jdk8, see hotspot__os_bd_cpp__getthreadid.patch. The second issue seems to be related to certain types of threads never getting their destructor called and therefor not clearing pthread_setspecific and resulting in Thread 803c59000 has exited with leftover thread-specific data after 4 destructor iterations, errors. This one I haven???t tracked down yet and will continue looking into. While I can compile and execute HelloWorld, I???m getting a ton of these benign yet annoying messages from ConcurrentGC and Worker threads. I???ll continue looking into that next week.
Post by Brian Gardner
Hi Greg,
I think it???ll break down into 4 change sets,
NM - I ported some code from bsd-port/jdk8/hotspot/make/bsd/makefiles/build_vm_def.sh that fixes a compile error
SUPPORT_RESERVED_STACK_AREA - define SUPPORT_RESERVED_STACK_AREA for _ALLBSD_SOURCE
Serviceability Agent - ported from bad-port/jdk8, currently compiles but hasn???t been tested
TLS - there is problems with the TLS in jdk9 used for Thread::current(). This caused several issues for me and while the fix was relatively straight forward in using THREAD_LOCAL_DECL completely in place of TLS completely, I???d imagine there was a reason it was implemented in sort of a Hybrid fashion alongside TLS.
https://bugs.openjdk.java.net/browse/JDK-8132510?focusedCommentId=13866505 <https://bugs.openjdk.java.net/browse/JDK-8132510?focusedCommentId=13866505> <https://bugs.openjdk.java.net/browse/JDK-8132510?focusedCommentId=13866505 <https://bugs.openjdk.java.net/browse/JDK-8132510?focusedCommentId=13866505>>
The TL;DR: in some circumstances the JVM can crash if we do not set up an initial TLS. On the other hand, this was for glibc, so maybe this situation does not arise for FreeBSD.
Post by Brian Gardner
It would be great if I could post these as web reviews for others to review. Greg, would getting access to bsd-port/jdk9 allow us to collaborate through web reviews?
Magnus, do you think using bsd-port/jdk9 for this purpose be a step towards getting these basic changes into the jdk9 mainline, or would your colleagues think "if they have bsd-port/jdk9, why bother with integrating them into the jdk9 mainline????
I think putting these changes in bsd-port/jdk9 is very reasonable, and I do not believe it will in any way hinder their acceptance into jdk9 mainline. The only thing to be careful about there, though, is that all contributors have signed the OCA (Oracle contributor agreement). Mixing in "legally bad" code can present a real problem for adoption into mainline.
/Magnus
Post by Brian Gardner
Brian Gardner
Post by Greg Lewis
I???m interested in helping. I ported openjdk6 to freebsd and also helped out with openjdk8.
Brian Gardner
I'd love to see as much of these changes get into the jdk9 mainline. My time
is really limited for the next couple of weeks though. If it would help you
or Magnus to use the bsd-port repo to stage changes then that would be
great too. Let me do a merge to make sure it is up to date with mainline.
Notionally we'd have to do a vote to get you both access I think? But I
can shepherd changes in if that will help with sharing them.
FWIW, in terms of taking responsibility, I've been regularly updating the
repos for jdk8 and jdk7 for a couple of years. I'm happy to keep jdk9
building if that is what is being looked for there and also port more of
the BSD changes for jdk8 as appropriate.
- Greg
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's not clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is responsible for large parts of the build system of OpenJDK. Lately, I've been playing around with FreeBSD (and other BSDs) in my free time, and I've written a patch that will add build system support for FreeBSD, OpenBSD and NetBSD in JDK 9 (tracked in <https://bugs.openjdk.java.net/browse/JDK-8147795 <https://bugs.openjdk.java.net/browse/JDK-8147795>>https://bugs.openjdk.java.net/browse/JDK-8147795 <https://bugs.openjdk.java.net/browse/JDK-8147795><https://bugs.openjdk.java.net/browse/JDK-8147795 <https://bugs.openjdk.java.net/browse/JDK-8147795>>).
I started writing this when I realized that the jdk9 branch in the OpenJDK bsd-port repository did not contain any BSD-specific changes at all, and the old JDK 8 changes will not readily be portable, due to major changes in the build system between JDK 8 and JDK 9.
I thought it would be a no-brainer to integrate these changes into the JDK 9 mainline, so they would be in place for whenever you guys would start to attack porting the code base. However, some of my collegues thought otherwise. The end result, I think, is that they wanted to see someone (not necessarily a company, the FreeBSD organisation for instance seemed to be okay), to step forward and say "we take responsibility for the BSD port", and give some kind of commitment to actually use these build changes in producing a viable port. You can read the mail conversation here: <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html>>http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html> <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html <http://mail.openjdk.java.net/p
ipermail/build-dev/2016-January/016421.html>>
Post by Brian Gardner
Post by Brian Gardner
Post by Greg Lewis
I forgot to add that I'm willing to help with build issues for the BSD port, as far as my (like everybode else's) limited free time allows me. Unfortunately, I'm still a noob at BSD internals and can't really help with much apart from that.
/Magnus
An alternative to pushing this code into the JDK 9 mainline is of course to push it to the bsd-port/jdk9 repo (given that the owners of that repo approves), but that seems like a less favourable solution. Having the code in the mainline does not mean that it gets tested automatically, but it means that it will be part of e.g. refactoring, that would otherwise break a downstream patchset.
So, I'm offering two patches here, one that applies to the build system, is nice and clean, and possible to integrate into JDK 9 mainline, if my collegues are convinced that someone is backing up the BSD port. And there's a second patch, which fixes broken C/C++/Java code and results in a product that can at least run "javac HelloWorld", but this is not yet clean enough for integration anywere, at least not the JDK 9 mainline. (I don't know enough of the BSD internals to fix all problems, so there's some "#if 0" code here and there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>
--
Eyes Beyond Web : <http://www.eyesbeyond.com/ <http://www.eyesbeyond.com/>>http://www.eyesbeyond.com <http://www.eyesbeyond.com/> <http://www.eyesbeyond.com/ <http://www.eyesbeyond.com/>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
--
Greg Lewis Email : ***@eyesbeyond.com
Eyes Beyond Web : http://www.eyesbeyond.com
Information Technology FreeBSD : ***@FreeBSD.org
Greg Lewis
2016-02-13 08:04:21 UTC
Permalink
Hi Brian,

Answers inline :).
Post by Brian Gardner
Hi Greg,
I think it???ll break down into 4 change sets,
NM - I ported some code from bsd-port/jdk8/hotspot/make/bsd/makefiles/build_vm_def.sh that fixes a compile error
SUPPORT_RESERVED_STACK_AREA - define SUPPORT_RESERVED_STACK_AREA for _ALLBSD_SOURCE
Serviceability Agent - ported from bad-port/jdk8, currently compiles but hasn???t been tested
TLS - there is problems with the TLS in jdk9 used for Thread::current(). This caused several issues for me and while the fix was relatively straight forward in using THREAD_LOCAL_DECL completely in place of TLS completely, I???d imagine there was a reason it was implemented in sort of a Hybrid fashion alongside TLS.
Breaking it down into these different changesets would certainly make
review easier.

The serviceability agent code only gets tested irregularly as it is, so
I'm not sure it is currently fully functional in openjdk8. That said,
this would be a good opportunity to fix it and back port anything relevant.
Post by Brian Gardner
It would be great if I could post these as web reviews for others to review. Greg, would getting access to bsd-port/jdk9 allow us to collaborate through web reviews? Magnus, do you think using bsd-port/jdk9 for this purpose be a step towards getting these basic changes into the jdk9 mainline, or would your colleagues think "if they have bsd-port/jdk9, why bother with integrating them into the jdk9 mainline????
Getting access to bsd-port/jdk9 doesn't provide anything special in terms
of being able to post them as webrevs. OpenJDK has a page on how to use
it at:

http://openjdk.java.net/guide/webrevHelp.html

You just need somewhere to host the generated changes. If you don't, let
me know and we can work something out.
Post by Brian Gardner
Post by Greg Lewis
I???m interested in helping. I ported openjdk6 to freebsd and also helped out with openjdk8.
Brian Gardner
I'd love to see as much of these changes get into the jdk9 mainline. My time
is really limited for the next couple of weeks though. If it would help you
or Magnus to use the bsd-port repo to stage changes then that would be
great too. Let me do a merge to make sure it is up to date with mainline.
Notionally we'd have to do a vote to get you both access I think? But I
can shepherd changes in if that will help with sharing them.
FWIW, in terms of taking responsibility, I've been regularly updating the
repos for jdk8 and jdk7 for a couple of years. I'm happy to keep jdk9
building if that is what is being looked for there and also port more of
the BSD changes for jdk8 as appropriate.
- Greg
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's not clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is responsible for large parts of the build system of OpenJDK. Lately, I've been playing around with FreeBSD (and other BSDs) in my free time, and I've written a patch that will add build system support for FreeBSD, OpenBSD and NetBSD in JDK 9 (tracked in https://bugs.openjdk.java.net/browse/JDK-8147795).
I started writing this when I realized that the jdk9 branch in the OpenJDK bsd-port repository did not contain any BSD-specific changes at all, and the old JDK 8 changes will not readily be portable, due to major changes in the build system between JDK 8 and JDK 9.
I thought it would be a no-brainer to integrate these changes into the JDK 9 mainline, so they would be in place for whenever you guys would start to attack porting the code base. However, some of my collegues thought otherwise. The end result, I think, is that they wanted to see someone (not necessarily a company, the FreeBSD organisation for instance seemed to be okay), to step forward and say "we take responsibility for the BSD port", and give some kind of commitment to actually use these build changes in producing a viable port. You can read the mail conversation here: http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html
I forgot to add that I'm willing to help with build issues for the BSD port, as far as my (like everybode else's) limited free time allows me. Unfortunately, I'm still a noob at BSD internals and can't really help with much apart from that.
/Magnus
An alternative to pushing this code into the JDK 9 mainline is of course to push it to the bsd-port/jdk9 repo (given that the owners of that repo approves), but that seems like a less favourable solution. Having the code in the mainline does not mean that it gets tested automatically, but it means that it will be part of e.g. refactoring, that would otherwise break a downstream patchset.
So, I'm offering two patches here, one that applies to the build system, is nice and clean, and possible to integrate into JDK 9 mainline, if my collegues are convinced that someone is backing up the BSD port. And there's a second patch, which fixes broken C/C++/Java code and results in a product that can at least run "javac HelloWorld", but this is not yet clean enough for integration anywere, at least not the JDK 9 mainline. (I don't know enough of the BSD internals to fix all problems, so there's some "#if 0" code here and there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java
--
Eyes Beyond Web : http://www.eyesbeyond.com <http://www.eyesbeyond.com/>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
--
Greg Lewis Email : ***@eyesbeyond.com
Eyes Beyond Web : http://www.eyesbeyond.com
Information Technology FreeBSD : ***@FreeBSD.org
Brian Gardner
2016-02-13 18:58:34 UTC
Permalink
Here are web reviews for all of the patches
porting build_vm_def.sh from bsd-port/jdk8 repo, to fix NM errors during build
http://brian.timestudybuddy.com/webrev/hotspot__NM/webrev/ <http://brian.timestudybuddy.com/webrev/hotspot__NM/webrev/>
Add SUPPORT_RESERVED_STACK_AREA flag for all BSD's
http://brian.timestudybuddy.com/webrev/hotspot__SUPPORT_RESERVED_STACK_AREA/webrev/ <http://brian.timestudybuddy.com/webrev/hotspot__SUPPORT_RESERVED_STACK_AREA/webrev/>
porting getthreadid logic from bsd-port/jdk8. calling syscall(SYS_thr_self) caused pthread_setspecific to be cleared.
http://brian.timestudybuddy.com/webrev/ <http://brian.timestudybuddy.com/webrev/hotspot__os_bsd_cpp__getthreadid/webrev/>hotspot__os_bsd_cpp__getthreadid/webrev/ <http://brian.timestudybuddy.com/webrev/hotspot__os_bsd_cpp__getthreadid/webrev/>
adding in servicability agent ported from bsd-port/jdk8
http://brian.timestudybuddy.com/webrev/ <http://brian.timestudybuddy.com/webrev/hotspot__sa/webrev/>hotspot__sa/webrev/ <http://brian.timestudybuddy.com/webrev/hotspot__sa/webrev/>
adding classlist.bsd that is identical to classlist.linux, in order to compile
http://brian.timestudybuddy.com/webrev/jdk__classlist-bsd/webrev/ <http://brian.timestudybuddy.com/webrev/jdk__classlist-bsd/webrev/>
clean up TLS current thread at end of ::run functions similar to how it's done in openjdk8.
http://brian.timestudybuddy.com/webrev/ <http://brian.timestudybuddy.com/webrev/hotspot__clear_thread_current/webrev/>hotspot__clear_thread_current/webrev/ <http://brian.timestudybuddy.com/webrev/hotspot__clear_thread_current/webrev/>
clear current thread before exiting java_start to avoid warnings from leftover pthread_setspecific data
http://brian.timestudybuddy.com/webrev/hotspot__clear_thread_current_alt/webrev/ <http://brian.timestudybuddy.com/webrev/hotspot__clear_thread_current_alt/webrev/>
Post by Greg Lewis
After giving it some thought, I???ve created an alternate patch for the clear_current_thread issue. I like this solution better because it is isolated to java_start function in os_bsd.cpp, and it makes java_start responsible for cleaning up the current_thread since it also initializes it.
Sounds good! What can I do to help get all the changes up for review?
-- Greg
Hello again Greg and Magnus,
I finished up researching the leftover thread-specific data after 4 destructor iterations issue. It looks like it???s currently functioning on Freebsd the same way it does on Linux, the only difference is that Freebsd output that warning were Linux silently stops after it???s forth try. I looked into how openjdk8 was working and it looks like there were calls to TLS::set_thread(NULL) scattered throughout the code base at the end of some ::run methods. I???ve mimicked that behavior in the necessary spots with the following patch. I can???t help but think there must be a better way to get these Thread???s destructors called, and I tried that in place of making clear_thread_current public and calling it directly, but it resulted in deadlock.
<hotspot__clear_thread_current.patch>
Post by Brian Gardner
Hi Greg and Magnus,
I???ve attached the patches needed to build and compile on Freebsd. I???ve reverted my changes to TLS, and done more debugging there. There appears to be two separate issues. One issue was that the implementation of OS::bad::gettid() was somehow clearing the current thread previously set with pthread_setspecific. I was able to fix this by porting logic from bad-port/jdk8, see hotspot__os_bd_cpp__getthreadid.patch. The second issue seems to be related to certain types of threads never getting their destructor called and therefor not clearing pthread_setspecific and resulting in Thread 803c59000 has exited with leftover thread-specific data after 4 destructor iterations, errors. This one I haven???t tracked down yet and will continue looking into. While I can compile and execute HelloWorld, I???m getting a ton of these benign yet annoying messages from ConcurrentGC and Worker threads. I???ll continue looking into that next week.
Post by Brian Gardner
Hi Greg,
I think it???ll break down into 4 change sets,
NM - I ported some code from bsd-port/jdk8/hotspot/make/bsd/makefiles/build_vm_def.sh that fixes a compile error
SUPPORT_RESERVED_STACK_AREA - define SUPPORT_RESERVED_STACK_AREA for _ALLBSD_SOURCE
Serviceability Agent - ported from bad-port/jdk8, currently compiles but hasn???t been tested
TLS - there is problems with the TLS in jdk9 used for Thread::current(). This caused several issues for me and while the fix was relatively straight forward in using THREAD_LOCAL_DECL completely in place of TLS completely, I???d imagine there was a reason it was implemented in sort of a Hybrid fashion alongside TLS.
https://bugs.openjdk.java.net/browse/JDK-8132510?focusedCommentId=13866505 <https://bugs.openjdk.java.net/browse/JDK-8132510?focusedCommentId=13866505> <https://bugs.openjdk.java.net/browse/JDK-8132510?focusedCommentId=13866505 <https://bugs.openjdk.java.net/browse/JDK-8132510?focusedCommentId=13866505>>
The TL;DR: in some circumstances the JVM can crash if we do not set up an initial TLS. On the other hand, this was for glibc, so maybe this situation does not arise for FreeBSD.
Post by Brian Gardner
It would be great if I could post these as web reviews for others to review. Greg, would getting access to bsd-port/jdk9 allow us to collaborate through web reviews?
Magnus, do you think using bsd-port/jdk9 for this purpose be a step towards getting these basic changes into the jdk9 mainline, or would your colleagues think "if they have bsd-port/jdk9, why bother with integrating them into the jdk9 mainline????
I think putting these changes in bsd-port/jdk9 is very reasonable, and I do not believe it will in any way hinder their acceptance into jdk9 mainline. The only thing to be careful about there, though, is that all contributors have signed the OCA (Oracle contributor agreement). Mixing in "legally bad" code can present a real problem for adoption into mainline.
/Magnus
Post by Brian Gardner
Brian Gardner
Post by Greg Lewis
I???m interested in helping. I ported openjdk6 to freebsd and also helped out with openjdk8.
Brian Gardner
I'd love to see as much of these changes get into the jdk9 mainline. My time
is really limited for the next couple of weeks though. If it would help you
or Magnus to use the bsd-port repo to stage changes then that would be
great too. Let me do a merge to make sure it is up to date with mainline.
Notionally we'd have to do a vote to get you both access I think? But I
can shepherd changes in if that will help with sharing them.
FWIW, in terms of taking responsibility, I've been regularly updating the
repos for jdk8 and jdk7 for a couple of years. I'm happy to keep jdk9
building if that is what is being looked for there and also port more of
the BSD changes for jdk8 as appropriate.
- Greg
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's not clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is responsible for large parts of the build system of OpenJDK. Lately, I've been playing around with FreeBSD (and other BSDs) in my free time, and I've written a patch that will add build system support for FreeBSD, OpenBSD and NetBSD in JDK 9 (tracked in <https://bugs.openjdk.java.net/browse/JDK-8147795 <https://bugs.openjdk.java.net/browse/JDK-8147795>>https://bugs.openjdk.java.net/browse/JDK-8147795 <https://bugs.openjdk.java.net/browse/JDK-8147795><https://bugs.openjdk.java.net/browse/JDK-8147795 <https://bugs.openjdk.java.net/browse/JDK-8147795>>).
I started writing this when I realized that the jdk9 branch in the OpenJDK bsd-port repository did not contain any BSD-specific changes at all, and the old JDK 8 changes will not readily be portable, due to major changes in the build system between JDK 8 and JDK 9.
I thought it would be a no-brainer to integrate these changes into the JDK 9 mainline, so they would be in place for whenever you guys would start to attack porting the code base. However, some of my collegues thought otherwise. The end result, I think, is that they wanted to see someone (not necessarily a company, the FreeBSD organisation for instance seemed to be okay), to step forward and say "we take responsibility for the BSD port", and give some kind of commitment to actually use these build changes in producing a viable port. You can read the mail conversation here: <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html>>http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html> <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html <http://mail.openjdk.java.net/p
ipermail/build-dev/2016-January/016421.html>>
Post by Greg Lewis
Post by Brian Gardner
Post by Brian Gardner
Post by Greg Lewis
I forgot to add that I'm willing to help with build issues for the BSD port, as far as my (like everybode else's) limited free time allows me. Unfortunately, I'm still a noob at BSD internals and can't really help with much apart from that.
/Magnus
An alternative to pushing this code into the JDK 9 mainline is of course to push it to the bsd-port/jdk9 repo (given that the owners of that repo approves), but that seems like a less favourable solution. Having the code in the mainline does not mean that it gets tested automatically, but it means that it will be part of e.g. refactoring, that would otherwise break a downstream patchset.
So, I'm offering two patches here, one that applies to the build system, is nice and clean, and possible to integrate into JDK 9 mainline, if my collegues are convinced that someone is backing up the BSD port. And there's a second patch, which fixes broken C/C++/Java code and results in a product that can at least run "javac HelloWorld", but this is not yet clean enough for integration anywere, at least not the JDK 9 mainline. (I don't know enough of the BSD internals to fix all problems, so there's some "#if 0" code here and there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>
--
Eyes Beyond Web : <http://www.eyesbeyond.com/ <http://www.eyesbeyond.com/>>http://www.eyesbeyond.com <http://www.eyesbeyond.com/> <http://www.eyesbeyond.com/ <http://www.eyesbeyond.com/>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
--
Eyes Beyond Web : http://www.eyesbeyond.com
Greg Lewis
2016-02-13 22:56:35 UTC
Permalink
I'm probably going to look at these piecemeal...
I???m sending those links again, it came through weird on the mailing list
porting build_vm_def.sh from bsd-port/jdk8 repo, to fix NM errors during build
http://brian.timestudybuddy.com/webrev/hotspot__NM/webrev/
This one looks straight forward.

+1
Add SUPPORT_RESERVED_STACK_AREA flag for all BSD's
http://brian.timestudybuddy.com/webrev/hotspot__SUPPORT_RESERVED_STACK_AREA/webrev/
porting getthreadid logic from bsd-port/jdk8. calling syscall(SYS_thr_self) caused pthread_setspecific to be cleared.
http://brian.timestudybuddy.com/webrev/hotspot__os_bsd_cpp__getthreadid/webrev/
adding in servicability agent ported from bsd-port/jdk8
http://brian.timestudybuddy.com/webrev/hotspot__sa/webrev/
adding classlist.bsd that is identical to classlist.linux, in order to compile
http://brian.timestudybuddy.com/webrev/jdk__classlist-bsd/webrev/
This also looks straight forward. There are differences in openjdk8, but
frankly the differences just make it look like they are out of sync, not
that they meaningfully differ.

+1
clean up TLS current thread at end of ::run functions similar to how it's done in openjdk8.
http://brian.timestudybuddy.com/webrev/hotspot__clear_thread_current/webrev/
clear current thread before exiting java_start to avoid warnings from leftover pthread_setspecific data
http://brian.timestudybuddy.com/webrev/hotspot__clear_thread_current_alt/webrev/
Will look at the others as I have time.
Post by Greg Lewis
After giving it some thought, I???ve created an alternate patch for the clear_current_thread issue. I like this solution better because it is isolated to java_start function in os_bsd.cpp, and it makes java_start responsible for cleaning up the current_thread since it also initializes it.
Sounds good! What can I do to help get all the changes up for review?
-- Greg
Hello again Greg and Magnus,
I finished up researching the leftover thread-specific data after 4 destructor iterations issue. It looks like it???s currently functioning on Freebsd the same way it does on Linux, the only difference is that Freebsd output that warning were Linux silently stops after it???s forth try. I looked into how openjdk8 was working and it looks like there were calls to TLS::set_thread(NULL) scattered throughout the code base at the end of some ::run methods. I???ve mimicked that behavior in the necessary spots with the following patch. I can???t help but think there must be a better way to get these Thread???s destructors called, and I tried that in place of making clear_thread_current public and calling it directly, but it resulted in deadlock.
<hotspot__clear_thread_current.patch>
Post by Brian Gardner
Hi Greg and Magnus,
I???ve attached the patches needed to build and compile on Freebsd. I???ve reverted my changes to TLS, and done more debugging there. There appears to be two separate issues. One issue was that the implementation of OS::bad::gettid() was somehow clearing the current thread previously set with pthread_setspecific. I was able to fix this by porting logic from bad-port/jdk8, see hotspot__os_bd_cpp__getthreadid.patch. The second issue seems to be related to certain types of threads never getting their destructor called and therefor not clearing pthread_setspecific and resulting in Thread 803c59000 has exited with leftover thread-specific data after 4 destructor iterations, errors. This one I haven???t tracked down yet and will continue looking into. While I can compile and execute HelloWorld, I???m getting a ton of these benign yet annoying messages from ConcurrentGC and Worker threads. I???ll continue looking into that next week.
Post by Brian Gardner
Hi Greg,
I think it???ll break down into 4 change sets,
NM - I ported some code from bsd-port/jdk8/hotspot/make/bsd/makefiles/build_vm_def.sh that fixes a compile error
SUPPORT_RESERVED_STACK_AREA - define SUPPORT_RESERVED_STACK_AREA for _ALLBSD_SOURCE
Serviceability Agent - ported from bad-port/jdk8, currently compiles but hasn???t been tested
TLS - there is problems with the TLS in jdk9 used for Thread::current(). This caused several issues for me and while the fix was relatively straight forward in using THREAD_LOCAL_DECL completely in place of TLS completely, I???d imagine there was a reason it was implemented in sort of a Hybrid fashion alongside TLS.
https://bugs.openjdk.java.net/browse/JDK-8132510?focusedCommentId=13866505 <https://bugs.openjdk.java.net/browse/JDK-8132510?focusedCommentId=13866505> <https://bugs.openjdk.java.net/browse/JDK-8132510?focusedCommentId=13866505 <https://bugs.openjdk.java.net/browse/JDK-8132510?focusedCommentId=13866505>>
The TL;DR: in some circumstances the JVM can crash if we do not set up an initial TLS. On the other hand, this was for glibc, so maybe this situation does not arise for FreeBSD.
Post by Brian Gardner
It would be great if I could post these as web reviews for others to review. Greg, would getting access to bsd-port/jdk9 allow us to collaborate through web reviews?
Magnus, do you think using bsd-port/jdk9 for this purpose be a step towards getting these basic changes into the jdk9 mainline, or would your colleagues think "if they have bsd-port/jdk9, why bother with integrating them into the jdk9 mainline????
I think putting these changes in bsd-port/jdk9 is very reasonable, and I do not believe it will in any way hinder their acceptance into jdk9 mainline. The only thing to be careful about there, though, is that all contributors have signed the OCA (Oracle contributor agreement). Mixing in "legally bad" code can present a real problem for adoption into mainline.
/Magnus
Post by Brian Gardner
Brian Gardner
Post by Greg Lewis
I???m interested in helping. I ported openjdk6 to freebsd and also helped out with openjdk8.
Brian Gardner
I'd love to see as much of these changes get into the jdk9 mainline. My time
is really limited for the next couple of weeks though. If it would help you
or Magnus to use the bsd-port repo to stage changes then that would be
great too. Let me do a merge to make sure it is up to date with mainline.
Notionally we'd have to do a vote to get you both access I think? But I
can shepherd changes in if that will help with sharing them.
FWIW, in terms of taking responsibility, I've been regularly updating the
repos for jdk8 and jdk7 for a couple of years. I'm happy to keep jdk9
building if that is what is being looked for there and also port more of
the BSD changes for jdk8 as appropriate.
- Greg
Hi,
[TL;DR: I'm offering patches to compile JDK 9 on FreeBSD, but it's not clear where to put them, or how.]
I'm working at Oracle on the OpenJDK build team and is responsible for large parts of the build system of OpenJDK. Lately, I've been playing around with FreeBSD (and other BSDs) in my free time, and I've written a patch that will add build system support for FreeBSD, OpenBSD and NetBSD in JDK 9 (tracked in <https://bugs.openjdk.java.net/browse/JDK-8147795 <https://bugs.openjdk.java.net/browse/JDK-8147795>>https://bugs.openjdk.java.net/browse/JDK-8147795 <https://bugs.openjdk.java.net/browse/JDK-8147795><https://bugs.openjdk.java.net/browse/JDK-8147795 <https://bugs.openjdk.java.net/browse/JDK-8147795>>).
I started writing this when I realized that the jdk9 branch in the OpenJDK bsd-port repository did not contain any BSD-specific changes at all, and the old JDK 8 changes will not readily be portable, due to major changes in the build system between JDK 8 and JDK 9.
I thought it would be a no-brainer to integrate these changes into the JDK 9 mainline, so they would be in place for whenever you guys would start to attack porting the code base. However, some of my collegues thought otherwise. The end result, I think, is that they wanted to see someone (not necessarily a company, the FreeBSD organisation for instance seemed to be okay), to step forward and say "we take responsibility for the BSD port", and give some kind of commitment to actually use these build changes in producing a viable port. You can read the mail conversation here: <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html>>http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html> <http://mail.openjdk.java.net/pipermail/build-dev/2016-January/016421.html <http://mail.openjdk.java.net
/pipermail/build-dev/2016-January/016421.html>>
Post by Greg Lewis
Post by Brian Gardner
Post by Brian Gardner
Post by Greg Lewis
I forgot to add that I'm willing to help with build issues for the BSD port, as far as my (like everybode else's) limited free time allows me. Unfortunately, I'm still a noob at BSD internals and can't really help with much apart from that.
/Magnus
An alternative to pushing this code into the JDK 9 mainline is of course to push it to the bsd-port/jdk9 repo (given that the owners of that repo approves), but that seems like a less favourable solution. Having the code in the mainline does not mean that it gets tested automatically, but it means that it will be part of e.g. refactoring, that would otherwise break a downstream patchset.
So, I'm offering two patches here, one that applies to the build system, is nice and clean, and possible to integrate into JDK 9 mainline, if my collegues are convinced that someone is backing up the BSD port. And there's a second patch, which fixes broken C/C++/Java code and results in a product that can at least run "javac HelloWorld", but this is not yet clean enough for integration anywere, at least not the JDK 9 mainline. (I don't know enough of the BSD internals to fix all problems, so there's some "#if 0" code here and there.)
/Magnus
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>
--
Eyes Beyond Web : <http://www.eyesbeyond.com/ <http://www.eyesbeyond.com/>>http://www.eyesbeyond.com <http://www.eyesbeyond.com/> <http://www.eyesbeyond.com/ <http://www.eyesbeyond.com/>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java> <https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>>
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-java <https://lists.freebsd.org/mailman/listinfo/freebsd-java>
--
Eyes Beyond Web : http://www.eyesbeyond.com
--
Greg Lewis Email : ***@eyesbeyond.com
Eyes Beyond Web : http://www.eyesbeyond.com
Information Technology FreeBSD : ***@FreeBSD.org
Loading...