ghw
ghw copied to clipboard
Add aarch64 and RISCV64 support
Depend on sysfs instead of /proc/cpuinfo, for content of this file varies across CPU architectures, and doesn't offer unified info tag.
Solves issue #199 .
Signed-off-by: Xingyou Chen [email protected]
Thanks for this PR!
I'm generally in favour of moving from /proc/cpuinfo
to sysfs
to learn about the CPU data.
Let's check this change is covered by the existing tests, and let's add more of them if needed
other than that, at glance looks good! I'll have a deeper look later
/cc @jaypipes because cpuinfo -> sysfs move and support for extra arches
we would need some aarch64 and riscv64 machines to run at least some CI on; unfortunately, code outside CI bitrots pretty fast. I'm not aware of option (not sure gh actions run on arm, IIRC not)
FYI you can run tests on qemu arm64 under github ci. Yes, its slow as hell, and you need to ssh into the VM to run your tests, but seems to work as expected, we run our battery of tests on it, even installing and restarting the vm to test different things and we can say it works.
See a vagrantfile to bring machine X up on qemu-system-aarch64: https://github.com/rancher-sandbox/cOS-toolkit/blob/master/tests/Vagrantfile#L30 and the makefile that brings it up: https://github.com/rancher-sandbox/cOS-toolkit/blob/master/make/Makefile.test#L61
Let me know if you need any help in this area (testing on aarch64 vms on github ci!) :)
we would need some aarch64 and riscv64 machines to run at least some CI on; unfortunately, code outside CI bitrots pretty fast. I'm not aware of option (not sure gh actions run on arm, IIRC not)
FYI you can run tests on qemu arm64 under github ci. Yes, its slow as hell, and you need to ssh into the VM to run your tests, but seems to work as expected, we run our battery of tests on it, even installing and restarting the vm to test different things and we can say it works.
See a vagrantfile to bring machine X up on qemu-system-aarch64: https://github.com/rancher-sandbox/cOS-toolkit/blob/master/tests/Vagrantfile#L30 and the makefile that brings it up: https://github.com/rancher-sandbox/cOS-toolkit/blob/master/make/Makefile.test#L61
Let me know if you need any help in this area (testing on aarch64 vms on github ci!) :)
that would help a lot indeed, thanks! I'll review your suggestion ASAP (time allowing) and we'll try to move this forward. The bright side is the ghw testsuite runs really fast - let's try to keep it this way!
This PR resolves CPU discovery issues on an ARMv7 network switch as well.
I would like to see this PR merged into main.
adding arm support would be very nice indeed. Unfortunately we still need to sort out the CI and the supportability aspects, because we very much want to avoid the feature to break (or to break silently!) when the projects moves on.
Understood.
I'm going to work on adding arm support for some of the data that's usually stored in dmi on x86. I will also work on setting up some arm CI in a fork and I'll circle back to see if that will be suitable for this project too.
FYI @jaypipes merged #333 , this can be closed
nice!