Issues with dtrace enabled in OpenJdk 9

David Holmes david.holmes at oracle.com
Thu May 14 03:07:06 UTC 2015


Hi Mahesh,

On 14/05/2015 5:00 AM, Mahesh Pujari wrote:
> Sorry for replying late.
>
> Thanks Staffan, I will be mailing the details as you pointed out.
>
> David, generated/dtracefiles contain just 3 header files, hotspot.h,
> hotspot_jni.h and hs_private.h and if we take hotspot.h file, it
> contains the lines as below
>
> #if _DTRACE_VERSION
>
> #define HOTSPOT_CLASS_INITIALIZATION_CLINIT(arg0, arg1, arg2, arg3, arg4) \
>          __dtrace_hotspot___class__initialization__clinit(arg0, arg1,
> arg2, arg3, arg4)
> #ifndef __sparc
> #define HOTSPOT_CLASS_INITIALIZATION_CLINIT_ENABLED() \
>          __dtraceenabled_hotspot___class__initialization__clinit()
> #else
>
> and they all are defined as extern in hotspot.h as below one such example
> extern void __dtrace_hotspot___class__initialization__clinit(char *,
> uintptr_t, void *, intptr_t, int);
>
> any thoughts on how to solve it, am I missing something.

I think this may just be a conflict between SDT/Dtrace and recent 
changes to the build settings. We enabled  -Wundef to detect undefined 
macro variables, but dtrace explicitly uses:

#if _DTRACE_VERSION

