commit 322b208e25c0bbd424ffe380961a47845ad5b3ca
Author: Leigh Scott <leigh123linux(a)gmail.com>
Date: Wed Dec 27 08:43:46 2023 +0000
Add fix for 'Flip event timeout' (rfbz6808)
nvidia-drm-hotplug-workqueue.patch | 104 +++++++++++++++++++++++++++++++++++++
nvidia-kmod.spec | 9 +++-
2 files changed, 111 insertions(+), 2 deletions(-)
---
diff --git a/nvidia-drm-hotplug-workqueue.patch b/nvidia-drm-hotplug-workqueue.patch
new file mode 100644
index 0000000..e77cbcc
--- /dev/null
+++ b/nvidia-drm-hotplug-workqueue.patch
@@ -0,0 +1,104 @@
+From d82eb6c87ee2e05b6bbd35f703a41e68b3adc3a7 Mon Sep 17 00:00:00 2001
+From: Aaron Plattner <aplattner(a)nvidia.com>
+Date: Tue, 26 Dec 2023 11:58:46 -0800
+Subject: [PATCH] nvidia-drm: Use a workqueue to defer calling
+ drm_kms_helper_hotplug_event
+
+---
+ kernel/nvidia-drm/nvidia-drm-drv.c | 24 ++++++++++++++++++++++++
+ kernel/nvidia-drm/nvidia-drm-encoder.c | 4 ++--
+ kernel/nvidia-drm/nvidia-drm-priv.h | 1 +
+ 3 files changed, 27 insertions(+), 2 deletions(-)
+
+diff --git a/kernel/nvidia-drm/nvidia-drm-drv.c b/kernel/nvidia-drm/nvidia-drm-drv.c
+index e0ddb6c..9f7424d 100644
+--- a/kernel/nvidia-drm/nvidia-drm-drv.c
++++ b/kernel/nvidia-drm/nvidia-drm-drv.c
+@@ -74,6 +74,7 @@
+ #endif
+
+ #include <linux/pci.h>
++#include <linux/workqueue.h>
+
+ /*
+ * Commit fcd70cd36b9b ("drm: Split out drm_probe_helper.h")
+@@ -405,6 +406,27 @@ static int nv_drm_create_properties(struct nv_drm_device *nv_dev)
+ return 0;
+ }
+
++#if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
++/*
++ * We can't just call drm_kms_helper_hotplug_event directly because
++ * fbdev_generic may attempt to set a mode from inside the hotplug event
++ * handler. Because kapi event handling runs on nvkms_kthread_q, this blocks
++ * other event processing including the flip completion notifier expected by
++ * nv_drm_atomic_commit.
++ *
++ * Defer hotplug event handling to a work item so that nvkms_kthread_q can
++ * continue processing events while a DRM modeset is in progress.
++ */
++static void nv_drm_handle_hotplug_event(struct work_struct *work)
++{
++ struct delayed_work *dwork = to_delayed_work(work);
++ struct nv_drm_device *nv_dev =
++ container_of(dwork, struct nv_drm_device, hotplug_event_work);
++
++ drm_kms_helper_hotplug_event(nv_dev->dev);
++}
++#endif
++
+ static int nv_drm_load(struct drm_device *dev, unsigned long flags)
+ {
+ #if defined(NV_DRM_ATOMIC_MODESET_AVAILABLE)
+@@ -540,6 +562,7 @@ static int nv_drm_load(struct drm_device *dev, unsigned long flags)
+
+ /* Enable event handling */
+
++ INIT_DELAYED_WORK(&nv_dev->hotplug_event_work, nv_drm_handle_hotplug_event);
+ atomic_set(&nv_dev->enable_event_handling, true);
+
+ init_waitqueue_head(&nv_dev->flip_event_wq);
+@@ -567,6 +590,7 @@ static void __nv_drm_unload(struct drm_device *dev)
+ return;
+ }
+
++ cancel_delayed_work_sync(&nv_dev->hotplug_event_work);
+ mutex_lock(&nv_dev->lock);
+
+ WARN_ON(nv_dev->subOwnershipGranted);
+diff --git a/kernel/nvidia-drm/nvidia-drm-encoder.c
b/kernel/nvidia-drm/nvidia-drm-encoder.c
+index b5ef5a2..7c0c119 100644
+--- a/kernel/nvidia-drm/nvidia-drm-encoder.c
++++ b/kernel/nvidia-drm/nvidia-drm-encoder.c
+@@ -300,7 +300,7 @@ void nv_drm_handle_display_change(struct nv_drm_device *nv_dev,
+
+ nv_drm_connector_mark_connection_status_dirty(nv_encoder->nv_connector);
+
+- drm_kms_helper_hotplug_event(dev);
++ schedule_delayed_work(&nv_dev->hotplug_event_work, 0);
+ }
+
+ void nv_drm_handle_dynamic_display_connected(struct nv_drm_device *nv_dev,
+@@ -347,6 +347,6 @@ void nv_drm_handle_dynamic_display_connected(struct nv_drm_device
*nv_dev,
+ drm_reinit_primary_mode_group(dev);
+ #endif
+
+- drm_kms_helper_hotplug_event(dev);
++ schedule_delayed_work(&nv_dev->hotplug_event_work, 0);
+ }
+ #endif
+diff --git a/kernel/nvidia-drm/nvidia-drm-priv.h b/kernel/nvidia-drm/nvidia-drm-priv.h
+index 253155f..c9ce727 100644
+--- a/kernel/nvidia-drm/nvidia-drm-priv.h
++++ b/kernel/nvidia-drm/nvidia-drm-priv.h
+@@ -126,6 +126,7 @@ struct nv_drm_device {
+ NvU64 modifiers[6 /* block linear */ + 1 /* linear */ + 1 /* terminator */];
+ #endif
+
++ struct delayed_work hotplug_event_work;
+ atomic_t enable_event_handling;
+
+ /**
+--
+2.43.0
+
diff --git a/nvidia-kmod.spec b/nvidia-kmod.spec
index 2e1aa24..8d4fd73 100644
--- a/nvidia-kmod.spec
+++ b/nvidia-kmod.spec
@@ -12,13 +12,15 @@ Name: nvidia-kmod
Epoch: 3
Version: 545.29.06
# Taken over by kmodtool
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: NVIDIA display driver kernel module
License: Redistributable, no modification permitted
URL:
https://www.nvidia.com/
Source11: nvidia-kmodtool-excludekernel-filterfile
Patch0: make_modeset_default.patch
+#
https://forums.developer.nvidia.com/t/545-29-06-18-1-flip-event-timeout-e...
+Patch1: nvidia-drm-hotplug-workqueue.patch
# needed for plague to make sure it builds for i586 and i686
ExclusiveArch: x86_64 aarch64
@@ -53,7 +55,7 @@ echo "Using original nvidia defaults"
echo "Set nvidia to fbdev=1 modeset=1"
%patch -P0 -p1
%endif
-
+%patch -P1 -p1
for kernel_version in %{?kernel_versions} ; do
cp -a kernel _kmod_build_${kernel_version%%___*}
done
@@ -87,6 +89,9 @@ done
%changelog
+* Wed Dec 27 2023 Leigh Scott <leigh123linux(a)gmail.com> - 3:545.29.06-2
+- Add fix for 'Flip event timeout' (rfbz6808)
+
* Wed Nov 22 2023 Leigh Scott <leigh123linux(a)gmail.com> - 3:545.29.06-1
- Update to 545.29.06 release