Repository navigation
soc: apple: show the fabric and DCS clock-generator words in debugfs - #336
joshuaswarren wants to merge 1 commit into
Conversation
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>
|
GREEN on b50e681 Reviewer identity: routed by Main to Sonnet/Claude, model id unverifiable here; implementer model unverified. Source review of the diff plus a comparison with the lab patch I reviewed separately (7851bc5b, GREEN). Not built or booted by me; the PR's Checked at head b50e681 (base integration/aurora 2a76ae3, which is still the branch tip):
Not covered: what the files print on hardware (no boot), and the pre-existing |
scottjones
left a comment
There was a problem hiding this comment.
We read this against b50e681 and it looks right to us. The files are only created for windows that mapped, they are 0400 under debugfs, and the devm action is registered after both ioremaps, so the directory is removed (and readers drained) before the mappings go away. The read is a single 32-bit readl_relaxed at offset 0 of a 0x400 window on both t600x and t602x, the same word the driver already reads at probe, and in the governor or suspend/resume, so we don't see a new SError risk. With CONFIG_DEBUG_FS=n, or if the directory can't be created, the calls fall through to the stubs and debugfs_remove ignores the error pointer.
On how this sits with #337: the base check in debugfs_init relies on base staying NULL when a window is absent. Today that only holds because a missing window makes the probe read an ERR_PTR before we ever get here, so #336 doesn't make anything worse on its own. With #337 in, a missing window returns early, base stays NULL from the kzalloc, and the file is skipped as intended. The two merge cleanly in either order.
Small things, not blocking:
- checkpatch flags three lines over 100 columns (the comment on the show function, the devm_kasprintf line and the debugfs_create_file line) and the commit body is one unwrapped line.
- The devm_kasprintf for the directory name isn't needed, since debugfs copies the name. A plain "apple-pmgr-misc" would do with one instance, or a stack buffer if we want the device name.
We built the object with clang W=1 on arm64 with debugfs on and off, and with #337 merged. We also booted it, with #337, on an M2 Max (J414c, t6021) at integration/aurora 396f2d6. The driver bound to 28e20c000.power-management, and apple-pmgr-misc-28e20c000.power-management/ has fabric_ps and dcs_ps at 0400. Reading four times a second at idle and under CPU, memory and GPU load, they always gave 0x00000555 and 0x00000999 (desired and actual equal). That's what we'd expect with idle_fabric_pstate at its default of 0, where nothing moves the fabric while awake. There was nothing in the kernel log from pmgr-misc, no "invalid resource" line, and no oops or warning.
|
Note 🤖 GPT-6.1 Terra responding on behalf of Joshua Warren The current head is |
|
Note anthropic/claude-sonnet-5-5 responding on behalf of joshuawarren Scott, this PR has your approval at head |
|
Note anthropic/claude-opus-5-5 responding on behalf of joshuawarren Scott, a short follow-up: this is still approved at head |
|
Moved to aurora-silicon/linux#2143 (same commit carried onto aurora-edge; kernel work continues on the aurora-silicon tree). |
[Joshua's agent] Adds one read-only debugfs directory to
apple-pmgr-misc:apple-pmgr-misc-<device>/fabric_psanddcs_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.
Checked: the same change builds on the 7.1.12 lab kernel tree with its flags (object compiled, the strings 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, DCS0x777at idle, unchanged over 20 samples a second). This patch itself has not been booted yet.