Skip to content

No CPUInfo for all ARM #291

Closed
Closed

Description

@bluecmd

Hi,

There has been changes in the CpuInfo part in the recent past, and e.g. #290 adds some support for some ARM CPUs. However, that's only for v6.

Could we maybe enable parseCPUInfoARM for all ARM versions?

Activity

  1. discordianfish commented on May 12, 2020

    @discordianfish
    Member

    @bluecmd Makes sense, feel free to submit a PR to add all other ARM versions (assuming they have the same cpuinfo format)

  2. bluecmd commented on May 12, 2020

    @bluecmd
    ContributorAuthor

    Well, I can make sure to test it for a v5 ARM - but it seems unlikely to me that the format would be a function of the version of the instruction set. If there are ARM CPUs that have a separate format, likely they need to be handled by some other means than filtering by ARM version.

  3. discordianfish commented on May 12, 2020

    @discordianfish
    Member

    Yeah I think it's reasonable to enable this on all arm versions. If the format should be different, it will just return an error which isn't worse than have a compile error I guess.

  4. bluecmd commented on May 12, 2020

    @bluecmd
    ContributorAuthor

    So, it seems like what you have currently in tree is something quite special, ARM-wise.

    Right now parseCPUInfoARM works for only a format that was used 8 years ago and has since v3.8-rc1 been replaced with a format that looks like this:

    /# cat /proc/cpuinfo 
    processor	: 0
    model name	: ARM926EJ-S rev 5 (v5l)
    BogoMIPS	: 48.00
    Features	: swp half thumb fastmult edsp java 
    CPU implementer	: 0x41
    CPU architecture: 5TEJ
    CPU variant	: 0x0
    CPU part	: 0x926
    CPU revision	: 5
    
    Hardware	: Generic DT based system
    Revision	: 0000
    Serial		: 0000000000000000
    

    Problematic code is here:

    procfs/cpuinfo.go

    Lines 193 to 195 in 7a44272

    if !strings.HasPrefix(firstLine, "Processor") || !strings.Contains(firstLine, ":") {
    return nil, errors.New("invalid cpuinfo file: " + firstLine)
    }

    This "new" format is quite close to the x86 format, FWIW.

    I can help fix this by looking at the kernel version and either error out, or parse the older format. And I will of course improve the tests.

    Thoughts?

  5. discordianfish commented on May 12, 2020

    @discordianfish
    Member

    Uh.. hrm, that's unfortunate. @pgier thoughts?

  6. bluecmd commented on May 12, 2020

    @bluecmd
    ContributorAuthor

    My apologizes, I got the commit wrong - it seems this was changed 8 years ago in this commit. So from v3.8-rc1 and later. I have updated my post above accordingly.

  7. discordianfish commented on May 13, 2020

    @discordianfish
    Member

    It's close but not identical to x86 I assume?

  8. bluecmd commented on May 14, 2020

    @bluecmd
    ContributorAuthor

    Right, looking at x86 you're extracting many x86 specific attributes that ARM does not have, and likewise ARM has some things that x86 does not have - like "CPU architecture".

    Do you wish to re-use this issue, or should we move to a new issue for upgrading the formatting for ARM?

  9. discordianfish commented on May 15, 2020

    @discordianfish
    Member

    New issue would make sense I think

  10. bluecmd commented on May 15, 2020

    @bluecmd
    ContributorAuthor

    Done, #294

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions