Skip to content

drm/amd/pm: defer UCLK DPM on selected Apple Navi GPUs - #61

Closed
edschofield wants to merge 5 commits into
t2linux:mainfrom
edschofield:draft/apple-navi-generalized-uclk
Closed

edschofield wants to merge 5 commits into
t2linux:mainfrom
edschofield:draft/apple-navi-generalized-uclk

Conversation

@edschofield

@edschofield edschofield commented Sep 10, 2026 •

Copy link
Copy Markdown

Some Apple Navi GPUs intermittently fail during startup when UCLK DPM is enabled too early. This draft extends the delayed-UCLK fix from PR #60 to the same three board matches as my AMD v4 patch.

GPU and Apple subsystem Revision
Navi 14 7340/0218 41
Navi 14 7340/0219 Any
Navi 10 731b/021a 40

All matches also require AMD vendor 1002 and Apple subsystem vendor 106b. The patch enables UCLK after display hardware initialization, checks that the firmware accepted it, and refreshes the memory-clock table. It still respects the user's memory-DPM setting and the existing secure Navi 10 exclusion.

This PR includes PR #60, so it can be reviewed against main on its own. If PR #60 merges first, I will rebase this PR. The T2 patch also needs one change that clean AMD does not: patch 6001 uses a fixed feature mask on 0219, so patch 6002 makes its memory-feature bits follow the allowed list. That keeps 6001 from turning UCLK back on too early.

Why the board list is smaller now

The earlier draft also matched 020f and 021b. On 020f, a tester booted the patched kernel and saw the delayed UCLK enable succeed, but the machine then hung after login. Their newer tests suggest that automatic memory-clock policy, rather than every clock change, is involved. That needs a separate investigation; this delayed-enable patch does not fix their board. We have no UCLK-only test for 021b. Neither board receives the workaround in this version.

Testing so far

The earlier T2 candidate improved reported boot results on 0219 from 1/5 to 3/3, and on 021a with the internal display from 2/10 to 10/10. The 0219 and 021a results are for the earlier T2 candidate, not the separate AMD v4 build. My earlier 0218 implementation also passed warm-boot testing. None of these results establishes reliability on every display setup.

The latest edit only removes the 020f and 021b matches; I have checked that the remaining board predicate matches AMD v4. There has been no new hardware boot of this narrowed version yet.

If you test one of the three listed boards, please include the exact GPU and subsystem IDs, PCI revision, kernel version, boot results, and any amdgpu errors. This PR will stay a draft while we collect more results.

This work builds on Atharva Tiwari's delayed-UCLK proposal and Guna's testing. I used Codex / GPT-6 to help prepare the patch and checks.

edschofield and others added 3 commits September 10, 2026 13:13
Add the board-specific initialization workaround for the tested 0218/41
iMac. Keep the existing 0219 patch unchanged.

Assisted-by: LLM
Defer UCLK DPM enablement to avoid timeouts on Apple iMac 1002:7340/106b:0218. Update firmware bit and memory DPM table accordingly.
Include the 0218 fix from PR 60 and add the experimental board matches and T2 0219 memory-policy handling. Hardware validation of the broader scope remains pending.

Assisted-by: LLM
Signed-off-by: Ed Schofield <ed@charmersgroup.com>
@olneyMatt

Copy link
Copy Markdown

My Linux distribution is 7.2.4-1-t2-resolute.

It's a clean install and I haven't changed memory DPM. No workarounds other than trying multiple restarts until it gets to a login prompt.

Symptom is that on boot, the system will hang...usually at roughly the same point but not exactly. Latest hang point shown in attached. (That red dotted line about half way down the image, 2/3 of the way down the screen seems to always feature).

Once booted successfully, I'm not sure graphics performance matches the MacOS but that's subjective.

Any suggestions for the graphics test you'd like me to run after the two warm boots?

Thanks
boothang

@edschofield

edschofield commented Sep 10, 2026 •

Copy link
Copy Markdown
Author

@olneyMatt : Thanks for offering to test this on your machine. You'll need ~30 GB of disk space and about 2 hours (mostly waiting for the kernel to compile).

Your card is a Navi 10, 1002:731b with Apple subsystem 106b:021a, revision 40. Mine is a Navi 14, 1002:7340 / 106b:0218. On my machine the GPU sometimes fails to initialise at boot, which looks a lot like the hang you see. My fix delays memory-clock power management (UCLK DPM) until after the display hardware has been set up; this works on my board but hasn't been tested anywhere else yet. So your testing will be useful!

General approach

I suggest you build the kernel yourself using T2Linux's [T2-Debian-and-Ubuntu-Kernel] scripts. It has a file build.sh that will currently produce the same kernel version you're running, so my patch will be the only difference between the thing you test and your current kernel.

To get the patch in, you need to edit 3 lines in patch_driver.sh. Point the repo at edschofield/linux-t2-patches, point the branch at draft/apple-navi-generalized-uclk, and pin the commit to a4c02762.

To test: I think you said your kernel is hanging intermittently, so please start testing by restarting your current kernel 5 times as a baseline, so we can estimate how often it fails without the patch. Then try 3 boots on the test kernel, running collect.sh (a reporting script, see below) after each. You can also run the graphics test you asked about (glmark2) in a second window.

More detailed steps below.

Step 0: a baseline on your current kernel (10 minutes)

Before changing anything, I'd like to know how bad the problem is right now, so we have something to compare against. So please restart your iMac five times. Each time, note whether it reaches the login screen or hangs. If it hangs, hold the power button, start it again, and count that as a failure. Write down something like "3 out of 5 hung".

Then, whenever you can boot successfully, run this to save a report on your current kernel:

mkdir -p ~/t2-uclk-test
cat > ~/t2-uclk-test/collect.sh <<'EOF'
#!/bin/bash
# Saves a short report about the graphics card after a boot.
# It only reads information. It changes nothing.
sudo -v || exit 1
out=~/t2-uclk-test/report-$(date +%Y%m%d-%H%M%S).txt
gpu=/sys/bus/pci/devices/0000:03:00.0
[ -d "$gpu" ] || gpu=$(readlink -f /sys/class/drm/card0/device)
{
  echo "== date =="; date
  echo; echo "== kernel =="; uname -r
  echo; echo "== distro =="; grep PRETTY_NAME /etc/os-release
  echo; echo "== boot command line =="; cat /proc/cmdline
  echo; echo "== graphics card =="; lspci -nnk -s 03:00.0
  echo; echo "== sysfs path =="; echo "$gpu"
  echo; echo "== displays =="
  for c in /sys/class/drm/card*-*; do
    [ -e "$c/status" ] || continue
    echo "$(basename "$c"): $(cat "$c/status") $(head -n1 "$c/modes" 2>/dev/null)"
  done
  echo; echo "== memory clock levels =="; cat "$gpu/pp_dpm_mclk"
  echo; echo "== core clock levels =="; cat "$gpu/pp_dpm_sclk"
  echo; echo "== power features =="; sudo cat "$gpu/pp_features"
  echo; echo "== amdgpu messages this boot =="
  sudo journalctl -k -b --no-pager | grep -iE 'amdgpu|smu|\[drm\]' | tail -n 150
  echo; echo "== possible GPU errors this boot =="
  sudo journalctl -k -b --no-pager | grep -iE 'ring .*timeout|GPU reset|page fault|VM_L2|SMU.*fail|amdgpu.*(error|failed)' | tail -n 60
} > "$out" 2>&1
echo "Saved: $out"
EOF
chmod +x ~/t2-uclk-test/collect.sh

Now run it:

bash ~/t2-uclk-test/collect.sh

It will ask for your password first, because reading the kernel log needs root, then it should print the name of the file it saved. Keep that file; send it to me with the rest at the end.

Step 1: make the boot menu appear (2 minutes)

You'll need to choose between kernels, so make GRUB stop and ask.

sudo cp /etc/default/grub /etc/default/grub.backup
sudo sed -i '/^GRUB_TIMEOUT_STYLE=/d; /^GRUB_TIMEOUT=/d' /etc/default/grub
printf 'GRUB_TIMEOUT_STYLE=menu\nGRUB_TIMEOUT=10\n' | sudo tee -a /etc/default/grub
grep -E '^GRUB_TIMEOUT' /etc/default/grub
sudo update-grub

The grep should print GRUB_TIMEOUT_STYLE=menu and GRUB_TIMEOUT=10.

Restart once to check that you now get a menu with a ten-second countdown. You can use this to get back to your current kernel later.

Step 2: get the official t2linux build scripts (5 minutes)

We're using the same scripts the t2linux project uses for its own Ubuntu kernels. Run this:

sudo apt update
sudo apt install -y git
cd ~
git clone https://github.com/t2linux/T2-Debian-and-Ubuntu-Kernel
cd ~/T2-Debian-and-Ubuntu-Kernel
grep -n '^KERNEL_VERSION' build.sh

That should print 12:KERNEL_VERSION=7.2.4, matching the 7.2.4-1-t2-resolute you're running now. If it prints a different version, stop and tell me so we can update the instructions.

Step 3: point the scripts at my patch (2 minutes)

Edit two files using these commands:

cd ~/T2-Debian-and-Ubuntu-Kernel
sed -i 's|^T2_PATCHES_GIT_URL=.*|T2_PATCHES_GIT_URL=https://github.com/edschofield/linux-t2-patches.git|' patch_driver.sh
sed -i 's|^T2_PATCHES_BRANCH_NAME=.*|T2_PATCHES_BRANCH_NAME=draft/apple-navi-generalized-uclk|' patch_driver.sh
sed -i 's|^T2_PATCHES_COMMIT_HASH=.*|T2_PATCHES_COMMIT_HASH=a4c0276293822712b97d5ea936f68629e6b03b65|' patch_driver.sh
sed -i 's|^PKGREL=.*|PKGREL=1uclk|' build.sh
grep -nE '^T2_PATCHES|^PKGREL' patch_driver.sh build.sh

The last command should print this:

patch_driver.sh:8:T2_PATCHES_GIT_URL=https://github.com/edschofield/linux-t2-patches.git
patch_driver.sh:9:T2_PATCHES_BRANCH_NAME=draft/apple-navi-generalized-uclk
patch_driver.sh:10:T2_PATCHES_COMMIT_HASH=a4c0276293822712b97d5ea936f68629e6b03b65
build.sh:13:PKGREL=1uclk

The line numbers might differ, but the text after the = signs should be the same.

The first three lines take the patches from my branch, which is the full t2linux patch set plus the one file under test, 6002-drm-amd-pm-defer-UCLK-DPM-on-Apple-Navi.patch. The fourth is a safety net (instead of replacing your kernel).

Step 4: build it (about an hour of waiting)

df -h /
sudo mkdir -p /tmp/artifacts
cd ~/T2-Debian-and-Ubuntu-Kernel
sudo ./build.sh 2>&1 | tee ~/t2-uclk-test/build.log

Check df -h / shows at least 30 GB available before you start.

The build downloads the kernel source, installs compilers, applies the patches, and compiles. Expect a lot of scrolling output and somewhere between 40 and 90 minutes. You can use the machine meanwhile, though it'll be slow and the fans will be loud.

When it finishes, confirm that my patch actually went in:

grep -c '6002-drm-amd-pm-defer-UCLK-DPM-on-Apple-Navi' ~/t2-uclk-test/build.log
ls -la /tmp/artifacts/

The grep should print a number of 1 or more. If it prints 0, the patch wasn't applied and the kernel isn't worth testing: send me the build log and stop here.

If the build stops with an error, send me the last 30 lines of ~/t2-uclk-test/build.log. However, note that if you ever run build.sh a second time it will fail immediately, because /root/work will still exist from the
first run, in which case, fix that with sudo rm -rf /root/work and start it again.

Step 5: install the test kernel (5 minutes)

ls /tmp/artifacts/ should show three or four .deb files. Install these two:

sudo apt install /tmp/artifacts/linux-image-7.2.4-1uclk-t2-resolute_*.deb \
                 /tmp/artifacts/linux-headers-7.2.4-1uclk-t2-resolute_*.deb

Don't install the linux-libc-dev file that sits alongside them. That is a system-wide package; we don't want it for this test.

Now check both kernels are present and both are in the boot menu:

ls /boot/vmlinuz-*
grep -c '1uclk' /boot/grub/grub.cfg

You should see your original kernel still there, the new 7.2.4-1uclk-t2-resolute beside it, and a count of 1 or more from the grep. If the count is 0, run sudo update-grub and check again.

Step 6: boot the test kernel

Restart. At the GRUB menu, choose "Advanced options for Ubuntu", then the entry containing 7.2.4-1uclk-t2-resolute. The plain top entry is still your old kernel; either kernel is always one restart away.

If the screen hangs the way it does now, we need to know that. Hold the power button, start again, and pick the same test entry. Please note how many attempts you need for a successful boot.

Once you're at the login screen, confirm you're on the right kernel:

uname -r

It must print 7.2.4-1uclk-t2-resolute. If it prints 7.2.4-1-t2-resolute,
you booted the old kernel; restart and choose again.

Now check that the patched code recognised your card and ran by typing:

sudo dmesg | grep -i 'late UCLK'

On a good boot that should print one line ending in something like Apple: late UCLK DPM enabled, 4 levels. If you see that message, it's proof that the fix is active on your hardware.

If you see one of these things, tell me about it too please:

  • Failed to enable late UCLK DPM: -5 (or another number) means the card was recognised but the firmware refused.
  • If there's no output at all, it means the patch isn't touching your card, so we don't know a lot. Send me the report anyway and I can try to work out why it didn't match.

Then save a report with:

bash ~/t2-uclk-test/collect.sh

Step 7: graphics test

You asked about this, but I'm curious too. On my iMac the memory clock does change level, but only with the screens: 875 MHz while a display is on, 98 MHz once they blank. What I haven't seen is it change under load with the displays left on, which is the case that seems to hang other people's machines, so we can perhaps see that on your machine.

Install the test tools:

sudo apt install -y mesa-utils glmark2 vulkan-tools

Open two terminal windows side by side. In the first, watch the memory clock. The * marks the level in use:

watch -n 1 'cat /sys/bus/pci/devices/0000:03:00.0/pp_dpm_mclk'

If that file doesn't exist, take the right path from the "sysfs path" line in one of your report files and use that instead.

In the second, run the benchmark. It takes a few minutes and prints a score at the end:

glmark2

If glmark2 complains that it can't open a display, you're on Wayland: install glmark2-wayland and run that instead.

While it runs, watch which line carries the * in the first window. Tell me whether it stays on one level or moves between levels, and roughly when it moves. A photo of the screen is fine if that's easier than typing it out.

Then a couple of shorter things: run vkcube for about thirty seconds and close it, and play a YouTube video full screen for two minutes. Watch for freezes, a black screen, or the desktop dropping out.

Finally, save another report and note your glmark2 score:

bash ~/t2-uclk-test/collect.sh

Step 8: two more restarts

Restart twice more into the test kernel, running bash ~/t2-uclk-test/collect.sh after each one. Note how many attempts each restart needed to reach the login screen.

Step 9: send me the results

Bundle the reports and the build log:

cd ~ && tar czf t2-uclk-results.tar.gz t2-uclk-test/
ls -lh ~/t2-uclk-results.tar.gz

Attach t2-uclk-results.tar.gz to a comment here. Along with that, please tell me:

  • how many of your five baseline restarts hung, on the old kernel
  • how many attempts each of the three test boots needed
  • the late UCLK line from dmesg on the test kernel
  • the glmark2 score, and whether the memory clock changed level during it
  • anything that looked wrong on the desktop: flicker, freezes, black screens, ...

Cleaning up

To remove the test kernel completely:

sudo apt remove --purge 'linux-image-7.2.4-1uclk-t2-resolute' \
                        'linux-headers-7.2.4-1uclk-t2-resolute'
sudo update-grub

To put the boot menu back to how it was:

sudo cp /etc/default/grub.backup /etc/default/grub
sudo update-grub

And to reclaim the disk space the build used:

sudo rm -rf /root/work /tmp/artifacts ~/T2-Debian-and-Ubuntu-Kernel

Phew!

The deferred path was silent on success, so a tester could only infer it
from the kernel release name and the build log. Print one info line once
the firmware has confirmed UCLK and the memory-clock table has been
rebuilt, and report the number of levels found.
@edschofield
edschofield force-pushed the draft/apple-navi-generalized-uclk branch from a22effd to a4c0276 Compare September 10, 2026 08:21
@olneyMatt

Copy link
Copy Markdown

Quick question please @edschofield - I'm obviously using the built-in iMac screen (running 3840x2160 sadly!), but I also have two USB-C external displays running over Thunderbolt.

Would you rather I disconnected them for testing? Thanks.

@edschofield

Copy link
Copy Markdown
Author

@olneyMatt:

As a baseline (before patching your kernel), you could try 5 restarts with your two displays connected and then 5 more with them disconnected. It would be worth seeing whether your computer hangs more one way or the other, or whether it makes no difference.

After patching the kernel, please try booting it without the displays connected first. If that boots fine, you could try connecting them too, since that should work the display initialization harder...

@AdityaGarg8

Copy link
Copy Markdown
Member

You can just use the CI instead of torturing your Mac tbh

@edschofield

edschofield commented Sep 10, 2026 •

Copy link
Copy Markdown
Author

@AdityaGarg8 : Oh yes, good idea. So, I guess the flow is ... fork the t2linux kernel repo, make the same three-line change with patch_driver.sh, push, let GitHub Actions build it, and download the finished .deb from the workflow artifacts?

@AdityaGarg8

Copy link
Copy Markdown
Member

@AdityaGarg8 : Oh yes, good idea. So, I guess the flow is ... fork the t2linux kernel repo, make the same three-line change with patch_driver.sh, push, let GitHub Actions build it, and download the finished .deb from the workflow artifacts?

Yes. Also, instead of forking linux t2 patches, you can just add extra patches in the patches folder of this repo.

@edschofield

edschofield commented Sep 10, 2026 •

Copy link
Copy Markdown
Author

@olneyMatt: thanks for your patience! @AdityaGarg8 pointed out a much easier route: let GitHub compile the kernel.

Here's how to do the build on GitHub:

  1. Fork T2-Debian-and-Ubuntu-Kernel, then create a branch called uclk-test from Mainline in your fork.

  2. On that branch, edit patch_driver.sh using the pencil button. Replace its three T2_PATCHES_... lines with:

    T2_PATCHES_GIT_URL=https://github.com/edschofield/linux-t2-patches.git
    T2_PATCHES_BRANCH_NAME=draft/apple-navi-generalized-uclk
    T2_PATCHES_COMMIT_HASH=a4c0276293822712b97d5ea936f68629e6b03b65

Also edit build.sh: leave KERNEL_VERSION=7.2.4 and change PKGREL=1 to PKGREL=1uclk. Commit both edits to uclk-test. The different release name lets you keep your working kernel installed.
3. Open your fork's Actions tab and enable workflows if asked. Select Build Kernel Package → Run workflow, choosing uclk-test. If the edits already started a run, use the one containing both edits. After it finishes successfully, download linux-T2-7.2.4-1uclk-resolute from the run's Artifacts section.

Extract the ZIP, open a terminal in that folder, and install just these two packages:

sudo apt install ./linux-image-7.2.4-1uclk-t2-resolute_*.deb \
                 ./linux-headers-7.2.4-1uclk-t2-resolute_*.deb

Keep your old kernel. Check that both appear in GRUB, then restart and choose 7.2.4-1uclk-t2-resolute under Advanced options. Installation can change the default, so choose the entry explicitly. Once booted, check:

uname -r
sudo dmesg | grep -i 'late UCLK'
cat /sys/bus/pci/devices/0000:03:00.0/pp_dpm_mclk

Please paste those results here, try glmark2, and tell me whether you see flicker or freezes. Start without the external displays; if that works, try them connected. Three warm boots in total would be useful, noting any failed attempts and the display setup. If it hangs, return to your old kernel and let me know.

For anyone using Noble who wants to test this, use the same workflow as above but substitute noble for resolute in the package names.

@olneyMatt

Copy link
Copy Markdown

Thanks for these @edschofield - have started the process. Will revert when complete.

@olneyMatt

olneyMatt commented Sep 11, 2026 •

Copy link
Copy Markdown

Extract the ZIP, open a terminal in that folder, and install just these two packages:

sudo apt install ./linux-image-7.2.4-1uclk-t2-resolute_*.deb \
                 ./linux-headers-7.2.4-1uclk-t2-resolute_*.deb

FYI, don't think it's a problem, but this command came back with:

Notice: Download is performed unsandboxed as root as file '/home/matt/Downloads/linux-T2-7.2.4-1uclk-resolute/linux-headers-7.2.4-1uclk-t2-resolute_7.2.4-1uclk_amd64.deb' couldn't be accessed by user '_apt'. - pkgAcquire::Run (13: Permission denied)

The uclk kernel is showing up in grub so I think all's ok?

@olneyMatt

olneyMatt commented Sep 11, 2026 •

Copy link
Copy Markdown

Hi @edschofield,

Finished testing.
t2-uclk-results.tar.gz

If you look in Testing_diary.txt, you'll get an explanation of what I did, what config each report relates to, screenshots etc.

TL;DR
Before patching:
With both external monitors connected, from 10 boots, 6 hung and 4 succeeded
With just the built-in screen connected, from 10 boots, 8 hung and 2 succeeded

After patching:
With just the built-in screen connected, from 10 boots, 10 succeeded
After connecting the two monitors, from 5 boots, 4 succeeded...BUT on the one that hung, I was distracted and can't be sure I selected the correct kernel from the GRUB menu, so I don't think it's a reliable fail.

glmark2 scores were consistent between kernels. No glitching at any point with either.

Curiously, unplugging the external monitors reduces clock from 750MHz to 98MHz . Replugging, clocks go back up to 750MHz. (glmark2 scores were lower for built-in screen only, maybe because of this?)

Let me know what questions you have....

P.S. glmark2 scores of <4,000 for a Radeon Pro 5700 seem to support my perception that it's not running at full speed? Interested to know your view.

@vivekchauhan

Copy link
Copy Markdown

Hi @edschofield,

Thanks for your effort so far in trying to resolve this issue which users on iMac 2020 and others are facing 🫡

I applied your patch on the kernel used by Omarchy (4.0.3) and now with patched kernel I have not faced screen hangs yet (3 successful attempts 💯 so far which never happened earlier)

Tested this on Omarchy / Arch Linux on a 2020 27-inch iMac.

Hardware

  • GPU: Radeon Pro 5300 / Navi 14
  • PCI device: 1002:7340
  • Apple subsystem: 106b:0219
  • Revision: 47

Kernels

Stock:

7.2.4-arch1-Watanare-T2-1-t2

Experimental:

7.2.4-arch1-Watanare-T2-1-t2-uclk

The experimental Arch kernel was built from linux-t2-arch against patch commit:

a4c0276293822712b97d5ea936f68629e6b03b65

Build run:

https://github.com/vivekchauhan/linux-t2-arch/actions/runs/34678345378

Baseline — stock 7.2.4

Five warm boots:

  • Boot 1: hang>
  • Boot 2: hang>
  • Boot 3: hang
  • Boot 4: hang
  • Boot 5: success

Total hangs: 4/5

A failing stock boot shows:

SMU: No response msg_reg: 6 resp_reg: 0
Failed to enable requested dpm features!
Failed to setup smc hw!
hw_init of IP block <smu> failed -62
amdgpu_device_ip_init failed
Fatal error during GPU init

Experimental delayed-UCLK kernel

Boot attempts:

All are success

  • Test boot 1: 1
  • Test boot 2: 2
  • Test boot 3: 3

I've attached t2-uclk-results-omarchy.tar.gz containing the boot reports and relevant kernel logs.

t2-uclk-results-omarchy.tar.gz

Happy to help with any further details.

@3v3nFloW

Copy link
Copy Markdown

@edschofield — Test build: linux-T2-7.2.4-1uclk-noble from a fork of T2-Debian-and-Ubuntu-Kernel at the 7.2.4 commit
(1ff4456), patch_driver.sh pointed at edschofield/linux-t2-patches branch draft/apple-navi-generalized-uclk,
commit a4c0276. Installed next to 7.2.4-1-t2-noble (correction to my 10.09 comment: the working kernel here is
7.2.4-1, not 7.2.3-1). Board 1002:7340 / 106b:020f, rev 0x40, Linux Mint 22.3 Xfce, internal panel only, no dock.

Setup for the test: my two userspace workarounds skip themselves when uname -r contains uclk, so this boot ran
with pp_features untouched, power_dpm_force_performance_level=auto and X starting directly with acceleration.
Cmdline unchanged: pm_async=off intel_iommu=on iommu=pt amdgpu.ppfeaturemask=0xfff73fff.

Result: hang on the first boot, ~40 s after the greeter appeared. Black screen right after entering the password,
fans ramped up, no ssh (network was up before), machine had to be power-cycled. No further kernel or syslog lines
were written after the hang, which matches the SMU wedge I saw before: nothing is logged, the GPU just stops.

What the log shows (kern.log of that boot, 15:04:09–15:04:15):

amdgpu 0000:03:00.0: initializing kernel modesetting (NAVI14 0x1002:0x7340 0x106B:0x020F 0x40).
amdgpu 0000:03:00.0: smu driver if version = 0x00000038, smu fw if version = 0x00000038, smu fw version = 0x00352500 (53.37.0)
amdgpu 0000:03:00.0: SMU is initialized successfully!
amdgpu 0000:03:00.0: [drm] Display Core v3.2.384 initialized on DCN 2.0
amdgpu 0000:03:00.0: Fence fallback timer expired on ring sdma0   (twice; also present on every boot of the unpatched kernel)
amdgpu 0000:03:00.0: Apple: late UCLK DPM enabled, 4 levels
[drm] Initialized amdgpu 3.64.0 for 0000:03:00.0 on minor 2

So the patch did fire (late UCLK DPM enabled, 4 levels), init completed, the greeter rendered with acceleration
(slick-greeter, window scale 2), and the machine wedged when the user session started. That is the same point at which
the unpatched kernel hangs unless DPM_UCLK (feature bit 3) is masked off before any 3D load. I could not capture
pp_dpm_mclk before the hang because ssh never came up in time; on my board the first UCLK switch after login is
the trigger, so the enable point after display init appears to be too early here, or the switch itself wedges the SMU
regardless of when DPM is enabled.

Side notes, both unrelated to the patch: Xorg aborted twice (SIGABRT) while lightdm started before amdgpu finished
probing, then came up on the third try — the unpatched kernel does the same. And this build was made with the CI
route you described (fork + Actions), which worked fine; happy to rebuild if you want to try another enable point or
add a debug print of the UCLK level before/after late UCLK DPM enabled.

I'm back on 7.2.4-1-t2-noble with the pp_features workaround. If a variant is worth trying (e.g. enabling UCLK
only after the first user-space GL context, or keeping UCLK pinned to the level it has at enable time), I'm happy to
test it on this board — just ping me here.

@3v3nFloW

Copy link
Copy Markdown

@edschofield — a follow-up that may help: Following up on my negative result above, I tried the opposite of "let UCLK switch freely": enable UCLK DPM as usual,
but perform exactly one memory-clock transition while the GPU is idle and then never switch again. This runs on the
stock t2 kernel 7.2.4-1-t2-noble (no patch), purely from userspace:

echo low    > /sys/bus/pci/devices/0000:03:00.0/power_dpm_force_performance_level   # everything at minimum, X still without acceleration
echo manual > /sys/bus/pci/devices/0000:03:00.0/power_dpm_force_performance_level
echo 3      > /sys/bus/pci/devices/0000:03:00.0/pp_dpm_mclk                          # allow only the top UCLK level (750 MHz)
# then restart X with acceleration; pp_features left untouched, DPM_UCLK stays enabled

The transition 95 → 736/750 MHz happened at idle within a second, and after that pp_dpm_mclk reports 2: 736Mhz * 3: 750Mhz *
for the rest of the session. The same boot sequence that hangs with free UCLK switching (and hung with the #61 kernel this
afternoon) has now survived two warm boots with the full workload that used to kill the SMU within 30 s:

Boot Load Duration at 736/750 MHz GFXCLK Power / temp (max) amdgpu errors
1 (15:31) glmark2 ×2 (75 s each), WebGL DICOM volume rendering ~2 min 1672 samples (28 min), no switch up to 1450 MHz, 99 % busy 50 W / 91 °C 0
2 (16:03, warm) glmark2 (75 s), WebGL volume rendering ~3 min 396 samples (7 min), no switch up to 1450 MHz, 99 % busy 51 W / 86 °C 0

Sampled once per second from sysfs (pp_dpm_mclk, pp_dpm_sclk, power1_average, temp1_input, gpu_busy_percent) plus any
new amdgpu dmesg lines, with sync after every line so the log survives a hang. The only new dmesg line in ~35 min of sampling across both boots was
Got zero output on CG_TACH_STATUS reading! when I read the (non-existent) GPU fan tach — unrelated.

So on this board the SMU survives a UCLK transition at idle and is perfectly happy running at the top level under sustained 3D
load; what kills it is a transition under load (or with the display active — I can't separate the two from userspace). That
also explains my earlier observation that masking DPM_UCLK froze the clock at whatever level it happened to be in.

For the kernel side this suggests a much smaller change for 020f than delaying the enable: after UCLK DPM is enabled, set the
hard-min UCLK to the top level (the same path DC uses when p-state switching is unsupported for a display config, i.e.
display_disable_memory_clock_switch / smu_v11_0_set_hard_freq_limited_range(SMU_UCLK, max, 0)), effectively "no UCLK switching
while the eDP is up". My guess is that the DCN ↔ SMU p-state handshake fails with this Apple panel, so the SMU waits forever on the
first switch; pinning simply avoids the handshake. Cost is idle power (17 W instead of 6 W at 95 MHz on my readings), which is
what macOS seems to accept as well.

If you'd like to try that as a patch variant, I'm happy to test it on this board — just ping me here. Meanwhile I'll keep the
userspace pin as my daily workaround since it also gives back the full memory bandwidth.

@3v3nFloW

Copy link
Copy Markdown

Two more data points on the UCLK pin, same board (MacBookPro16,1 / Navi 14 020f, stock 7.2.4-1-t2-noble), measured today:

1. Every fixed UCLK level is stable — only the transition matters.

I switched pp_dpm_mclk at idle (manual throughout) 750 → 496 → 95 and back to 496, then ran the usual load at each level (glmark2 75 s, plus WebGL DICOM volume rendering in a Chromium app):

pp_dpm_mclk idle power glmark2 SMU
3 = 750 MHz 17 W ~6200 FPS ok (my previous report)
1 = 496 MHz 13 W ~4630 FPS ok — 2 warm boots, glmark2 + volume rendering, 0 amdgpu errors, log shows 496 throughout
0 = 95 MHz 6 W ~730 FPS ok under glmark2 (GFXCLK still reached 1450 MHz, GPU just starves on bandwidth)

So the SMU is fine at any single level under sustained 3D load; what wedges it is a UCLK transition while the GPU is busy. I've made level 1 my default now (less idle heat, 75 % of the bandwidth). One thing I noticed in the 1 Hz sysfs log: when X restarts with acceleration (modeset), pp_dpm_mclk briefly reports 2: 736Mhz * 3: 750Mhz * for ~6 s despite manual/level 1, then returns to 496 — the driver raises UCLK for the modeset regardless of the forced level. That transition happens with the GPU idle, and it has survived every boot so far.

2. Warning for anyone using the userspace pin: TLP silently undoes it.

Two hard hangs today (screen black, machine gone from the network) turned out not to be the new level at all. TLP's defaults are RADEON_DPM_PERF_LEVEL_ON_AC=auto / _ON_BAT=auto, and its udev rule runs tlp auto on every power_supply change event — so unplugging the charger (or a battery status change) wrote auto into power_dpm_force_performance_level, the pin was gone, and opening the next 3D workload killed the SMU. Reproduced deterministically with sudo tlp bat: the box was dead within seconds — notably even at idle, so manual → auto itself (handing DPM back to the SMU) is already fatal here, not just a switch under load. Fix is an override in /etc/tlp.d/:

RADEON_DPM_PERF_LEVEL_ON_AC=
RADEON_DPM_PERF_LEVEL_ON_BAT=

(empty = TLP doesn't touch the GPU). After that tlp ac/tlp bat/tlp start leave the pin alone. Might be worth a line in the wiki next to the workaround, since TLP ships enabled on Mint/Ubuntu.

Kernel-wise this still points the same way as before: on this panel/board combination, disallowing UCLK switching once the eDP is up (hard-min = whatever level) would avoid the hang, and the level itself can be chosen for power rather than forced to max. Still happy to test a patch variant here.

@3v3nFloW

Copy link
Copy Markdown

Follow-up on the UCLK pin, same board (MacBookPro16,1 / Navi 14 020f, stock 7.2.4-1-t2-noble). This one corrects something I wrote yesterday, and comes with a userspace workaround that still needs extensive testing — one board, one afternoon, please treat it as a data point, not a recipe.

A forced UCLK level change does not wedge the SMU — even under full 3D load.

Yesterday I concluded "every fixed level is fine, what wedges the SMU is a UCLK transition while the GPU is busy". That was too broad. Today I switched pp_dpm_mclk from userspace with power_dpm_force_performance_level=manual the whole time, never touching auto:

test switches result
idle, 1 → 0 → 1 (496 ↔ 95 MHz) 11 ok, 13 W ↔ 6 W
during glmark2 at 99 % GPU busy, 1 → 0 → 1 13 ok, 43 W ↔ 25 W, no amdgpu messages
video playback (Plex, VA-API decode on the iGPU) held at level 0 – ok, 7–9 W, no visual artefacts
2 warm reboots, test repeated after each 10 ok

dmesg | grep amdgpu stayed clean throughout (0 errors/timeouts/resets). 1-second logs of mclk/sclk/power/busy for every run are available if useful.

So the distinction seems to be: a UCLK change ordered from userspace via pp_dpm_mclk in manual mode is survived at any load; what kills the board is letting the SMU drive UCLK DPM itself (auto), which on this VBIOS hangs on its first transition after the eDP is up — and, as noted yesterday, anything that writes auto (TLP's defaults did) reproduces the hang immediately.

Workaround I'm now running: a tiny userspace governor. It polls gpu_busy_percent every 2 s, drops to level 0 (95 MHz) after 30 s below 15 %, raises to level 1 (496 MHz) after 4 s above 40 %, minimum 10 s between switches, and only ever writes pp_dpm_mclk — never the perf level. Idle and video sit at ~6–9 W instead of 13 W, 3D gets 75 % of the bandwidth within 4 s.

Caveats, clearly: ~40 switches in total so far, a few hours of uptime, a single machine. Whether hundreds of switches per day over weeks stay clean is exactly what I don't know yet; the governor counts every switch in its log so a first amdgpu error can be tied to it. If anyone with a Navi 10/14 Apple board wants to try, the boot-time pin from the wiki workaround (perf level manual, one fixed pp_dpm_mclk level) is the precondition, and TLP must be told to leave the GPU alone (RADEON_DPM_PERF_LEVEL_ON_AC= / _ON_BAT= empty).

governor script (systemd service, After=your pin unit)
#!/bin/bash
# Radeon memory-clock governor: level 0 (95 MHz) idle/video, level 1 (496 MHz) under 3D load.
# Writes ONLY pp_dpm_mclk 0/1, never power_dpm_force_performance_level.
D=/sys/bus/pci/devices/0000:03:00.0; LOG=/var/log/amdgpu-stage-governor.log
UP=40; UPN=2        # up:   busy >= 40 % in 2 samples (4 s)
DOWN=15; DOWNN=15   # down: busy < 15 % for 15 consecutive samples (30 s)
MINGAP=10; T=2      # >= 10 s between switches, sample every 2 s
log(){ echo "$(date '+%F %T') $*" >> "$LOG"; }
for i in $(seq 1 60); do [ "$(cat $D/power_dpm_force_performance_level)" = manual ] && break; sleep 5; done
[ "$(cat $D/power_dpm_force_performance_level)" = manual ] || { log "perf level not manual, not starting"; exit 1; }
hi=0; lo=0; last=0; n=0
while :; do
  [ "$(cat $D/power_dpm_force_performance_level)" = manual ] || { log "perf level not manual, paused"; sleep 30; continue; }
  cur=$(grep '\*' $D/pp_dpm_mclk | cut -d: -f1); b=$(cat $D/gpu_busy_percent); want=""
  if [ "$b" -ge $UP ]; then hi=$((hi+1)); lo=0; elif [ "$b" -lt $DOWN ]; then lo=$((lo+1)); hi=0; else hi=0; fi
  [ $hi -ge $UPN ] && want=1
  [ $lo -ge $DOWNN ] && want=0
  now=$(date +%s)
  if [ -n "$want" ] && [ "$want" != "$cur" ] && [ $((now-last)) -ge $MINGAP ]; then
    echo "$want" > $D/pp_dpm_mclk && { last=$now; n=$((n+1)); hi=0; lo=0; log "level $cur -> $want (busy=$b %, switch #$n)"; }
  fi
  sleep $T
done
how I tested the switching (detached, hang-proof log)

Run from a transient systemd unit so it survives the SSH session, with sync after every log line so the log survives a hard hang: 5 idle cycles 1→0→1 with 8 s dwell, then glmark2 --run-forever for 90 s with 3 cycles 1→0→1 at 10 s dwell during the run, abort on any new amdgpu error/timeout/reset line in dmesg. Then held level 0 for ~1 min of Plex video, then two warm reboots each followed by a shorter repeat (3 idle + 2 loaded cycles).

For the kernel side this may narrow the search: it's not the memory-clock switch itself (PMFW handles the forced change fine at 99 % busy), it's something in the SMU's own UCLK DPM decision path on this panel/board combination.

@edschofield edschofield changed the title drm/amd/pm: extend delayed UCLK testing to Apple Navi 10/14 drm/amd/pm: defer UCLK DPM on selected Apple Navi GPUs Sep 23, 2026
@edschofield

Copy link
Copy Markdown
Author

Thanks for your testing, @olneyMatt , @vivekchauhan , and @3v3nFloW . I posted this patch last week to AMD. I'll let you know if there's any news...

@olneyMatt

Copy link
Copy Markdown

No problem - thanks for the work. It's testament to your instructions that I managed to fork and patch despite having never done it before!

Patch is still working well. Only issue is if I reboot and forget to select the patched kernel within 10 secs (which is what I suspect happened in my one failed boot).

@iurjscsi1101500

Copy link
Copy Markdown
Collaborator

@edschofield

edschofield commented Sep 25, 2026 •

Copy link
Copy Markdown
Author

@iurjscsi1101500 : This issue is still ongoing. Here's the latest version of the AMD patch, which is the closest to this PR:

https://lore.kernel.org/all/20260916144014.879355-1-ed@aicharmers.com/

The patch is needed and does solve the boot problem. Without it, several Apple devices refuse to boot. With the patch, they boot reliably. So could you please open this PR again pending AMD's upstream decision?

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.

6 participants