which will fail when _DTRACE_VERSION is not defined. And from what I 
have read you have to manually define it when building - -D 
_DTRACE_VERSION (no need for a specific value). So you need to use 
--with-extra-cxxflags="-D _DTRACE_VERSION" I think. (Not sure why this 
isn't automatically set though - seems reasonable - and some OS do it 
via sdt.h

David
-----


> thanks and regards,
> Mahesh Pujari
>
>
>
> On Tuesday, May 12, 2015 2:47 PM, David Holmes <david.holmes at oracle.com>
> wrote:
>
>
> On 12/05/2015 6:21 PM, Mahesh Pujari wrote:
>  > I think I have mixed up things, like thinking SDT and dtrace4linux as
>  > same, but there are not as pointed out by Staffan.
>  >
>  > So first I build jdk9 with not having SDT headers i.e. not having
>  > systemtap-dev. Build was success as expected.
>  >
>  > Next I did a build having SDT headers in path (i.e. I having installed
>  > systemtap and systemtap-dev), as pointed out by David, dtrace will be
>  > enabled by default, it seems its working as expected, i.e. dtrace was
>  > enabled but the build failed with below error.
>  >
>  > In file included from
>  > /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/utilities/dtrace.hpp:49:0,
>  >                  from
>  >
> /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/utilities/hashtable.inline.hpp:31,
>  >                  from
>  >
> /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/classfile/systemDictionary.hpp:35,
>  >                  from
>  > /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/ci/ciEnv.hpp:30,
>  >                  from
>  > /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/ci/ciUtilities.hpp:28,
>  >                  from
>  > /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/ci/ciNullObject.hpp:30,
>  >                  from
>  > /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/ci/ciConstant.hpp:29,
>  >                  from
>  > /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/ci/ciArray.hpp:29,
>  >                  from
>  > /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/precompiled/precompiled.hpp:33:
>  > ../generated/dtracefiles/hotspot.h:14:5: error: "_DTRACE_VERSION" is not
>  > defined [-Werror=undef]
>
> What do the generated/dtracefiles contain? Does the log show them being
> created correctly?
>
> David
> -----
>
>  > To fix this, I re-configured with
>  > "--with-extra-cflags=-D_DTRACE_VERSION=true" and did "make all
>  > LOG=info", now compilation are success but linking failed (lot of them),
>  > few of the logs as below
>  >
>  > Compiling
> /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/runtime/vm_version.cpp
>  > Linking vm...
>  > classLoadingService.o: In function
>  > `ClassLoadingService::notify_class_unloaded(InstanceKlass*)':
>  >
> /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/services/classLoadingService.cpp:119:
>  > undefined reference to `__dtrace_hotspot___class__unloaded'
>  > classLoadingService.o: In function
>  > `ClassLoadingService::notify_class_loaded(InstanceKlass*, bool)':
>  >
> /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/services/classLoadingService.cpp:144:
>  > undefined reference to `__dtrace_hotspot___class__loaded'
>  > compileBroker.o: In function
>  > `CompileBroker::invoke_compiler_on_method(CompileTask*)':
>  >
> /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/compiler/compileBroker.cpp:1927:
>  > undefined reference to `__dtrace_hotspot___method__compile__begin'
>  >
>  >
>  > Do I need to install some other libraries, what am I missing here.
>  >
>  > thanks and regards,
>  > Mahesh Pujari
>  >
>  >
>  >
>  > On Monday, May 11, 2015 5:08 PM, Staffan Larsen
>  > <staffan.larsen at oracle.com <mailto:staffan.larsen at oracle.com>> wrote:
>  >
>  >
>  > Note that SDT and dtrace4linux are different things. As far as I know,
>  > no one has tried dtrace4linux with Hotspot so you are in uncharted
>  > territories. SDT should work (if installed). Oracle Linux also has an
>  > implementation of Dtrace that I think is different from dtrace4linux.
>  > This is also untested.
>  >
>  > /Staffan
>  >
>  >
>  >
>  >  > On 11 maj 2015, at 13:21, David Holmes <david.holmes at oracle.com
> <mailto:david.holmes at oracle.com>
>  > <mailto:david.holmes at oracle.com <mailto:david.holmes at oracle.com>>> wrote:
>  >  >
>  >  > On 11/05/2015 8:51 PM, Mahesh Pujari wrote:
>  >  >> Thanks for replying back Erik.
>  >  >> I ran as you stated i.e. using "make DTRACE_ENABLED=true" but then I
>  > realized that the configure that I was running would do the same i.e. by
>  > having CFLAGS=-DDTRACE_ENABLED=1.
>  >  >
>  >  > No it isn't the same. The linux/makefiles/dtrace.make looks for
>  > DTRACE_ENABLED and will define additional targets if it is set, as well
>  > as setting -DDTRACE_ENABLED. If you just set the define then you miss
>  > other things.
>  >  >
>  >  > But that aside you don't set DTRACE_ENABLED either. dtrace will be
>  > enabled if the SDT header file is found. If you just do a build without
>  > trying to force dtrace on what does the log show?
>  >  >
>  >  > David
>  >  > -----
>  >  >
>  >  >> When I make (using your approach and passing enable in configure), I
>  > end up with lots and lots of "undefined reference to" errors during
>  > make, seems I am missing something, below are some error from build.logs.
>  >  >> classLoadingService.o: In function
>  > `ClassLoadingService::notify_class_unloaded(InstanceKlass*)':
>  >  >>
>  >
> /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/services/classLoadingService.cpp:119:
>  > undefined reference to `__dtrace_hotspot___class__unloaded'
>  >  >> classLoadingService.o: In function
>  > `ClassLoadingService::notify_class_loaded(InstanceKlass*, bool)':
>  >  >>
>  >
> /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/services/classLoadingService.cpp:144:
>  > undefined reference to `__dtrace_hotspot___class__loaded'
>  >  >> compileBroker.o: In function
>  > `CompileBroker::invoke_compiler_on_method(CompileTask*)':
>  >  >>
>  >
> /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/compiler/compileBroker.cpp:1927:
>  > undefined reference to `__dtrace_hotspot___method__compile__begin'
>  >  >>
>  >
> /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/compiler/compileBroker.cpp:2028:
>  > undefined reference to `__dtrace_hotspot___method__compile__end'
>  >  >>
>  >  >> thanks and regards,Mahesh Pujari
>  >  >>
>  >  >>
>  >  >>
>  >  >>      On Monday, May 11, 2015 3:53 PM, Erik Joelsson
>  > <erik.joelsson at oracle.com <mailto:erik.joelsson at oracle.com>
> <mailto:erik.joelsson at oracle.com <mailto:erik.joelsson at oracle.com>>> wrote:
>
>  >  >>
>  >  >>
>  >  >>  Hello,
>  >  >>
>  >  >> I don't have any experience building with dtrace support, but the
>  >  >> Hotspot makefiles seem to imply that it can be achieved by running:
>  >  >>
>  >  >> make DTRACE_ENABLED=true
>  >  >>
>  >  >> That variable will trigger the appropriate preprocessor flags to be
>  >  >> added at least. See hotspot/make/linux/makefiles/dtrace.make.
>  >  >>
>  >  >> The jdk libraries do not support dtrace AFAIK.
>  >  >>
>  >  >> /Erik
>  >  >>
>  >  >> On 2015-05-11 11:47, Mahesh Pujari wrote:
>  >  >>> Hi all,
>  >  >>> I am trying make OpenJdk 9 with dtrace enabled, on my Ubuntu
>  > machine (installed with https://github.com/dtrace4linux/linux), with
>  > configuration as below (and I am noob).
>  >  >>> ./configure --enable-option-checking=fatal
>  > --with-debug-level=slowdebug --with-target-bits=64
>  > --disable-zip-debug-info --with-boot-jdk=/mnt/ubuntu/setup/jdk1.8.0
>  > CFLAGS=-DDTRACE_ENABLED=1 --with-extra-cflags=-D_DTRACE_VERSION=1
>  >  >>>
>  >  >>> Below is my system info (using uname -a)Linux PHP0045
>  > 3.13.0-45-generic #74-Ubuntu SMP Tue Jan 13 19:36:28 UTC 2015 x86_64
>  > x86_64 x86_64 GNU/Linux
>  >  >>>
>  >  >>> When I do "make all", I end up in error as below...
>  >  >>> ...
>  >  >>> vmThread.o: In function `VMOperationQueue::add(VM_Operation*)':
>  >  >>> /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/runtime/vmThread.cpp:156:
>  > undefined reference to `__dtrace_hotspot___vmops__request'
>  >  >>> vmThread.o: In function
> `VMThread::evaluate_operation(VM_Operation*)':
>  >  >>> /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/runtime/vmThread.cpp:354:
>  > undefined reference to `__dtrace_hotspot___vmops__begin'
>  >  >>> /mnt/ubuntu/dev/jdk9/hotspot/src/share/vm/runtime/vmThread.cpp:374:
>  > undefined reference to `__dtrace_hotspot___vmops__end'......
>  >  >>>
>  >  >>> Can some one direct me about what I might be missing. Can we
>  > actually build dtrace with enabled on Ubuntu, if not what other way I
>  > can do tracing (may be using systemtap, any pointers please). Am I on
>  > right track? (please direct).
>  >  >>>
>  >  >>>
>  >  >>> thanks and regards,Mahesh Pujari
>  >  >>
>  >  >>
>  >  >>
>  >  >>
>  >  >>
>  >
>  >
>
>



More information about the build-dev mailing list