Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify processor detection on Z #3956

Merged
merged 5 commits into from
Jan 17, 2019

Conversation

fjeremic
Copy link
Contributor

@fjeremic fjeremic commented Dec 6, 2018

This PR contains several incremental changes. The end goal was to really print the machine id if the processor was unknown. Previously we extract the machine id and compare against a list of known ids. If no id matches we return 0, and when verbose printout is requested via -Xjit:verbose we print 0 as the machine id.

This is not ideal as we would like to print the machine id even if we did not match it to one of the known ones. We fix this problem here by eliminating the use of TR_S390MachineType enum and just use the machine id as an int32_t. In doing so we identify several other opportunities in the area of processor detection, such as severe code duplication, and responsibility movement to the port library.

Please see each commit for a description of what was changed and why.

@fjeremic
Copy link
Contributor Author

fjeremic commented Dec 6, 2018

Jenkins test sanity zlinux JDK8

runtime/compiler/z/env/J9CPU.cpp Show resolved Hide resolved
{
ret_machine = (TR_S390MachineType)machine;
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the logic that existed prior to this PR which would force us to return 0 as the machine id even though we did extract it.

@@ -415,215 +219,78 @@ CPU::getS390SupportsGuardedStorageFacility()
////////////////////////////////////////////////////////////////////////////////

void
CPU::initializeS390zLinuxProcessorFeatures()
CPU::initializeS390ProcessorFeatures()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

initializeS390zLinuxProcessorFeatures and initializeS390zOSProcessorFeatures are now unified into this function. I suggest to reviewers to compare the before and after for both functions against this new one and convince themselves that they are indeed the same semantically.

{
J9ProcessorDesc *processorDesc = TR::Compiler->target.cpu.TO_PORTLIB_getJ9ProcessorDesc();
J9PortLibrary *privatePortLibrary = TR::Compiler->portLib;

// The following conditionals are dependent on each other and must occur in this order
TR::Compiler->target.cpu.setS390SupportsZ9();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was added as our ALS is z9.

@fjeremic
Copy link
Contributor Author

fjeremic commented Dec 6, 2018

I'll fix the copyright checks when I start addressing reviews so as to not cancel the currently running build.

Copy link
Member

@joransiu joransiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Added a few questions / comments on things not directly related to the proposed changes.

runtime/compiler/env/ProcessorDetection.cpp Show resolved Hide resolved
runtime/compiler/env/ProcessorDetection.cpp Show resolved Hide resolved
runtime/compiler/ras/DebugExt.cpp Show resolved Hide resolved
runtime/compiler/z/env/J9CPU.cpp Show resolved Hide resolved
@fjeremic fjeremic changed the title Unify processor detection on Z WIP: Unify processor detection on Z Dec 10, 2018
@joransiu
Copy link
Member

I'll be out of office with questionable internet access. Perhaps @vijaysun-omr or @gita-omr would be able to take over this PR's review?

I think the only outstanding issue is related to HIGH_GPR support settings.

@fjeremic
Copy link
Contributor Author

Unmarking WIP as everything has been addressed. @vijaysun-omr / @gita-omr are you able to take ownership of this PR as per the above comment by @joransiu?

@fjeremic fjeremic changed the title WIP: Unify processor detection on Z Unify processor detection on Z Dec 21, 2018
@gita-omr gita-omr self-assigned this Dec 21, 2018
@gita-omr
Copy link
Contributor

Assigned to myself. Which tests should we run?

@fjeremic
Copy link
Contributor Author

Assigned to myself. Which tests should we run?

This touches some common files as well. So to be conservative let's run everything:

Jenkins test sanity all JDK8

@fjeremic
Copy link
Contributor Author

fjeremic commented Jan 2, 2019

So it's been a while since this guy has been ready, however I will be away next week and back on the 13th. I would dislike if merging this change causes problems while I'm away and not here to fix anything. Having said that I think it's best to wait until my return before merging this.

I'll continue background testing to make sure nothing has regressed since.

Avoid using an enumerated `TR_S390MachineType` type to represent
machine ids to future proof the JVM running on a more modern processor
for which we do not know the machine id for.

A typical example of this is running an older JVM, say very early Java
8 snapshots of OpenJ9 which did not have z14 support. In such cases the
machine id for z14 would not match any of the existing machine ids in
the codebase at the time and we would start reporting invalid machine
ids in the verbose log ("0" to be precise).

In this change we use the true machine id as parsed from z/OS or Linux
on Z and display the number that is returned as an integer. The actual
machine detection logic relies on the port library which uses STFLE
bits to determine the processor we are executing on. This means
processor detection is unaffected by our changes here.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
In the JIT compiler, similarly to j9sysinfo.c we can assume STFLE bits
are always available since our ALS is z9.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
Both z/OS and Linux should rely on the answers given by the port
library on whether we support particular processor features. The code
was already more or less the same between the two functions, however
there were some redundancies in checking for OS support as the port
library already takes care of this for us in j9sysinfo.c

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
Several of these functions are already implemented in j9sysinfo.c where
they really belong. Deprecate the support in the JIT.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
We cannot use `utsname` on Linux as it simply returns "s390x" in
`info.machine`. Add a comment directly in the code as to why this
restriction is there.

Signed-off-by: Filip Jeremic <fjeremic@ca.ibm.com>
@fjeremic
Copy link
Contributor Author

@joransiu I have removed the "enabling HPRs on Linux on Z 31-bit" commit from this PR. The reason is because I have another rather large change coming to remove TR_GPR64 from the codebase and consolidate handling of 64-bit registers across all Z platforms. Because this is a massive RA change (~2000 lines or so) I don't feel comfortable making this HPR change beforehand. I'd rather bundle it as part of the RA change to make sure nothing gets broken.

This PR should be ready to go. Launching builds on your behalf.

Jenkins test sanity all JDK8

Copy link
Member

@joransiu joransiu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the commits again. LGTM.

@joransiu joransiu merged commit 1c77628 into eclipse-openj9:master Jan 17, 2019
@fjeremic fjeremic deleted the fix-processor-detection-z branch January 17, 2019 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants