RTD3: every NVPCF ACPI notify (NVDA0820) wakes a runtime-suspended dGPU, so it never stays in D3 on ASUS TUF A15
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 18/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- c, linux
- Ambito
- operating-systems, performance
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- C
- Stelle
- 17.7k
- Fork
- 2k
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NVIDIA/open-gpu-kernel-modules
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NVIDIA/open-gpu-kernel-modules#1635 ·
I maintainer di solito rispondono entro 1 giorno
-
nvidia-drm: NULL dereference in nv_drm_create_sync_file() when sync_file_create() fails (kernel oops when fs.file-max is exhausted)Forse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
NVIDIA/open-gpu-kernel-modules#1601 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
NVIDIA/open-gpu-kernel-modules#1479 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
PlatformRequestHandler: missing !bInit guard on bSystemParamLimitUpdate causes NV_ERR_INVALID_DATA at bootForse già presa @SammyTourani l’ha presa 69 giorni fa. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
NVIDIA/open-gpu-kernel-modules#1360 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
NVIDIA/open-gpu-kernel-modules#1343 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di NVIDIA/open-gpu-kernel-modules
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
Jstar269/nakagawa-recomp#3753 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100
ly05010419/MacNativeGames#2474 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
Life-Framework/Life-Framework#7017 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
gjrtimmer/jetson-nvmpi#170 ·