On 31/07/2019 16:46, Aleksey Shipilev wrote: > On 7/31/19 4:46 PM, Andrew Dinn wrote: >> Well, the failure happened during the build process so I didn't >> (couldn't) debug it. I disabled the assert in supports_cpuflush() in >> order to allow the build to complete and then ran up the resulting JVM >> inside gdb to check what was going on. The problem is that with my patch >> supports_cpuflush() is called from Assembler::clflush() and the latter >> is called from icache_x86.cpp very early during bootstrap (I think this >> is neded to flush the flush routine used to flush the code cache). >> Anyway, the call happens so early that it precedes the call to >> VM_Version::get_processor_features which sets up the _features mask >> tested by the assert. > > I believe you can untie this bootstrapping circularity by relaxing the assert > with > Universe::is_fully_unitialized(). It still gives us window to fail with > SIGILL if the stub is called > early during bootstrap, but that would be something to fix *if* we ever find > ourselves there. Yes indeed, that seems like by far the cleanest solution. The only other alternative is to move the call to VM_Version::initalize earlier in the Universe bootstrap sequence and I doubt anyone wants to risk that.
So, now I have #ifdef _LP64 static bool supports_clflush() { // clflush should always be available on x86_64 // if not we are in real trouble because we rely on it // to flush the code cache. // Unfortunately, Assembler::clflush is currently called as part // of generation of the code cache flush routine. This happens // under Universe::init before the processor features are set // up. Assembler::flush calls this routine to check that clflush // is allowed. So, we give the caller a free pass if Universe init // is still in progress. assert ((!Universe::is_fully_initialized() || (_features & CPU_FLUSH) != 0), "clflush should be available"); return true; } . . . which seems to work ok. I'll post a new webrev when I have handled Brian's comments and also any other feedback you may still have on my last reply. regards, Andrew Dinn ----------- Senior Principal Software Engineer Red Hat UK Ltd Registered in England and Wales under Company Registration No. 03798903 Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander