Skip to contentSkip to conversation

Revert "uio: use threaded interrupts"

PATCH New Sebastian Andrzej Siewior 1 participant 1 message Nov 25

Subsystems (2)
lore
Share & tools
lore

Sebastian Andrzej Siewior

author maintainer
#0 lore raw

PATCH v4 1/1 Revert "uio: use threaded interrupts"

From: Michael Schanne <[email protected]>

This reverts commit f8a27dfa4b82d442af1c0645a5acc70cc97c67f6.

The patch claims to fix the issue with nested interrupts by using request_threaded_irq(). Should an IRQ be nested, then __setup_irq() will overwrite the primary handler, and the submitted uio_interrupt_handler() will not be called (only the threaded handler).
On non-nested interrupts, both handlers are installed and work properly. In forced threaded environments, such as PREEMPT_RT, it results in two threads, adding additional overhead.

Therefore revert the change.

---
v4: https://lore.kernel.org/TY0PR01MB5723E978A7EE94644B15621FD2782@TY0PR01MB5723.apcprd01.prod.exchangelabs.com
- Reposted Michael's patch with small fixes:
- Use Tabs and not Spaces. I think this broke applying it.
- Remove the comment for uio_interrupt_thread() and rename
uio_interrupt_handler() -> uio_interrupt()

v3: https://lore.kernel.org/TY0PR01MB57238A4ACC7B9B3214A00A6CD2772@TY0PR01MB5723.apcprd01.prod.exchangelabs.com
- Revise commit message

v2: Instead of an ifdef, revert the cited commit
v1: https://lore.kernel.org/all/TY0PR0101MB48676D503A7F6C5CAC112B3BD2A52@TY0PR0101MB4867.apcprd01.prod.exchangelabs.com/

Initial patch/ thread: https://lore.kernel.org/TY0PR0101MB48672132B8525B7B39565EE4D2A52@TY0PR0101MB4867.apcprd01.prod.exchangelabs.com

 drivers/uio/uio.c | 24 +++++-------------------
 1 file changed, 5 insertions(+), 19 deletions(-)
drivers/uio/uio.c +5 -19
index f8fa205226601..14880fa9623c4 100644
@@ -438,36 +438,22 @@ void uio_event_notify(struct uio_info *info)
 EXPORT_SYMBOL_GPL(uio_event_notify);
 
 /**
- * uio_interrupt_handler - hardware interrupt handler
+ * uio_interrupt - hardware interrupt handler
  * @irq: IRQ number, can be UIO_IRQ_CYCLIC for cyclic timer
  * @dev_id: Pointer to the devices uio_device structure
  */
-static irqreturn_t uio_interrupt_handler(int irq, void *dev_id)
+static irqreturn_t uio_interrupt(int irq, void *dev_id)
 {
 	struct uio_device *idev = (struct uio_device *)dev_id;
 	irqreturn_t ret;
 
 	ret = idev->info->handler(irq, idev->info);
 	if (ret == IRQ_HANDLED)
-		ret = IRQ_WAKE_THREAD;
+		uio_event_notify(idev->info);
 
 	return ret;
 }
 
-/**
- * uio_interrupt_thread - irq thread handler
- * @irq: IRQ number
- * @dev_id: Pointer to the devices uio_device structure
- */
-static irqreturn_t uio_interrupt_thread(int irq, void *dev_id)
-{
-	struct uio_device *idev = (struct uio_device *)dev_id;
-
-	uio_event_notify(idev->info);
-
-	return IRQ_HANDLED;
-}
-
 struct uio_listener {
 	struct uio_device *dev;
 	s32 event_count;
@@ -1044,8 +1030,8 @@ int __uio_register_device(struct module *owner,
 		 * FDs at the time of unregister and therefore may not be
 		 * freed until they are released.
 		 */
-		ret = request_threaded_irq(info->irq, uio_interrupt_handler, uio_interrupt_thread,
-					   info->irq_flags, info->name, idev);
+		ret = request_irq(info->irq, uio_interrupt,
+				  info->irq_flags, info->name, idev);
 		if (ret) {
 			info->uio_dev = NULL;
 			goto err_request_irq;
Signature · 1 line
2.55.0