Repository navigation
snapshot: read /sys/class from the root, not the working directory - #480
Merged
Merged
Conversation
cloneContentByClass looked for sys/class/<class> relative to the working directory, so a snapshot taken anywhere but / silently left out every network interface and GPU: ghwc snapshot run from a scratch directory on a host with physical NICs produced a snapshot without /sys/class/net. Every other path the snapshot clones is absolute; this one is now too. Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
rucoder
added a commit
to zededa/ghw
that referenced
this pull request
Oct 27, 2026
No snapshot had several cache instances at one level without kernel IDs, or a cpu_capacity file: the s390x one has caches without IDs, but its only shared level spans every CPU, so merging distinct instances would go unnoticed, and the x86 ones come from kernels that report no capacity there. linux-arm64-nvidia-jetson-agx-orin is a Jetson AGX Orin on NVIDIA's 5.15 kernel. It reports each cluster of four Cortex-A78AE cores as a package, so core IDs repeat across packages but not within one and are kept; every CPU has capacity 1024, a homogeneous part; and no cache has a kernel ID, so the three L3s, one per cluster, are told apart by the CPUs sharing them. It is a full capture, taken from / in EVE's debug container with this branch's ghwc plus the snapshot fixes of jaypipes#480 and jaypipes#481, so it holds the board's network interfaces and the DeviceTree properties ghw reads (the CPU model comes from compatible). The NVMe namespace's IDs and two app UUIDs in /proc/self/mounts are replaced by fake ones; ghwc reads the same information from it as from the unscrubbed capture, and the same CPU information as from the board. TestARMClusterPackagesSnapshot checks the packages, CPU model, cores, core type, frequency and caches on it. Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
rucoder
added a commit
to zededa/ghw
that referenced
this pull request
Oct 27, 2026
cloneContentByClass looked for sys/class/<class> relative to the working directory, so a snapshot taken anywhere but / silently left out every network interface and GPU: ghwc snapshot run from a scratch directory on a host with physical NICs produced a snapshot without /sys/class/net. Every other path the snapshot clones is absolute; this one is now too. Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com> (cherry picked from commit 965ad27, jaypipes#480)
rucoder
added a commit
to zededa/ghw
that referenced
this pull request
Oct 27, 2026
No snapshot had several cache instances at one level without kernel IDs, or a cpu_capacity file: the s390x one has caches without IDs, but its only shared level spans every CPU, so merging distinct instances would go unnoticed, and the x86 ones come from kernels that report no capacity there. linux-arm64-nvidia-jetson-agx-orin is a Jetson AGX Orin on NVIDIA's 5.15 kernel. It reports each cluster of four Cortex-A78AE cores as a package, so core IDs repeat across packages but not within one and are kept; every CPU has capacity 1024, a homogeneous part; and no cache has a kernel ID, so the three L3s, one per cluster, are told apart by the CPUs sharing them. It is a full capture, taken from / in EVE's debug container with this branch's ghwc plus the snapshot fixes of jaypipes#480 and jaypipes#481, so it holds the board's network interfaces and the DeviceTree properties ghw reads (the CPU model comes from compatible). The NVMe namespace's IDs and two app UUIDs in /proc/self/mounts are replaced by fake ones; ghwc reads the same information from it as from the unscrubbed capture, and the same CPU information as from the board. TestARMClusterPackagesSnapshot checks the packages, CPU model, cores, core type, frequency and caches on it. Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
rucoder
added a commit
to zededa/ghw
that referenced
this pull request
Oct 27, 2026
No snapshot had several cache instances at one level without kernel IDs, or a cpu_capacity file: the s390x one has caches without IDs, but its only shared level spans every CPU, so merging distinct instances would go unnoticed, and the x86 ones come from kernels that report no capacity there. linux-arm64-nvidia-jetson-agx-orin is a Jetson AGX Orin on NVIDIA's 5.15 kernel. It reports each cluster of four Cortex-A78AE cores as a package, so core IDs repeat across packages but not within one and are kept; every CPU has capacity 1024, a homogeneous part; and no cache has a kernel ID, so the three L3s, one per cluster, are told apart by the CPUs sharing them. It is a full capture, taken from / in EVE's debug container with this branch's ghwc plus the snapshot fixes of jaypipes#480 and jaypipes#481, so it holds the board's network interfaces and the DeviceTree properties ghw reads (the CPU model comes from compatible). The NVMe namespace's IDs and two app UUIDs in /proc/self/mounts are replaced by fake ones; ghwc reads the same information from it as from the unscrubbed capture, and the same CPU information as from the board. TestARMClusterPackagesSnapshot checks the packages, CPU model, cores, core type, frequency and caches on it. Signed-off-by: Mikhail Malyshev <mike.malyshev@gmail.com>
Owner
|
@rucoder thanks very much for these two PRs! I'm currently OOO at a small offsite. Will review as soon as I have some free time, but may be Thursday. |
Contributor
Author
@jaypipes have a great time! More PRs are coming soon . You can have the idea by looking at https://github.com/zededa/ghw/ fork and Prs merged into it. |
Contributor
Author
|
@jaypipes hi! can we merge these 2 and I can submit CPU cache and core discovery PRs? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
cloneContentByClasslooks forsys/class/<class>relative to the working directory, not/sys/class/<class>. A snapshot taken anywhere but/therefore silently leaves out every network interface and every GPU (netanddrmgo through it). I hit this runningghwc snapshotfrom a scratch directory on a machine with two physical NICs: the snapshot had no/sys/class/netat all.Every other path the snapshot clones is absolute; this makes this one absolute too.
TestExpectedCloneContentByClassFromAnyDircollects the network and GPU paths once from/and once from a temporary directory, and requires the same result. On main it fails on any host with a physical NIC or a GPU (here:[]against[sys/class/net/eth0 …]), and it is skipped on hosts with neither. With the fix,ghwc snapshotrun from a scratch directory includes/sys/class/net/eth0.