From cae8d96985c317604780f1b6babb7ae38c15caa9 Mon Sep 17 00:00:00 2001 From: Kyle Gospodnetich Date: Mon, 20 May 2024 21:32:55 -0700 Subject: [PATCH] feat: Recover from GPU crashes on the primary GPU - from jupiter-hw-support --- spec_files/jupiter-hw-support/jupiter-hw-support-btrfs.spec | 1 + .../deck/shared/usr/lib/udev/rules.d/80-gpu-reset.rules | 5 +++++ .../desktop/kinoite/usr/lib/udev/rules.d/80-gpu-reset.rules | 5 +++++ .../silverblue/usr/lib/udev/rules.d/80-gpu-reset.rules | 5 +++++ 4 files changed, 16 insertions(+) create mode 100644 system_files/deck/shared/usr/lib/udev/rules.d/80-gpu-reset.rules create mode 100644 system_files/desktop/kinoite/usr/lib/udev/rules.d/80-gpu-reset.rules create mode 100644 system_files/desktop/silverblue/usr/lib/udev/rules.d/80-gpu-reset.rules diff --git a/spec_files/jupiter-hw-support/jupiter-hw-support-btrfs.spec b/spec_files/jupiter-hw-support/jupiter-hw-support-btrfs.spec index 5d669a4c..eda2c2d8 100644 --- a/spec_files/jupiter-hw-support/jupiter-hw-support-btrfs.spec +++ b/spec_files/jupiter-hw-support/jupiter-hw-support-btrfs.spec @@ -76,6 +76,7 @@ xcursorgen usr/share/steamos/steamos-cursor-config %{buildroot}%{_datadir}/icons rm %{buildroot}%{_datadir}/jupiter_bios_updater/h2offt-g rm %{buildroot}%{_datadir}/jupiter_bios_updater/H2OFFTx64-G.sh rm %{buildroot}%{_datadir}/steamos/steamos.png +rm %{buildroot}%{_prefix}/lib/udev/rules.d/80-gpu-reset.rules rm -rf %{buildroot}%{_datadir}/jupiter_bios_updater/driver rm -rf %{buildroot}%{_unitdir}/multi-user.target.wants rm -rf %{buildroot}%{_datadir}/alsa diff --git a/system_files/deck/shared/usr/lib/udev/rules.d/80-gpu-reset.rules b/system_files/deck/shared/usr/lib/udev/rules.d/80-gpu-reset.rules new file mode 100644 index 00000000..19727baa --- /dev/null +++ b/system_files/deck/shared/usr/lib/udev/rules.d/80-gpu-reset.rules @@ -0,0 +1,5 @@ +# If a GPU crash is caused by a specific process, kill the PID +ACTION=="change", ENV{DEVNAME}=="/dev/dri/card0", ENV{RESET}=="1", ENV{PID}!="0", RUN+="/sbin/kill -9 %E{PID}" + +# Kill SDDM and Gamescope if the GPU crashes and VRAM is lost +ACTION=="change", ENV{DEVNAME}=="/dev/dri/card0", ENV{RESET}=="1", ENV{FLAGS}=="1", RUN+="/usr/sbin/systemctl restart sddm" diff --git a/system_files/desktop/kinoite/usr/lib/udev/rules.d/80-gpu-reset.rules b/system_files/desktop/kinoite/usr/lib/udev/rules.d/80-gpu-reset.rules new file mode 100644 index 00000000..19727baa --- /dev/null +++ b/system_files/desktop/kinoite/usr/lib/udev/rules.d/80-gpu-reset.rules @@ -0,0 +1,5 @@ +# If a GPU crash is caused by a specific process, kill the PID +ACTION=="change", ENV{DEVNAME}=="/dev/dri/card0", ENV{RESET}=="1", ENV{PID}!="0", RUN+="/sbin/kill -9 %E{PID}" + +# Kill SDDM and Gamescope if the GPU crashes and VRAM is lost +ACTION=="change", ENV{DEVNAME}=="/dev/dri/card0", ENV{RESET}=="1", ENV{FLAGS}=="1", RUN+="/usr/sbin/systemctl restart sddm" diff --git a/system_files/desktop/silverblue/usr/lib/udev/rules.d/80-gpu-reset.rules b/system_files/desktop/silverblue/usr/lib/udev/rules.d/80-gpu-reset.rules new file mode 100644 index 00000000..ab24adb4 --- /dev/null +++ b/system_files/desktop/silverblue/usr/lib/udev/rules.d/80-gpu-reset.rules @@ -0,0 +1,5 @@ +# If a GPU crash is caused by a specific process, kill the PID +ACTION=="change", ENV{DEVNAME}=="/dev/dri/card0", ENV{RESET}=="1", ENV{PID}!="0", RUN+="/sbin/kill -9 %E{PID}" + +# Kill SDDM and Gamescope if the GPU crashes and VRAM is lost +ACTION=="change", ENV{DEVNAME}=="/dev/dri/card0", ENV{RESET}=="1", ENV{FLAGS}=="1", RUN+="/usr/sbin/systemctl restart gdm"