Skip to content

soc: apple: show the fabric and DCS clock-generator words in debugfs - #2143

Draft
joshuaswarren wants to merge 2 commits into
aurora-silicon:integration/aurorafrom
joshuaswarren:w73/move-pmgr-misc-debugfs
Draft

joshuaswarren wants to merge 2 commits into
aurora-silicon:integration/aurorafrom
joshuaswarren:w73/move-pmgr-misc-debugfs

Conversation

@joshuaswarren

Copy link
Copy Markdown
Contributor

[Joshua's agent]

Carried from omacom/linux-aurora#336 (scottjones approved it there:
omacom/linux-aurora#336 (review); rebased onto
aurora-edge).

Adds one read-only debugfs directory to apple-pmgr-misc:
apple-pmgr-misc-<device>/fabric_ps and dcs_ps, mode 0400, each the whole
clock-generator word of that system device (desired state in bits 3:0, actual
state in bits 7:4).

Why: on the 16-inch M1 Max a PMP request bit moved the DCS word from state 7
to 9 and the fabric word from 3 to 7, and the GPU read bandwidth from 241 to
368 GB/s. Finding that took a separate probe module. With these files any
measurement can record the memory-side state it ran in, next to its timing.

What it does: the show function reads the word through the same mapping the
driver already uses at probe and on resume, and writes nothing. The directory
is removed by a managed action when the device goes away. Without the debugfs,
nothing changes.

State: built on aurora-edge (139dfe6) with clang 18.1.8, ARCH=arm64
LLVM=1, defconfig with CONFIG_APPLE_PMGR_MISC=m; apple-pmgr-misc.o compiles
clean and the strings are present. The same two words, at the same addresses
and through a non-posted mapping, were read on a 16-inch M1 Max by a throwaway
module (fabric 0x333, DCS 0x777 at idle, unchanged over 20 samples a
second). This patch itself has not been booted yet, so it goes in as a draft
until a boot test runs.

Read only: apple-pmgr-misc gets one debugfs directory with the whole clock-generator word of the fabric and DCS system devices (fabric_ps and dcs_ps, mode 0400, the desired state in bits 3:0 and the actual state in bits 7:4). It reads the words through the mapping the driver already uses and writes nothing. A performance measurement can then record the memory-side state it ran in next to its timing.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>

(cherry picked from commit b50e681fb588da49c7fcbf71bd6a7b499600a6c4; include conflict resolved keeping the regmap include aurora-edge added)
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

GREEN on 4718d69
Model: opencode-go/muse-spark-1.3-contributor

Review at exact head 4718d69, branch w73/move-pmgr-misc-debugfs, one commit on asl/aurora-edge 139dfe6.

Code does what the text says: DEFINE_SHOW_ATTRIBUTE read-only show, files created mode 0400, removal via devm managed action, no writes anywhere (36 insertions, apple-pmgr-misc.c only, plus two includes). Init runs only on successful probe. State line honest: built with clang, never booted, draft. No internal names, paths, or tooling in the body. The M1 Max numbers in the Why paragraph are measured claims from the throwaway module, stated as such.

No findings.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks, a read-only view of these two words is handy next to any bandwidth measurement.

  1. The PR targets aurora-edge. Please retarget it to integration/aurora. The patch applies there with small offsets.
  2. Nit: the if (!ret) before apple_pmgr_misc_debugfs_init() tests a value that is always 0 at that point. It can go.

The code is otherwise fine as a 0400 debugfs read with devm cleanup and no writes.

Row on any Mac where apple-pmgr-misc binds (an M1 Pro or M1 Max is fine):

  • Boot, then read fabric_ps and dcs_ps 20 times. They should return words with desired state in bits 3:0 and actual state in bits 7:4, with no SError or oops.
  • Unbind and rebind the driver. The directory should disappear and come back.

With that, this is a small, safe addition.

@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent]

Base branch: Retargeting to integration/aurora now (rebases cleanly; small line offsets only per your note).

Nit: Dropping the useless if (!ret) before apple_pmgr_misc_debugfs_init() in the next push.

Evidence: Move context from q62/q78 inventory: CI was green on the w73 move branch at 4718d69becb1; this is the aurora-silicon reopen (#2143).

Hardware row (M1 Pro/Max class): after boot, for i in $(seq 20); do cat /sys/kernel/debug/apple-pmgr-misc/fabric_ps /sys/kernel/debug/apple-pmgr-misc/dcs_ps; sleep 0.1; done — bits 3:0 desired / 7:4 actual, no SError; then unbind/rebind apple-pmgr-misc and confirm debugfs dir respawns.

@joshuaswarren
joshuaswarren changed the base branch from aurora-edge to integration/aurora November 19, 2026 15:29
ret is always 0 after the DCS init succeeds.

Signed-off-by: Joshua Warren <816217+joshuaswarren@users.noreply.github.com>
@joshuaswarren

Copy link
Copy Markdown
Contributor Author

[Joshua's agent] Follow-up: pushed 6b67ea0 — removed the tautological if (!ret) before apple_pmgr_misc_debugfs_init() (ret is always 0 there). Base is already integration/aurora. M1 Pro/Max debugfs row still on the w7C list.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks, 6b67ea0 and the retarget cover both points. The code looks good to me. What's left is CI on the new head (still queued) and the M1 Pro/Max debugfs read and rebind row. We can run that row on our M1 Pro if that helps.

@RyanTheTide

Copy link
Copy Markdown
Contributor

Row on a 16-inch M1 Pro (J316s, T6000) at this head (6b67ea0), done.

Kernel: integration/aurora 0abc2f3 with this PR merged (plus #2240, #1881 and #1065, which touch other drivers), built with PROVE_LOCKING, DEBUG_LOCKDEP and DEBUG_ATOMIC_SLEEP.

  • The directory is apple-pmgr-misc-28e20c000.power-management/ and holds fabric_ps and dcs_ps, both mode 0400.
  • I read both files 20 times at idle, 20 times under stress-ng --cpu 8 --vm 2 --vm-bytes 2G, and 20 times after one s2idle (RTC wake). That is 120 reads, and every one returned the same words: fabric 0x00000333 (desired 3, actual 3) and DCS 0x00000666 (desired 6, actual 6). On this machine PMP owns both p-states (the boot log says PMP manages fabric and DCS p-states), so it makes sense that neither word moved under load.
  • After the row started, dmesg had no SError, oops, WARN or lockdep report, and debug_locks stayed 1.
  • Unbind/rebind could not be run, and that part of my earlier request does not apply. The driver keeps suppress_bind_attrs = true ("The governor's workers and holders would outlive an unbind."), so /sys/bus/platform/drivers/apple-pmgr-misc/ has no bind or unbind file. The devm action that removes the directory only runs if a later probe step fails. That is fine for a read-only 0400 file.

One observation: bits 11:8 carry the same value as the two documented nibbles here (0x333, 0x666). If that field has a meaning, it could go in the comment above the show function. Otherwise the comment is accurate.

From our side, this is ready to leave draft once CI is green.

Raw reads and log
dirs: /sys/kernel/debug/apple-pmgr-misc-28e20c000.power-management
-r--------. 1 root root 0 dcs_ps
-r--------. 1 root root 0 fabric_ps
bind attrs: unbind=absent bind=absent
s2idle via rtc1: ok=1
idle:   dcs_ps 0x00000666 x20; fabric_ps 0x00000333 x20
load:   dcs_ps 0x00000666 x20; fabric_ps 0x00000333 x20
resume: dcs_ps 0x00000666 x20; fabric_ps 0x00000333 x20
dmesg since row start: 0 SError/oops/WARN/lockdep lines, debug_locks=1

Assisted-by: LLM (Claude:Opus 5.5)

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.

2 participants