git: 71fe907dfb03 - main - LinuxKPI: Switch irq_work implementation back to standard taskqueue

From: Vladimir Kondratyev <wulf_at_FreeBSD.org>
Date: Tue, 17 May 2022 12:11:41 UTC
The branch main has been updated by wulf:

URL: https://cgit.FreeBSD.org/src/commit/?id=71fe907dfb03c4d89a6370ce3d161603d0f40e5e

commit 71fe907dfb03c4d89a6370ce3d161603d0f40e5e
Author:     Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2022-05-17 12:10:20 +0000
Commit:     Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2022-05-17 12:10:20 +0000

    LinuxKPI: Switch irq_work implementation back to standard taskqueue
    
    from fast one as dmabuf does not run callbacks from critical sections
    since drm-kmod 5.7.
    Consumers which requires fair irq_work like drm-kmod 5.4 must #define
    LKPI_IRQ_WORK_USE_FAST_TQ somewhere in source file before linux/irq_work.h
    inclusion to enable old behavior.
    
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D35052
---
 sys/compat/linuxkpi/common/include/linux/irq_work.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/linux/irq_work.h b/sys/compat/linuxkpi/common/include/linux/irq_work.h
index c2cdc6011c98..ec71a7ee094f 100644
--- a/sys/compat/linuxkpi/common/include/linux/irq_work.h
+++ b/sys/compat/linuxkpi/common/include/linux/irq_work.h
@@ -35,6 +35,16 @@
 #include <sys/taskqueue.h>
 
 #include <linux/llist.h>
+#include <linux/workqueue.h>
+
+#define	LKPI_IRQ_WORK_STD_TQ	system_wq->taskqueue
+#define	LKPI_IRQ_WORK_FAST_TQ	linux_irq_work_tq
+
+#ifdef LKPI_IRQ_WORK_USE_FAST_TQ
+#define	LKPI_IRQ_WORK_TQ	LKPI_IRQ_WORK_FAST_TQ
+#else
+#define	LKPI_IRQ_WORK_TQ	LKPI_IRQ_WORK_STD_TQ
+#endif
 
 struct irq_work;
 typedef void (*irq_work_func_t)(struct irq_work *);
@@ -64,14 +74,14 @@ init_irq_work(struct irq_work *irqw, irq_work_func_t func)
 static inline bool
 irq_work_queue(struct irq_work *irqw)
 {
-	return (taskqueue_enqueue_flags(linux_irq_work_tq, &irqw->irq_task,
+	return (taskqueue_enqueue_flags(LKPI_IRQ_WORK_TQ, &irqw->irq_task,
 	    TASKQUEUE_FAIL_IF_PENDING) == 0);
 }
 
 static inline void
 irq_work_sync(struct irq_work *irqw)
 {
-	taskqueue_drain(linux_irq_work_tq, &irqw->irq_task);
+	taskqueue_drain(LKPI_IRQ_WORK_TQ, &irqw->irq_task);
 }
 
 #endif /* _LINUXKPI_LINUX_IRQ_WORK_H_ */