List Info

Thread: i386 java binaries causing 100% cpu on amd64




i386 java binaries causing 100% cpu on amd64
user name
2006-02-22 15:24:35
I have an Althlon 64 server running 6.0-rel in amd64 mode. 
I'm trying to 
compile JDK 1.5 on it, and I've gone about it two ways:

* installing the binary package of the native JDK 1.4
created on my i386 
desktop
* installing emulators/linux_base and the Linux JDK 1.4

In both cases, when I run java -version, it does nothing but
takes up 100% 
CPU.  I've stress-tested the system by running an i386
version of the 
misc/chef port, and that runs, so the issue is not with i386
binaries in 
general.

I'm using an Athlon64 CPU.  I have recompiled the kernel
with these options in 
make.conf (although not the world - not that it should make
a difference?): 
CPUTYPE=athlon64, CFLAGS=-O2 -pipe, COPTFLAGS= -O -pipe

It's a custom kernel but the only options I've changed are
SHMMAXPGS=393216, 
SHMSEG=512, SHMMNI=1024, SEMMNI=512, SEMMNS=1024,
SEMMNU=512, SEMMAP=1024 
(for postgres).  All the apparently essential options
(COMPAT_43, 
COMPAT_IA32, COMPAT_LINUX32) are still in the kernel.

linprocfs is mounted so no probs there.

In short, I can't see anything wrong with my setup.  does
anyone have any 
ideas?

Cheers
Ashley
_______________________________________________
freebsd-javafreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to
"freebsd-java-unsubscribefreebsd.org"
i386 java binaries causing 100% cpu on amd64
user name
2006-02-23 07:27:38
Ashley Moran <workashleymoran.me.uk> writes:

> I have an Althlon 64 server running 6.0-rel in amd64
mode.  I'm trying to 
> compile JDK 1.5 on it, and I've gone about it two
ways:
>
> * installing the binary package of the native JDK 1.4
created on my i386 
> desktop
> * installing emulators/linux_base and the Linux JDK 1.4
>
> In both cases, when I run java -version, it does
nothing but takes up 100% 
> CPU.  I've stress-tested the system by running an i386
version of the 
> misc/chef port, and that runs, so the issue is not with
i386 binaries in 
> general.

I had the same problems on amd64.  In my case the problem
was solved
by deinstalling linux_base-8 and installing linux_base-rh-9.
 After
that, the JDK build went fine using linux-sun-jdk-14.

    /David
_______________________________________________
freebsd-javafreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to
"freebsd-java-unsubscribefreebsd.org"
i386 java binaries causing 100% cpu on amd64
user name
2006-02-23 09:57:45
On Wed, 22 Feb 2006, Ashley Moran wrote:
> I have an Althlon 64 server running 6.0-rel in amd64
mode.  I'm trying to
> compile JDK 1.5 on it, and I've gone about it two
ways:
>
> * installing the binary package of the native JDK 1.4
created on my i386
> desktop
> * installing emulators/linux_base and the Linux JDK 1.4
>
> In both cases, when I run java -version, it does
nothing but takes up 100%
> CPU.  I've stress-tested the system by running an i386
version of the
> misc/chef port, and that runs, so the issue is not with
i386 binaries in
> general.

this sounds like the problem I saw where the jdk tries to
execute code
from the data segment, and the amd64 CPU actually honors the
execute
protection (i386 traditionally has no notion of execute
protection).

I think you can use an i386 version of jdk 1.5 to bootstrap,
or
recompile your i386 jdk 1.4 with the patches below.

  > Date: Thu, 16 Feb 2006 22:39:30 +0100
  > From: Arne Juul <Arne.Juuleurope.yahoo-inc.com>
  > To: freebsd-javafreebsd.org
  > Subject: executing data needs mprotect with PROT_EXEC
  >
  > I've been trying to run some FreeBSD4 packages
  > inside a jail on a FreeBSD6 / amd64 box; and I've
  > hit a problem with ports/jdk.
  >
  > A couple of places the VM uses an array of
  > integers, puts code in it, and executes it.
  >
  > This doesn't work on machines where the CPU
  > honors the PROT_EXEC settings; this can be
  > different on different machines (depending on
  > BIOS settings probably).
  >
  > The right fix is to call mprotect() from jdk to allow
  > execution of the memory in question, something like
