Skip to content

Fix AIX processor-cache detection using the hostname as the POWER version - #3504

Merged
dbwiddis merged 2 commits into
oshi:masterfrom
dbwiddis:aix-cache-version-fix
Jul 21, 2026
Merged

dbwiddis merged 2 commits into
oshi:masterfrom
dbwiddis:aix-cache-version-fix

Conversation

@dbwiddis

@dbwiddis dbwiddis commented Jul 21, 2026 •

Copy link
Copy Markdown
Member

Summary

AixCentralProcessor.getCachesForModel selected the processor-cache topology from ParseUtil.getFirstIntValue(runNative("uname -n")) — but uname -n is the network hostname, not the processor version. On a POWER8 cfarm host named gcc119, that parses to 119, matches no switch case, and CentralProcessor.getProcessorCaches() returns an empty list.

This reads the POWER generation from prtconf's Processor Version line instead (e.g. PV_8_Compat → 8), via a new testable parsePowerVersion(prtconf) seam.

Validation

Confirmed on the actual AIX box (ssh to cfarm gcc119, an IBM,8284-22A POWER8):

$ uname -n
gcc119                       # getFirstIntValue -> 119 -> no caches (the bug)
$ prtconf | grep Processor
Processor Type: PowerPC_POWER8
Processor Version: PV_8_Compat   # getFirstIntValue -> 8 -> POWER8 caches (the fix)

The new parsePowerVersion test is grounded in that exact prtconf output.

Testing

  • oshi-common full gate green: spotless, checkstyle, install + forbiddenapis, javadoc; clean full-reactor install green.
  • AixCentralProcessorTest passes, including the new testParsePowerVersion.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed processor cache detection on AIX systems using POWER processors.
    • Cache information is now correctly identified from the processor version, preventing empty cache results on supported systems.
  • Documentation
    • Updated the changelog for version 7.4.2.

dbwiddis added 2 commits July 20, 2026 19:57
…ersion

getCachesForModel selected the cache topology from
getFirstIntValue(uname -n) -- but uname -n is the network hostname, so on a
POWER8 box named e.g. "gcc119" it parsed 119, matched no switch case, and
returned an empty cache list. Read the POWER generation from prtconf's
"Processor Version" line instead (e.g. PV_8_Compat -> 8), via a new testable
parsePowerVersion(prtconf) seam. Verified against real prtconf/uname output
from an IBM,8284-22A (POWER8) cfarm host.

CHANGELOG entry to be added when the PR is opened (after #3503 lands).
@coderabbitai

coderabbitai Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: dda974cd-959a-4a36-b3d2-50e8210413e4

📥 Commits

Reviewing files that changed from the base of the PR and between 03a40c0 and c2750cc.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java
  • oshi-common/src/test/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessorTest.java
📜 Recent review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Analyze (java)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2026-04-12T19:22:09.716Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:22:09.716Z
Learning: When reviewing OSHI hardware platform code that uses or implements `CentralProcessor`/`PhysicalProcessor.getEfficiency()`, remember the API’s counterintuitive semantics: a *higher* efficiency-class value indicates *greater performance* (lower efficiency). P-cores/“performance cores” should therefore have higher values (e.g., 1) than E-cores/“efficiency cores” (e.g., 0), as documented in the `CentralProcessor` Javadoc. Do not flag code as incorrect solely because ARM_P_CORES or Intel P-cores are assigned higher efficiency values.

Applied to files:

  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java
📚 Learning: 2026-04-12T19:34:56.879Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3149
File: oshi-common/src/main/java/oshi/hardware/common/platform/mac/MacCentralProcessor.java:159-163
Timestamp: 2026-04-12T19:34:56.879Z
Learning: In OSHI’s Java platform implementations, `PhysicalProcessor.getEfficiency()` / `EfficiencyClass` follow the same convention as Windows `PROCESSOR_RELATIONSHIP.EfficiencyClass`: a *higher* numeric efficiency class value represents *greater performance* and *less efficiency* (typically P-cores higher than E-cores). When reviewing, do not treat cases where P-cores are assigned higher efficiency/class values as a bug—this is intentional cross-platform consistency.

Applied to files:

  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java
📚 Learning: 2026-07-06T19:25:59.225Z
Learnt from: dbwiddis
Repo: oshi/oshi PR: 3432
File: oshi-common/src/main/java/oshi/util/ExceptionUtil.java:26-56
Timestamp: 2026-07-06T19:25:59.225Z
Learning: In this repo’s SLF4J 1.x-compatible logging code, do not flag cases where a logger call uses SLF4J 1.6+ implicit-cause handling—e.g., `log.error("...{}", value, t)` (or similar with a single `{}` placeholder) where `t` is passed as the final/trailing argument. SLF4J will attach `t` as the log event’s cause with the full stack trace; this is equivalent to SLF4J 2.x’s fluent `atLevel(...).setCause(t).log(...)` and is intentionally used to preserve SLF4J 1.x runtime compatibility.

Applied to files:

  • oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java
🔇 Additional comments (3)
oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java (1)

148-167: LGTM!

oshi-common/src/test/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessorTest.java (1)

59-75: LGTM!

CHANGELOG.md (1)

7-7: LGTM!


📝 Walkthrough

Walkthrough

AIX cache-topology detection now parses the POWER generation from prtconf’s Processor Version field instead of the hostname. Unit tests cover POWER8, POWER9, and missing-version cases, and the fix is recorded in the changelog.

Changes

AIX POWER cache detection

Layer / File(s) Summary
Parse POWER version for cache topology
oshi-common/src/main/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessor.java, oshi-common/src/test/java/oshi/hardware/common/platform/unix/aix/AixCentralProcessorTest.java, CHANGELOG.md
getCachesForModel selects cache topology using the parsed Processor Version from prtconf; tests cover POWER8, POWER9, and missing-version input, and the changelog records the fix.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

I’m a rabbit with caches, hopping in tune,
POWER versions now read from prtconf’s moon.
Eight and nine pass tests in a row,
Missing fields safely yield zero.
The changelog nods: “AIX is bright!”

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main AIX cache-detection fix and the POWER-version source change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codecov

codecov Bot commented Jul 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.44%. Comparing base (03a40c0) to head (c2750cc).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #3504      +/-   ##
============================================
+ Coverage     71.82%   76.44%   +4.61%     
  Complexity       76       76              
============================================
  Files           591      591              
  Lines         21695    21695              
  Branches       3611     3611              
============================================
+ Hits          15583    16584    +1001     
+ Misses         4316     3169    -1147     
- Partials       1796     1942     +146     
Flag Coverage Δ
freebsd 32.17% <ø> (+0.01%) ⬆️
linux 36.52% <ø> (-0.01%) ⬇️
macos 37.67% <ø> (-0.05%) ⬇️
openbsd 31.31% <ø> (+<0.01%) ⬆️
solaris 32.76% <ø> (?)
windows 45.66% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dbwiddis
dbwiddis merged commit d4b0ae8 into oshi:master Jul 21, 2026
19 checks passed
@dbwiddis
dbwiddis deleted the aix-cache-version-fix branch July 21, 2026 04:25
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