From f8acf8093dcecad90c3a6de481aba2afe14933a3 Mon Sep 17 00:00:00 2001 From: EDEADLINK <31075243+EDEADLINK@users.noreply.github.com> Date: Sat, 14 Aug 2021 20:55:24 +0200 Subject: [PATCH] Workaround lockups with HD Audio controller Turning the PCIe controller on before the HD audio controller is turned on can lead to hung tee processes, hung kernel tasks and other badness. If HDA_CONTROLLER_BUS_ID is set we can turn the HD Audio Controller on before the PCIe controller is turned on. This can cause a PCI error: >can't change power state from D3cold to D0 (config space inaccessible) But that's better than hanging the system. When turning off the card the order doesn't seem to matter. But we do turn on Powersave for the HDA controller again, as the nvidia card can't fully power off otherwise. --- config/nvidia-xrun | 8 ++++++++ nvidia-xrun | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/config/nvidia-xrun b/config/nvidia-xrun index c13363e..f390c0b 100644 --- a/config/nvidia-xrun +++ b/config/nvidia-xrun @@ -16,6 +16,14 @@ REMOVE_DEVICE=1 # Bus ID of the PCI express controller CONTROLLER_BUS_ID=0000:00:01.0 +# Turning the PCIe controller on when the HD audio controller is turned off +# can lead to hung tee processes, hung kernel tasks and total system lockups. +# If HDA_CONTROLLER_BUS_ID is set to the Bus ID of the NVIDIA HD audio controller +# it will be turned on before the PCIe controller is. +# +# Bus ID of the HD audio controller +#HDA_CONTROLLER_BUS_ID=0000:01:00.1 + # Bus ID of the graphic card DEVICE_BUS_ID=0000:01:00.0 diff --git a/nvidia-xrun b/nvidia-xrun index 56d9855..732fa5c 100755 --- a/nvidia-xrun +++ b/nvidia-xrun @@ -27,11 +27,24 @@ function turn_off_gpu { execute "sudo tee /sys/bus/pci/devices/${DEVICE_BUS_ID}/power/control <<