3.12.0-rt1: net: iwlwifi request only a threaded handler for interrupts
PATCH 1/1 3.12.0-rt1: net: iwlwifi request only a threaded handler for interrupts
Sebastian,
I needed this for my laptop on 3.12, so tweaked it to apply properly.
Clark
commit 7b1573eaa0f176731bc231b249598b6e4850babf
Author: Clark Williams <[email protected]> Date: Tue Nov 12 12:17:07 2013 -0600
net: iwlwifi: request only a threaded handler for interrupts
On RT the trans_pcie->irq_lock lock is converted into a sleeping lock and can't be used in primary irq handler. The lock is used in mutliple places which means turning it into a raw lock could increase the latency of the system.
For now both handlers are moved into the thread.
(quoted diff) +0 -0
b/drivers/net/wireless/iwlwifi/pcie/trans.c index c3f904d..2f2345c 100644 --- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1375,6 +1375,20 @@ static const struct iwl_trans_ops trans_ops_pcie = { .set_bits_mask = iwl_trans_pcie_set_bits_mask,
};
+#ifdef CONFIG_PREEMPT_RT_BASE
+static irqreturn_t iwl_rt_irq_handler(int irq, void *dev_id) +{
+ irqreturn_t ret;
+
+ local_bh_disable(); + ret = iwl_pcie_isr_ict(irq, dev_id); + local_bh_enable(); + if (ret == IRQ_WAKE_THREAD)
+ ret = iwl_pcie_irq_handler(irq, dev_id);
+ return ret;
+}
+#endif
+
struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,
const struct pci_device_id *ent, const struct iwl_cfg *cfg)
@@ -1493,9 +1507,14 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev, if (iwl_pcie_alloc_ict(trans))
goto out_free_cmd_pool;
+#ifdef CONFIG_PREEMPT_RT_BASE
+ err = request_threaded_irq(pdev->irq, NULL, iwl_rt_irq_handler,
+ IRQF_SHARED | IRQF_ONESHOT, DRV_NAME,
trans)) +#else
err = request_threaded_irq(pdev->irq, iwl_pcie_isr_ict,
iwl_pcie_irq_handler,
IRQF_SHARED, DRV_NAME, trans);
+#endif
if (err) {
IWL_ERR(trans, "Error allocating IRQ %d\n", pdev->irq);
goto out_free_ict;Quoted 6 lines · On Tue, 12 Nov 2013 13:16:59 -0600 Clark Williams <[email protected]> wrote:
Sebastian,
I needed this for my laptop on 3.12, so tweaked it to apply properly.
Clark
So of course I sent the wrong patch:
commit 49d487614d56bc10969dd0dcbce709825fc06d0e
Author: Clark Williams <[email protected]> Date: Tue Nov 12 12:17:07 2013 -0600
net: iwlwifi: request only a threaded handler for interrupts
On RT the trans_pcie->irq_lock lock is converted into a sleeping lock and can't be used in primary irq handler. The lock is used in mutliple places which means turning it into a raw lock could increase the latency of the system.
For now both handlers are moved into the thread.
drivers/net/wireless/iwlwifi/pcie/trans.c +20 -0
@@ -1375,6 +1375,20 @@ static const struct iwl_trans_ops trans_ops_pcie = { .set_bits_mask = iwl_trans_pcie_set_bits_mask, }; +#ifdef CONFIG_PREEMPT_RT_BASE +static irqreturn_t iwl_rt_irq_handler (int irq,void *dev_id) +{ +irqreturn_t ret; + +local_bh_disable (); + ret =iwl_pcie_isr_ict (irq, dev_id); +local_bh_enable (); +if (ret ==IRQ_WAKE_THREAD ) + ret =iwl_pcie_irq_handler (irq, dev_id); +return ret; +} +#endif +struct iwl_trans *iwl_trans_pcie_alloc (struct pci_dev *pdev,const struct pci_device_id *ent,const struct iwl_cfg *cfg)
@@ -1493,9 +1507,15 @@ struct iwl_trans *iwl_trans_pcie_alloc(struct pci_dev *pdev,if (iwl_pcie_alloc_ict (trans)) goto out_free_cmd_pool; +#ifdef CONFIG_PREEMPT_RT_BASE + err =request_threaded_irq (pdev->irq,NULL , iwl_rt_irq_handler, +IRQF_SHARED |IRQF_ONESHOT , +DRV_NAME , trans); +#else err =request_threaded_irq (pdev->irq, iwl_pcie_isr_ict, iwl_pcie_irq_handler,IRQF_SHARED ,DRV_NAME , trans); +#endif if (err) {IWL_ERR (trans,"Error allocating IRQ %d\n" , pdev->irq); goto out_free_ict;
Quoted 1 line · Clark Williams
Sebastian,
Hi Clark,
Quoted 3 lines
I needed this for my laptop on 3.12, so tweaked it to apply properly.
The patch was a little broken but I managed to apply it. Thanks for testing.
Quoted 2 lines
Clark
Sebastian