RFR: JDK-8202384: Introduce altserver jvm variant with speculative execution disabled

jesper.wilhelmsson at oracle.com jesper.wilhelmsson at oracle.com
Thu Jun 7 18:56:13 UTC 2018

> On 6 Jun 2018, at 06:17, David Holmes <david.holmes at oracle.com> wrote:
> Hi Erik, Jesper,
> On 6/06/2018 2:59 AM, jesper.wilhelmsson at oracle.com <mailto:jesper.wilhelmsson at oracle.com> wrote:
>>> On 5 Jun 2018, at 08:10, David Holmes <david.holmes at oracle.com> wrote:
>>> Sorry to be late to this party ...
>>> On 5/06/2018 6:10 AM, Erik Joelsson wrote:
>>>> New webrev: http://cr.openjdk.java.net/~erikj/8202384/webrev.02/
>>>> Renamed the new jvm variant to "hardened".
>>> As it is a hardened server build I'd prefer if that were somehow reflected in the name. Though really I don't see why this should be restricted this way ... to be honest I don't see hardened as a variant of server vs. client vs. zero etc at all, you should be able to harden any of those.
>>> So IIUC with this change we will:
>>> - always build JDK native code "hardened" (if toolchain supports it)
>>> - only build hotspot "hardened" if requested; and in that case
>>>  - jvm.cfg will list -server and -hardened with server as default
>>> Is that right? I can see that we may choose to always build Oracle JDK this way but it isn't clear to me that its suitable for OpenJDK. Nor why hotspot is selectable but JDK is not. ??
>> Sorry for the lack of information here. There has been a lot of off-list discussions behind this change, I've added the background to the bug now.
>> The short version is that we see a ~25% regression in startup times if the JVM is compiled with the gcc flags to avoid speculative execution. We have not observed any performance regressions due to compiling the rest of the native libraries with these gcc flags, so there doesn't seem to be any reason to have different versions of other libraries.
> So "benevolent dictatorship"?  ;-)
> My main concern is that the updated toolchains that support this have all been produced in a mad rush and quite frankly I expect them to be buggy. I don't think it is hard to enable the builder of OpenJDK to have full choice and control here.

My assumption has been, and still is, that we're not the only ones that will use gcc 7.3.0 with these flags. If there were bugs in the new code they would most likely have been found already. The experience from our own work in this area is that the bugs are unlikely to be crashes due to the new code, but rather weird corner cases where the new code is not inserted where it was needed, leaving speculative execution unblocked in that single case.

That said, I have no strong opinions on what is possible to configure in the build, as long as the Oracle OpenJDK builds comes with two JVM libraries and one copy of all other libraries. But that is of course a slightly different issue as long as it is possible to do.


> Cheers,
> David
>> /Jesper
>>> Sorry.
>>> David
>>> -----
>>>> /Erik
>>>> On 2018-06-04 09:54, jesper.wilhelmsson at oracle.com wrote:
>>>>>> On 4 Jun 2018, at 17:52, Erik Joelsson <erik.joelsson at oracle.com> wrote:
>>>>>> Hello,
>>>>>> On 2018-06-01 14:00, Aleksey Shipilev wrote:
>>>>>>> On 06/01/2018 10:53 PM, Erik Joelsson wrote:
>>>>>>>> This patch defines flags for disabling speculative execution for GCC and Visual Studio and applies
>>>>>>>> them to all binaries except libjvm when available in the compiler. It defines a new jvm feature
>>>>>>>> no-speculative-cti, which is used to control whether to use the flags for libjvm. It also defines a
>>>>>>>> new jvm variant "altserver" which is the same as server, but with this new feature added.
>>>>>>> I think the classic name for such product configuration is "hardened", no?
>>>>>> I don't know. I'm open to suggestions on naming.
>>>>> "hardened" sounds good to me.
>>>>> The change looks good as well.
>>>>> /Jesper
>>>>>> /Erik
>>>>>>> -Aleksey

More information about the hotspot-dev mailing list