this:

--- ../../hotspot/src/os_cpu/bsd_i486/vm/os_bsd_i486.cpp    
   Tue Feb 
14 21:12:46 2006
+++ ../../hotspot/src/os_cpu/bsd_i486/vm/os_bsd_i486.cpp    
   Wed Feb 
15 16:30:49 2006
 -561,6
+562,9 
     }
   #else
     static void (*fixcw)(void) = CAST_TO_FN_PTR(void
(*)(void), 
code_template);
+
+  ::mprotect((void *)code_template, sizeof(code_template),
+             PROT_EXEC | PROT_READ | PROT_WRITE);
   #endif

     fixcw();
--- ../../hotspot/src/cpu/i486/vm/vm_version_i486.cpp   Thu
Sep 11 
03:40:14 2003
+++ ../../hotspot/src/cpu/i486/vm/vm_version_i486.cpp   Tue
Feb 14 
23:34:40 2006
 -9,6
+9,8 
   # include "incls/_precompiled.incl"
   # include "incls/_vm_version_i486.cpp.incl"

+#include <sys/types.h>
+#include <sys/mman.h>

   int VM_Version::_cpu;
   int VM_Version::_cpuFeatures;
 -145,6
+147,10 
     ResourceMark rm;
     // Making this stub must be FIRST use of assembler
     CodeBuffer* c = new CodeBuffer(address(stubCode),
sizeof(stubCode));
+
+  ::mprotect((void *)stubCode, sizeof(stubCode),
+             PROT_EXEC | PROT_READ | PROT_WRITE);
+
     VM_Version_StubGenerator g(c);
     getPsrInfo_stub = CAST_TO_FN_PTR(_getPsrInfo_stub_t, 
g.generate_getPsrInfo());


_______________________________________________
freebsd-javafreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to
"freebsd-java-unsubscribefreebsd.org"
i386 java binaries causing 100% cpu on amd64
user name
2006-02-23 11:36:24
On Thursday 23 February 2006 07:27, David Israelsson wrote:
> I had the same problems on amd64.  In my case the
problem was solved
> by deinstalling linux_base-8 and installing
linux_base-rh-9.  After
> that, the JDK build went fine using linux-sun-jdk-14.

Cheers

I've got JDK15 building on the development server now.  Odd
though how my 
Sempron box works fine but the Athlon 64 chokes.

Ashley
_______________________________________________
freebsd-javafreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to
"freebsd-java-unsubscribefreebsd.org"
i386 java binaries causing 100% cpu on amd64
user name
2006-02-23 11:52:18
On Thursday 23 February 2006 09:57, Arne H. Juul wrote:
> this sounds like the problem I saw where the jdk tries
to execute code
> from the data segment, and the amd64 CPU actually
honors the execute
> protection (i386 traditionally has no notion of execute
protection).

Arne

Do you know why this happens?  Is it a bug in the way
(FreeBSD and Linux) i386 
binaries are compiled?


> I think you can use an i386 version of jdk 1.5 to
bootstrap, or
> recompile your i386 jdk 1.4 with the patches below.

I tried that too, which is why I thought it was bizarre. 
Here is my "result 
matrix" for java -version

			Athlon 64	Sempron 64
linux_base		fails		runs
linux_base-rh-9		runs		not tested
FreeBSD/i386 jdk4	fails		fails

The FreeBSD package was actually compiled on 6-STABLE dated
a few weeks after 
6-REL, whereas the two amd64 machines are running 6-RELEASE.
 If that is not 
the issue, it was fubarred from the start.

Ashley
_______________________________________________
freebsd-javafreebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-java
To unsubscribe, send any mail to
"freebsd-java-unsubscribefreebsd.org"
[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )