Skip to content

feat(hw-health): out-of-band GPU count & SEL fault alerting#3368

Open
hatamzad-nv wants to merge 1 commit into
NVIDIA:mainfrom
hatamzad-nv:feat/301-oob-gpu-detection
Open

feat(hw-health): out-of-band GPU count & SEL fault alerting#3368
hatamzad-nv wants to merge 1 commit into
NVIDIA:mainfrom
hatamzad-nv:feat/301-oob-gpu-detection

Conversation

@hatamzad-nv

Copy link
Copy Markdown

Summary

Implements out-of-band detection of missing GPUs, addressing #301.

Today SKU validation only runs in-band and at limited points in the host
lifecycle, so a GPU that drops off the BMC can go unnoticed. This adds two
complementary out-of-band detections to the hw-health service.

What's included

1. GpuInventoryCollector — GPU count vs. assigned SKU

Periodically counts a host's GPUs out-of-band via Redfish and raises a health
alert when the count is below the machine's assigned SKU total.

Counting is vendor-agnostic — GPUs attach in two forms, so we count both and
take the max:

  • SXM / HGX baseboards (H100 SXM, GB200, GB300, GH200) → one HGX_GPU_*
    chassis per GPU
  • PCIe cards (L40 / L40S, H100 PCIe, A100) → Redfish Processors with
    ProcessorType=GPU

max(chassis, processors) (not sum) because some platforms (e.g. GB200) expose
the same GPUs both ways. There is no BMC-vendor table to maintain — it works
across Dell / Lenovo / Supermicro / NVIDIA regardless of GPU form.

2. GpuFaultEventProcessor — SEL GPU-fault alerting

Watches the Redfish SEL / log stream and raises alerts on GPU-related faults
(NVLink, ECC row-remap, XID, …). Complements the count check by catching GPUs
that are present but faulting.

Both reuse the existing collector → sink → API pipeline, and use distinct
report sources
so inventory and fault alerts don't overwrite each other.

Safety / rollout

  • Disabled by default — opt-in via [collectors.gpu_inventory] (documented
    in config.example.toml).
  • Config validation — enabling it without the Carbide API source or the
    health-report sink is rejected at startup.
  • Machine endpoints only — skips switch / power-shelf endpoints.
  • RBAC — grants the Health role permission for FindSkusByIds (needed to
    resolve the expected count from the SKU).

Testing

  • cargo test -p carbide-health384 pass
    • Unit: SEL keyword/severity matching, shortage → alert decision, config validation
    • Integration (bmc-mock, real Redfish trees): DGX GB300 = 4, GB200 (chassis + processors), Dell R750 = 0
  • Hardware-validated: a Lenovo ThinkSystem SR670 V2 (8× NVIDIA L40) reports
    8 GPUs via ProcessorType=GPU — confirms the processor path on real PCIe hardware.
  • cargo fmt --all -- --check clean.
  • The api-core RBAC change can't compile on macOS (Linux-only TPM dep) → relies on CI.

Known follow-ups (non-blocking)

  • Deployment enablement: ships disabled; Helm/Kustomize enablement left as a
    deliberate decision (see below).
  • PCIe-only platforms: if a BMC ever exposed GPUs only under PCIeDevices
    (neither chassis nor processors) they'd count as 0. Not seen on any current
    fleet platform (Lenovo L40 uses ProcessorType=GPU, confirmed above); a PCIe
    source can be added if such firmware appears.
  • SEL tuning: keyword matching and fault auto-clear to be refined against real
    SEL samples.

Open decision for reviewers

Ships disabled by default for a safe rollout. Should it be enabled in
Helm/Kustomize now, or in a follow-up PR after a canary?

Checklist

  • Tests added and passing (384)
  • cargo fmt --check clean
  • Rebased on current main
  • DCO sign-off (Signed-off-by)
  • clippy-flow — runs on CI (Linux only)

cc @williampnvidia for review

@hatamzad-nv hatamzad-nv requested a review from a team as a code owner July 10, 2026 16:34
@copy-pr-bot

copy-pr-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Summary by CodeRabbit

  • New Features
    • Added optional GPU inventory monitoring to compare expected GPU counts (from assigned SKU) with Redfish/BMC inventory and emit success/shortage outcomes.
    • Added GPU fault detection to generate GPU-fault health alerts from actionable hardware log events.
    • Extended health report sources/probes/classifications for GPU inventory and GPU faults.
  • Bug Fixes
    • GPU shortage alerts now clear when inventory matches expectations, including when zero GPUs are expected; emits a dedicated alert when the expected SKU is missing.
  • Documentation
    • Updated the example config with collectors.gpu_inventory and processors.gpu_fault guidance and prerequisites.
  • Tests
    • Added unit/integration coverage for GPU counting logic and GPU-fault event matching.

Walkthrough

Adds GPU inventory validation using live SKU and BMC data, GPU fault log processing, health-report types, configuration validation, collector discovery wiring, API access, tests, and RBAC permission support.

Changes

GPU health monitoring

Layer / File(s) Summary
Health configuration and reporting contracts
crates/health/src/config.rs, crates/health/src/sink/events.rs, crates/health/src/api_client.rs, crates/api-core/src/auth/internal_rbac_rules.rs, crates/health/example/config.example.toml, crates/health/Cargo.toml
Adds GPU inventory and GPU fault configuration with dependency validation, GPU report identifiers, Forge API methods, Health access to FindSkusByIds, and supporting examples and development dependencies.
GPU inventory collector implementation
crates/health/src/collectors/gpu_inventory.rs, crates/health/src/collectors/mod.rs
Counts GPUs through Redfish chassis and processor views, compares actual counts with SKU expectations, emits health reports, and validates shortage, success, dual-view, and GPU-less scenarios.
Collector discovery and startup wiring
crates/health/src/discovery/context.rs, crates/health/src/discovery/spawn.rs
Registers GPU inventory state and configuration, conditionally creates the API client, tracks collector lifecycle, and starts collection for eligible machine endpoints.
GPU fault event processing
crates/health/src/processor/gpu_events.rs, crates/health/src/processor/mod.rs, crates/health/src/lib.rs
Detects actionable GPU-related log events, accumulates and emits GPU fault alerts, registers the processor, and tests severity and keyword filtering.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DiscoveryLoop
  participant GpuInventoryCollector
  participant ApiClientWrapper
  participant BmcRedfish
  participant HealthReportSink
  DiscoveryLoop->>GpuInventoryCollector: start for enabled machine endpoint
  GpuInventoryCollector->>ApiClientWrapper: resolve assigned SKU
  GpuInventoryCollector->>BmcRedfish: count chassis and processor GPUs
  GpuInventoryCollector->>HealthReportSink: emit shortage or success report
Loading
sequenceDiagram
  participant CollectorEvent
  participant GpuFaultEventProcessor
  participant HealthReportSink
  CollectorEvent->>GpuFaultEventProcessor: deliver log event
  GpuFaultEventProcessor->>GpuFaultEventProcessor: filter severity and GPU keywords
  GpuFaultEventProcessor->>HealthReportSink: emit GPU fault alert
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: out-of-band GPU counting and SEL fault alerting for hw-health.
Description check ✅ Passed The description is clearly aligned with the changeset and accurately explains the new collectors, processor, validation, and rollout details.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@hatamzad-nv hatamzad-nv self-assigned this Jul 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
crates/health/src/processor/gpu_events.rs (2)

92-106: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Cover both alert-target branches.

Current tests always use empty attributes, so the entry_idGPU/{id} mapping is never exercised, and the HostBMC fallback is not asserted. Add focused cases that verify both target values.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/health/src/processor/gpu_events.rs` around lines 92 - 106, The tests
for GPU fault report targets only cover empty attributes and do not verify
either mapping branch. Add focused tests around the GPU fault report processing
logic that provide an entry_id and assert the alert target is formatted as
GPU/{id}, and provide no entry_id and assert the fallback target is HostBMC.

Source: Coding guidelines


168-179: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use repository table-driven test helpers.

These tests repeat process(...) with multiple inputs and manually loop over cases. Prefer value_scenarios! or check_values so each severity and keyword variant is labeled and reported independently.

As per coding guidelines, prefer table-driven tests for operations with multiple input variants.

Also applies to: 191-206

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/health/src/processor/gpu_events.rs` around lines 168 - 179, The tests
in ignores_non_actionable_severity and alerts_on_warning_severity should use the
repository’s table-driven test helpers instead of repeated assertions. Refactor
the severity variants into labeled value_scenarios! or check_values cases so
each input is evaluated and reported independently, preserving the existing
expected alert behavior.

Source: Coding guidelines

crates/health/src/discovery/spawn.rs (1)

387-425: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Missing success log on collector start — inconsistent with sibling blocks.

Every other collector-start block in this function (Discovery, Sensor, Metrics, Firmware, LeakDetector) logs a tracing::info! on the Ok(monitor) branch with endpoint_key and a running total (e.g. lines 107-114, 150-158, 192-199, 368-376, 449-457). The new GPU inventory block silently inserts the collector without any success log, which weakens observability parity when diagnosing rollout/startup behavior for this feature.

♻️ Suggested fix
             Ok(monitor) => {
                 ctx.collectors
                     .insert(CollectorKind::GpuInventory, key.clone().into(), monitor);
+                tracing::info!(
+                    endpoint_key = %key,
+                    total_collectors = ctx.collectors.len(CollectorKind::GpuInventory),
+                    "Started GPU inventory collection for BMC endpoint"
+                );
             }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/health/src/discovery/spawn.rs` around lines 387 - 425, Add a
success-level tracing::info! call in the Ok(monitor) branch of the GPU inventory
Collector::start block, matching the logging pattern used by Discovery, Sensor,
Metrics, Firmware, and LeakDetector, including the endpoint key and current
running collector total after insertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/health/src/collectors/gpu_inventory.rs`:
- Around line 247-269: Align the entity_count semantics in run_iteration: when
handling Expected::SkuMissing, do not report a measured GPU count because
Redfish was not queried. Return entity_count: None, matching the Expected::NoSku
and Expected::Count(0) branches while preserving the missing-SKU alert.

In `@crates/health/src/processor/gpu_events.rs`:
- Around line 29-35: The GPU fault keyword matching in GPU_FAULT_KEYWORDS misses
hyphenated “row-remap” messages. Normalize separators before matching or add
both “row remap” and “row-remap” keywords, then add a regression test covering
an “ECC row-remap” payload.

---

Nitpick comments:
In `@crates/health/src/discovery/spawn.rs`:
- Around line 387-425: Add a success-level tracing::info! call in the
Ok(monitor) branch of the GPU inventory Collector::start block, matching the
logging pattern used by Discovery, Sensor, Metrics, Firmware, and LeakDetector,
including the endpoint key and current running collector total after insertion.

In `@crates/health/src/processor/gpu_events.rs`:
- Around line 92-106: The tests for GPU fault report targets only cover empty
attributes and do not verify either mapping branch. Add focused tests around the
GPU fault report processing logic that provide an entry_id and assert the alert
target is formatted as GPU/{id}, and provide no entry_id and assert the fallback
target is HostBMC.
- Around line 168-179: The tests in ignores_non_actionable_severity and
alerts_on_warning_severity should use the repository’s table-driven test helpers
instead of repeated assertions. Refactor the severity variants into labeled
value_scenarios! or check_values cases so each input is evaluated and reported
independently, preserving the existing expected alert behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: a666367c-e6b2-4bc3-9fbd-aae405311c89

📥 Commits

Reviewing files that changed from the base of the PR and between 6ac0588 and b638905.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • crates/api-core/src/auth/internal_rbac_rules.rs
  • crates/health/Cargo.toml
  • crates/health/example/config.example.toml
  • crates/health/src/api_client.rs
  • crates/health/src/collectors/gpu_inventory.rs
  • crates/health/src/collectors/mod.rs
  • crates/health/src/config.rs
  • crates/health/src/discovery/context.rs
  • crates/health/src/discovery/spawn.rs
  • crates/health/src/lib.rs
  • crates/health/src/processor/gpu_events.rs
  • crates/health/src/processor/mod.rs
  • crates/health/src/sink/events.rs

Comment thread crates/health/src/collectors/gpu_inventory.rs
Comment thread crates/health/src/processor/gpu_events.rs
@hatamzad-nv hatamzad-nv force-pushed the feat/301-oob-gpu-detection branch 2 times, most recently from d78ae6e to 89238f7 Compare July 10, 2026 17:39
@github-actions

Copy link
Copy Markdown

🔍 Container Scan Summary

Service Total Critical High Medium Low Other
boot-artifacts-aarch64 3 0 0 3 0 0
boot-artifacts-x86_64 3 0 0 3 0 0
forge-admin-cli-x86_64 271 13 34 91 7 126
machine-validation-runner 804 40 237 296 36 195
machine_validation 804 40 237 296 36 195
machine_validation-aarch64 804 40 237 296 36 195
nvmetal-carbide 804 40 237 296 36 195
TOTAL 3493 173 982 1281 151 906

Per-CVE detail lives in the per-service grype-* artifacts (JSON + SARIF). Severity counts only — no CVE IDs published here.

@hatamzad-nv hatamzad-nv force-pushed the feat/301-oob-gpu-detection branch from 89238f7 to e4bfbdb Compare July 10, 2026 21:18
@github-actions

Copy link
Copy Markdown

