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

Processor Identifier and Architecture parse errors on Raspberry Pi #1316

Closed
lomon opened this issue Aug 7, 2020 · 7 comments · Fixed by #1317
Closed

Processor Identifier and Architecture parse errors on Raspberry Pi #1316

lomon opened this issue Aug 7, 2020 · 7 comments · Fixed by #1317
Labels
compatibility Extending OSHI compatibility to OSs or versions confirmed bug Confirmed bugs. Highest priority to fix.

Comments

@lomon
Copy link

lomon commented Aug 7, 2020

Hey, first of all thank you for your good work.

Is it possible to get (or maybe add) the hardware architecture?
I need to identify the correct hardware architecture (e.g. Raspberry Pi (ARM) or Intel (x86_64)).

$ uname -m

x86_64 (Intel)
armv7l (Raspberry Pi)

$ arch

x86_64 (Intel i7)
armv7l (Raspberry Pi)

$ dpkg --print-architecture

amd64 (Intel i7)
armhf (Raspberry Pi)

$ lscpu

Architecture: x86_64 (Intel i7)
Architecture: armv7l (Raspberry Pi)

@dbwiddis
Copy link
Member

dbwiddis commented Aug 8, 2020

That information should be available from CentralProcessor.getProcessorIdentifier() which includes the Vendor, whether it's 64-bit, and the chip's microarchitecture. It might be missing catching some information on parsing, particularly on Raspberry Pi, but I'll need your assistance in identifying exactly what's missing and some of your system outputs to fill in those missing pieces.

@lomon
Copy link
Author

lomon commented Aug 8, 2020

getProcessorIdentifier()

Intel64 Family 6 Model 58 Stepping 9
armv7l Family Model 0xd03 Stepping r0x0r0x0r0x0r0x0p4p4p4p4

getMicroarchitecture()

Ivy Bridge (Client)
unknown

getModel()

58
0xd03

getFamily()

6
(empty)

getIdentifier()

Intel64 Family 6 Model 58 Stepping 9
armv7l Family Model 0xd03 Stepping r0x0r0x0r0x0r0x0p4p4p4p4

getName()

Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz
ARMv7 Processor rev 4 (v7l)

getProcessorID()

AFC1FBFF003006A9
4100D03400000000

getStepping()

9
r0x0r0x0r0x0r0x0p4p4p4p4

getVendor()

GenuineIntel
armv7l

getVendorFreq()

2900000000
-1

*Raspberry Pi 3 Model B Rev 1.2: Linux raspberrypi 5.4.51-v7+

So you mean i should parse getProcessorIdentifier() for Intel / arm (...) and use that as an architecture identifier?

@dbwiddis
Copy link
Member

dbwiddis commented Aug 8, 2020

So you mean i should parse ...

Depending on the exact format of the output, you could do so, but most of the info seems to be there. Except there are a few parsing bugs due to the different format of the Raspberry Pi's /proc/cpuinfo. If you can give me that output I can try to fix those.

The text in getIdentifier() before the word "Family" looks almost like what you want, "Intel64" and "armv7l" respectively. The getName() string in both cases is "Intel(R) Core(TM) i7-3520M" (with a frequency) and "ARMv7 Processor rev 4 (v7l)", slightly more verbose descriptions of the same thing.

For the Intel processor, you have "GenuineIntel" as the vendor, "Ivy Bridge" as the architecture, and the 64-bit boolean would have been true. Also, System.getProperty("os.arch") would give you the "x86_64" string.

For your ARM processor, there is the model 0xd03 should have parsed to an architecture of Cortex-A53. Unfortunately, the parsing of family seems to have missed it entirely (there should have been a "cpu family" or "CPU architecture" field in /proc/cpuinfo), and although not used in the architecture lookup, the stepping should have been simply "r0x0p4". Not having a family of 8 (and possibly a lowercase arm in the vendor string) missed the Cortex-A53 lookup.

Can you please provide the output of /proc/cpuinfo and the result of System.getProperty("os.arch") on your PI?

@dbwiddis dbwiddis added compatibility Extending OSHI compatibility to OSs or versions confirmed bug Confirmed bugs. Highest priority to fix. labels Aug 8, 2020
@dbwiddis dbwiddis changed the title add hardware architecture Processor Identifier and Architecture parse errors on Raspberry Pi Aug 8, 2020
@lomon
Copy link
Author

lomon commented Aug 8, 2020

System.getProperty("os.arch")

amd64
arm


/proc/cpuinfo

processor : 0
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

processor : 1
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

processor : 2
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

processor : 3
model name : ARMv7 Processor rev 4 (v7l)
BogoMIPS : 38.40
Features : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm crc32
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
CPU part : 0xd03
CPU revision : 4

Hardware : BCM2835
Revision : a02082
Serial : 000000001958bc9f
Model : Raspberry Pi 3 Model B Rev 1.2

@dbwiddis
Copy link
Member

dbwiddis commented Aug 9, 2020

Thanks for that output! It looks like there's a bug parsing CPU architecture: 7 where it assumes a space before the colon, however that one particular line does not have a space. Also, looking at the microarchitecture parsing, it still wouldn't have worked because it assumes 0xd03 is family 8.

Assuming I fix those bugs, would that give you what you need, or is there still a missing feature?

@dbwiddis
Copy link
Member

dbwiddis commented Aug 9, 2020

After the bugfix, the outputs should be:

getProcessorIdentifier()

armv7l Family 7 Model 0xd03 Stepping r0xp4

getMicroarchitecture()

Cortex-A53

getModel()

0xd03

getFamily()

7

getIdentifier()

armv7l Family Model 0xd03 Stepping r0x0p4

getName()

ARMv7 Processor rev 4 (v7l)

getStepping()

r0x0p4

getVendor()

armv7l

@lomon
Copy link
Author

lomon commented Aug 9, 2020

That's fine, thanks. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility Extending OSHI compatibility to OSs or versions confirmed bug Confirmed bugs. Highest priority to fix.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants