RTD3: every NVPCF ACPI notify (NVDA0820) wakes a runtime-suspended dGPU, so it never stays in D3 on ASUS TUF A15
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 18/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- c, linux
調査の方向性
Start in src/nvidia/arch/nvalloc/unix/src/osapi.c at rm_acpi_nvpcf_notify() and nv_acpi_nvpcf_event(), then trace how os_ref_dynamic_power() and nv_indicate_not_idle() interact with the dynamic-power state machine. The fix needs a state check under the dynamic-power mutex plus a resume-path hook that delivers a latched NVPCF event, so read the suspend/resume path before changing anything. Done means an NVPCF notify no longer resumes an idle GPU and a pending event is delivered on the next real resume; verify by watching runtime_status on the dGPU while no userspace client is running.
索引モデルが issue の本文から書いたものです。
説明
NVIDIA Open GPU Kernel Modules Version
595.99.02 (Ubuntu nvidia-driver-595-open 595.99.02-0ubuntu0.24.04.1, prebuilt linux-modules-nvidia-595-open-7.0.0-43-generic); relevant code unchanged through 620.70.06
Please confirm this issue does not happen with the proprietary driver (of the same version). This issue tracker is only for bugs specific to the open kernel driver.
- I confirm that this does not happen with the proprietary driver package.
Not tested with the proprietary driver. The affected code is in the shared RM (src/nvidia/arch/nvalloc/unix/src/osapi.c), so it is likely affected too. Filing here because the root cause and a possible fix are in code visible in this repo.
Operating System and Version
Ubuntu 24.04.5 LTS, GNOME 46 (Wayland), PRIME on-demand
Kernel Release
Linux 7.0.0-43-generic #43~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC x86_64 (stock Ubuntu HWE kernel)
Please confirm you are running a stable release kernel (e.g. not a -rc). We do not accept bug reports for unreleased kernels.
- I am running on a stable kernel release.
Hardware: GPU
NVIDIA GeForce RTX 3050 Laptop GPU (GA107M), PCI 0000:01:00.0. ASUS TUF Gaming A15 FA506NCG, BIOS FA506NCG.301, Ryzen 7 7445HS + Radeon 740M, ACPI NVDA0820 at _SB_.NPCF
Describe the bug
On battery with nothing using the dGPU, runtime D3 never holds. The dGPU suspends, and about 0.9 s later it is resumed again. It then stays active for about 20 s (the idle timeout), suspends, and is woken again. The cycle repeats about every 23 s, indefinitely.
/sys/bus/pci/devices/0000:01:00.0/power/runtime_active_time was 4979 s out of about 5100 s uptime (≈97 % active). The upstream root port 0000:00:01.1 has runtime_suspended_time = 4 ms, so the GPU never reaches D3cold. nvidia-smi reports about 5.4 W in P8. Whole-system idle draw is about 17 W instead of the expected 8–10 W.
Sampled runtime_status every 100 ms, with no other GPU access:
02:09.04 active
02:25.57 suspending
02:26.32 suspended
02:27.18 resuming <- ~0.9 s after suspend
02:28.25 active
02:48.40 suspending
02:49.15 suspended
02:50.01 resuming
02:51.19 active
03:11.34 suspending
03:12.10 suspended
03:12.96 resuming
...
There are no udev events during the cycle, and no userspace process opens the GPU. bpftrace on rpm_resume for 0000:01:00.0 shows that every wake comes from the NVPCF ACPI notify handler, running on a kacpi_notify kworker:
$ sudo timeout 60 bpftrace -e 'tracepoint:rpm:rpm_resume /str(args->name) == "0000:01:00.0"/ { @[comm, kstack(10)] = count(); }'
@[kworker/0:1,
perf_trace_rpm_internal+16
rpm_resume+961
__pm_runtime_resume+78
pci_device_shutdown+35 # symbolization artifact, real caller is a pm_runtime_get in nv_indicate_not_idle
nv_indicate_not_idle+46
os_ref_dynamic_power+301
rm_acpi_nvpcf_notify+115
nv_acpi_nvpcf_event+64
acpi_ev_notify_dispatch+89
acpi_os_execute_deferred+26
]: 1
(same stack 3x in 60 s; the remaining hits are the resulting pci_resume_bus / rpm_get_suppliers resumes of the same wake)
So, to the best of my reading:
- The GPU runtime-suspends. The firmware then issues
Notify(\_SB.NPCF, 0xC0). This is probably triggered by the dGPU power-state change itself, given the fixed ~0.9 s delay. nv_acpi_nvpcf_event()callsrm_acpi_nvpcf_notify()(osapi.c#L6071-L6103 @ 595.99.02), which unconditionally callsos_ref_dynamic_power(nv, NV_DYNAMIC_PM_FINE). FromIDLE_INDICATEDthat callsnv_indicate_not_idle()and fully resumes the GPU.- The only work done while the GPU is awake is
gpuNotifySubDeviceEvent(pGpu, NV2080_NOTIFIERS_NVPCF_EVENTS, ...). Nothing else in the RM consumesNV2080_NOTIFIERS_NVPCF_EVENTS; the only listener is a userspace client such asnvidia-powerd. On this systemnvidia-powerdis not running, so the notification has no recipients. - The ref is dropped and the GPU idles out about 20 s later. The firmware notifies again, and the loop restarts.
The GPU is therefore powered up for a notification that, in this configuration, nobody receives. Even when nvidia-powerd is running, resuming the GPU just to post an event seems unnecessary: the client could be notified (or the event replayed) on the next real resume.
Smaller issue in the same function: os_unref_dynamic_power() is called even when os_ref_dynamic_power() failed. On the nv_indicate_not_idle() failure path the refcount has already been rolled back, so this looks like it can underflow the refcount.
To Reproduce
- Hybrid laptop with an NVPCF ACPI device (
NVDA0820) whose firmware sendsNotify(NPCF, 0xC0)on dGPU power transitions (seen on ASUS TUF A15 FA506NCG; a Razer Blade 14 2022 shows the same pattern, see below). - Driver loaded with runtime D3 enabled (
/proc/driver/nvidia/gpus/*/power→Runtime D3 status: Enabled (fine-grained)),nvidia-powerdnot running. - No dGPU users; on battery.
- Watch
/sys/bus/pci/devices/<dGPU>/power/runtime_status. It cycles suspended → resuming about every 23 s, andruntime_active_timekeeps growing. bpftraceontracepoint:rpm:rpm_resumeshowsrm_acpi_nvpcf_notify→os_ref_dynamic_power→nv_indicate_not_idleas the cause.
Bug Incidence
Always
nvidia-bug-report.log.gz
Not attached yet (filed via CLI, which cannot upload files); it will follow in a comment.
More Info
Expected: an NVPCF notification arriving while the GPU is runtime-suspended should not resume it. The event could be latched and delivered (and SBIOS policy re-read) on the next resume, or dropped when no client is subscribed to NV2080_NOTIFIERS_NVPCF_EVENTS.
Possible fix (sketch, not tested):
void NV_API_CALL rm_acpi_nvpcf_notify(nvidia_stack_t *sp)
{
...
OBJGPU *pGpu = gpumgrGetGpu(0);
if (pGpu != NULL)
{
nv_state_t *nv = NV_GET_NV_STATE(pGpu);
nv_priv_t *nvp = NV_GET_NV_PRIV(nv);
if (nvp->dynamic_power.state == NV_DYNAMIC_POWER_STATE_IDLE_INDICATED)
{
/* Don't wake a runtime-suspended GPU just to post this event;
* deliver it from the resume path instead. */
nvp->dynamic_power.bNvpcfEventPending = NV_TRUE;
}
else if (os_ref_dynamic_power(nv, NV_DYNAMIC_PM_FINE) == NV_OK)
{
gpuNotifySubDeviceEvent(pGpu, NV2080_NOTIFIERS_NVPCF_EVENTS,
NULL, 0, 0, 0);
os_unref_dynamic_power(nv, NV_DYNAMIC_PM_FINE);
}
}
...
}
A real fix needs the state check done under the dynamic-power mutex, plus a place on the resume path that delivers the pending event.
Related report: the same ~24 s wake cycle, traced to rm_acpi_nvpcf_notify on a Razer Blade 14 (2022): https://forums.developer.nvidia.com/t/nvidia-gpu-fails-to-power-off-prime-razer-blade-14-2022/250023/47 (RTX 3080 Mobile, driver 610.57.04, kernel 7.1.12). There the source is EC query _Q34, which sends Notify(NPCF, 0xC0). The workaround there is a DSDT override that removes that Notify, and the dGPU then stays in D3cold, with no problems seen in docking, suspend/resume or dGPU workloads. This suggests the event isn't needed while the GPU is off.
The same thread, opened 2023-04-15, reports this as a regression starting with 530: 525.x stays in D3cold, every later branch doesn't. NVIDIA staff filed internal bug 4084236 in it on 2023-04-24. Several other posts describe the same ~20 s cycle, on battery only, across 535, 545, 550, 555, 560 and 610 (Razer Blade 14/15, Legion 5, MSI GP66, Dell G3), and one notes it was fixed on Windows with the 560 driver. Now also confirmed on 595.99.02 on an ASUS TUF A15.
Impact: about 4–6 W of extra idle draw on battery, roughly 30–40 % shorter battery life on this machine.
- 主要言語
- C
- スター
- 17.7k
- フォーク
- 2k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NVIDIA/open-gpu-kernel-modules のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA/open-gpu-kernel-modules#1635 ·
メンテナーはふだん 1 日以内に返信
-
nvidia-drm: NULL dereference in nv_drm_create_sync_file() when sync_file_create() fails (kernel oops when fs.file-max is exhausted)再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
NVIDIA/open-gpu-kernel-modules#1601 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
NVIDIA/open-gpu-kernel-modules#1479 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
PlatformRequestHandler: missing !bInit guard on bSystemParamLimitUpdate causes NV_ERR_INVALID_DATA at boot対応中かも @SammyTourani が 69 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
NVIDIA/open-gpu-kernel-modules#1360 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NVIDIA/open-gpu-kernel-modules#1343 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
NVIDIA/open-gpu-kernel-modules の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
Jstar269/nakagawa-recomp#3753 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
ly05010419/MacNativeGames#2474 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Life-Framework/Life-Framework#7017 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
gjrtimmer/jetson-nvmpi#170 ·