Detect GPUs missing out-of-band (issue NVIDIA#301): a GPU-count-vs-SKU collector and
a SEL GPU-fault processor in hw-health. GPU counting is vendor-agnostic:
max(HGX_GPU_* chassis, ProcessorType=GPU processors) vs the SKU total.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Signed-off-by: Amir Hatamzad <ahatamzad@nvidia.com>
@hatamzad-nv hatamzad-nv force-pushed the feat/301-oob-gpu-detection branch from e4bfbdb to 00f5a2e Compare July 12, 2026 03:10

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/health/src/config.rs`:
- Around line 692-706: Update Config::validate() to reject a zero
GpuInventoryConfig.interval, including the corresponding externally configurable
interval fields noted by the comment, while preserving valid positive durations.
Add a regression test covering a 0s interval and asserting validation fails.

In `@crates/health/src/processor/gpu_events.rs`:
- Around line 46-53: The GpuFaultEventProcessor retains active GPU faults
indefinitely, causing resolved transient faults to remain in later reports.
Update the processing logic around GpuFaultEventProcessor and its event-handling
methods to reconcile or explicitly remove faults when non-actionable/OK events
indicate resolution, while preserving accumulation of still-active faults; add a
regression test verifying that a resolved fault is absent from subsequent
reports.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d0bfb0d9-6769-433a-bbd4-51b2b134d3d9

📥 Commits

Reviewing files that changed from the base of the PR and between e4bfbdb and 00f5a2e.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (13)
  • crates/api-core/src/auth/internal_rbac_rules.rs
  • crates/health/Cargo.toml
  • crates/health/example/config.example.toml
  • crates/health/src/api_client.rs
  • crates/health/src/collectors/gpu_inventory.rs
  • crates/health/src/collectors/mod.rs
  • crates/health/src/config.rs
  • crates/health/src/discovery/context.rs
  • crates/health/src/discovery/spawn.rs
  • crates/health/src/lib.rs
  • crates/health/src/processor/gpu_events.rs
  • crates/health/src/processor/mod.rs
  • crates/health/src/sink/events.rs
✅ Files skipped from review due to trivial changes (1)
  • crates/health/example/config.example.toml
🚧 Files skipped from review as they are similar to previous changes (9)
  • crates/health/src/collectors/mod.rs
  • crates/api-core/src/auth/internal_rbac_rules.rs
  • crates/health/src/processor/mod.rs
  • crates/health/Cargo.toml
  • crates/health/src/api_client.rs
  • crates/health/src/sink/events.rs
  • crates/health/src/collectors/gpu_inventory.rs
  • crates/health/src/discovery/spawn.rs
  • crates/health/src/discovery/context.rs

Comment on lines +692 to +706
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(default)]
pub struct GpuInventoryConfig {
#[serde(with = "humantime_serde")]
pub interval: Duration,
}

impl Default for GpuInventoryConfig {
fn default() -> Self {
Self {
interval: Duration::from_secs(300),
}
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Reject zero GPU inventory intervals.

interval is externally configurable, but Config::validate() does not reject 0s. Because this value drives periodic collection, zero can create a tight loop and flood the BMC/API. Add validation and a regression case.

Suggested validation
+        if let Configurable::Enabled(gpu_inventory) = &self.collectors.gpu_inventory
+            && gpu_inventory.interval.is_zero()
+        {
+            return Err(
+                "collectors.gpu_inventory.interval must be greater than 0".to_string(),
+            );
+        }

Also applies to: 1473-1496, 1792-1811

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/health/src/config.rs` around lines 692 - 706, Update
Config::validate() to reject a zero GpuInventoryConfig.interval, including the
corresponding externally configurable interval fields noted by the comment,
while preserving valid positive durations. Add a regression test covering a 0s
interval and asserting validation fails.

Comment on lines +46 to +53
/// Faults accumulate per machine: each event re-emits that machine's full active
/// fault set, so a burst of distinct faults is preserved in a single report
/// rather than each event overwriting the previous same-source report in the
/// sink. Clearing resolved faults is tracked as a follow-up.
#[derive(Default)]
pub struct GpuFaultEventProcessor {
active: Mutex<HashMap<String, BTreeMap<String, HealthReportAlert>>>,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Do not retain GPU faults forever.

The processor only inserts or replaces entries in active; it never removes them. Since every alert is classified as PreventAllocations, a transient fault remains in every later report and permanently fences the machine. Non-actionable/OK events are ignored, so they cannot clear the state. Add explicit resolution, reconciliation, or TTL handling, plus a regression test for clearing faults.

Also applies to: 133-139, 267-285

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/health/src/processor/gpu_events.rs` around lines 46 - 53, The
GpuFaultEventProcessor retains active GPU faults indefinitely, causing resolved
transient faults to remain in later reports. Update the processing logic around
GpuFaultEventProcessor and its event-handling methods to reconcile or explicitly
remove faults when non-actionable/OK events indicate resolution, while
preserving accumulation of still-active faults; add a regression test verifying
that a resolved fault is absent from subsequent reports.

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