Skip to content

sysfs: add InfiniBand device listing and per-device parsing - #854

Open
rafal-szypulka wants to merge 1 commit into
prometheus:masterfrom
rafal-szypulka:master
Open

sysfs: add InfiniBand device listing and per-device parsing#854
rafal-szypulka wants to merge 1 commit into
prometheus:masterfrom
rafal-szypulka:master

Conversation

@rafal-szypulka

Copy link
Copy Markdown

Summary

Add APIs that allow callers to enumerate InfiniBand device names without
reading device attributes or counters, and then parse selected devices
individually:

  • FS.InfiniBandClassDevices() lists device names under
    /sys/class/infiniband without parsing them.
  • FS.InfiniBandDevice(name) parses one selected device.
  • FS.InfiniBandClass() is refactored to compose these APIs while preserving
    its existing behavior.

Motivation

InfiniBandClass() currently parses every device eagerly. This prevents
callers such as node_exporter from applying device filters before sysfs
counter reads occur.

On NVIDIA systems with Fabric Manager-managed or otherwise restricted
Mellanox PFs, merely reading some counters can trigger repeated
ACCESS_REG(0x805) firmware errors. Filtering the returned
InfiniBandClass is too late because the reads have already happened.

Separating enumeration from parsing lets callers:

  1. enumerate device names;
  2. apply their own include/exclude policy;
  3. parse only accepted devices.

The existing InfiniBandClass() API and default behavior remain unchanged.

Tests

  • Verify that device names can be enumerated even when the device directories
    do not contain readable attributes or counters.
  • Verify that InfiniBandDevice(name) returns the same data as the
    corresponding InfiniBandClass() entry.
  • Linux test package cross-compiles successfully.

Related to #823 and prometheus/node_exporter#3434.

Existing work

#839 already proposes the additive InfiniBandDevice(name) API. This change
includes that capability and additionally provides list-only enumeration so
callers do not need to reproduce procfs sysfs path handling outside this
package.

Signed-off-by: Rafal Szypulka <rafal@datacrunch.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant