* Re: Kernel panic in 3.10.10-rt7 (iwlwifi)
[not found] <2CD18B42-2489-4DF7-98D6-4D002329DC63@m3y3r.de>
@ 2013-10-04 10:12 ` Sebastian Andrzej Siewior
2013-10-06 6:00 ` [Ilw] " Grumbach, Emmanuel
0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2013-10-04 10:12 UTC (permalink / raw)
To: Thomas Meyer
Cc: Johannes Berg, linux-rt-users, Wey-Yi Guy, Intel Linux Wireless,
linux-wireless, tglx
* Thomas Meyer | 2013-09-15 23:49:29 [+0200]:
>Hi,
Hi,
>My system did lockup after short time of usage. I was only able to capture this screenshot:
>
>Any ideas?
the problem seems to be that they use sleeping locks in the primary irq
handler.
iwl_pcie_rx_replenish() takes the same lock (->irq_lock) and additionaly
->lock so I think tunrning everything into raw locks isn't very wise for
the latency.
The threaded handler takes for a very short time irq_lock lock. It also
takes the ->lock via (iwl_pcie_rxq_inc_wr_ptr()) with irqs off (that one
looks short, too) and others for instance via iwl_pcie_rx_handle().
Ideally the driver should hold one spinlock to synchronize the primary
and threaded irq handler while disabling the interrupt in the iwl
hardware. Everything else would then hold one or two mutex(es) and could
even allocate memory with GFP_KERNEL.
For now I think the simply thing would be just to let both handlers run
in the thread. Does this patch solve your problem?
diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c b/drivers/net/wireless/iwlwifi/pcie/trans.c
index aeb70e1..42567fc 100644
--- a/drivers/net/wireless/iwlwifi/pcie/trans.c
+++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
@@ -1456,6 +1456,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)
@@ -1566,9 +1580,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
+ if (request_threaded_irq(pdev->irq, NULL, iwl_rt_irq_handler,
+ IRQF_SHARED | IRQF_ONESHOT, DRV_NAME, trans)) {
+#else
if (request_threaded_irq(pdev->irq, iwl_pcie_isr_ict,
iwl_pcie_irq_handler,
IRQF_SHARED, DRV_NAME, trans)) {
+#endif
IWL_ERR(trans, "Error allocating IRQ %d\n", pdev->irq);
goto out_free_ict;
}
--
1.8.4.rc3
>With kind regards
>Thomas
Sebastian
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [Ilw] Re: Kernel panic in 3.10.10-rt7 (iwlwifi)
2013-10-04 10:12 ` Kernel panic in 3.10.10-rt7 (iwlwifi) Sebastian Andrzej Siewior
@ 2013-10-06 6:00 ` Grumbach, Emmanuel
2013-10-07 7:33 ` Sebastian Andrzej Siewior
0 siblings, 1 reply; 3+ messages in thread
From: Grumbach, Emmanuel @ 2013-10-06 6:00 UTC (permalink / raw)
To: Sebastian Andrzej Siewior, Thomas Meyer
Cc: linux-rt-users@vger.kernel.org, Berg, Johannes,
linux-wireless@vger.kernel.org, Intel Linux Wireless,
tglx@linutronix.de
> >My system did lockup after short time of usage. I was only able to capture
> this screenshot:
> >
> >Any ideas?
>
> the problem seems to be that they use sleeping locks in the primary irq
> handler.
>
> iwl_pcie_rx_replenish() takes the same lock (->irq_lock) and additionaly
> ->lock so I think tunrning everything into raw locks isn't very wise for
> the latency.
>
> The threaded handler takes for a very short time irq_lock lock. It also takes
> the ->lock via (iwl_pcie_rxq_inc_wr_ptr()) with irqs off (that one looks short,
> too) and others for instance via iwl_pcie_rx_handle().
> Ideally the driver should hold one spinlock to synchronize the primary and
> threaded irq handler while disabling the interrupt in the iwl hardware.
> Everything else would then hold one or two mutex(es) and could even
> allocate memory with GFP_KERNEL.
We have a patch internally that goes into that direction, but one thing though. If you still have a spinlock in the primary handler, wouldn't that sleep in a non-sleepable context? Forgive my -rt ignorance, but I understood that in -rt, all the spinlock go to sleep which basically mean that we can't take any spinlock in the primary irq handler so I am a bit confused here.
>
> For now I think the simply thing would be just to let both handlers run in the
> thread. Does this patch solve your problem?
>
> diff --git a/drivers/net/wireless/iwlwifi/pcie/trans.c
> b/drivers/net/wireless/iwlwifi/pcie/trans.c
> index aeb70e1..42567fc 100644
> --- a/drivers/net/wireless/iwlwifi/pcie/trans.c
> +++ b/drivers/net/wireless/iwlwifi/pcie/trans.c
> @@ -1456,6 +1456,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)
> @@ -1566,9 +1580,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
> + if (request_threaded_irq(pdev->irq, NULL, iwl_rt_irq_handler,
> + IRQF_SHARED | IRQF_ONESHOT,
> DRV_NAME, trans)) { #else
> if (request_threaded_irq(pdev->irq, iwl_pcie_isr_ict,
> iwl_pcie_irq_handler,
> IRQF_SHARED, DRV_NAME, trans)) {
> +#endif
> IWL_ERR(trans, "Error allocating IRQ %d\n", pdev->irq);
> goto out_free_ict;
> }
> --
> 1.8.4.rc3
>
>
> >With kind regards
> >Thomas
>
> Sebastian
>
> _______________________________________________
> ilw mailing list
> ilw@linux.intel.com
> http://linux.intel.com/mailman/listinfo/ilw
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Ilw] Re: Kernel panic in 3.10.10-rt7 (iwlwifi)
2013-10-06 6:00 ` [Ilw] " Grumbach, Emmanuel
@ 2013-10-07 7:33 ` Sebastian Andrzej Siewior
0 siblings, 0 replies; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2013-10-07 7:33 UTC (permalink / raw)
To: Grumbach, Emmanuel
Cc: Thomas Meyer, linux-rt-users@vger.kernel.org, Berg, Johannes,
linux-wireless@vger.kernel.org, Intel Linux Wireless,
tglx@linutronix.de
On 10/06/2013 08:00 AM, Grumbach, Emmanuel wrote:
>
> We have a patch internally that goes into that direction, but one thing though.
Sounds great.
> If you still have a spinlock in the primary handler, wouldn't that sleep in a non-sleepable context? Forgive my -rt ignorance, but I understood that in -rt, all the spinlock go to sleep which basically mean that we can't take any spinlock in the primary irq handler so I am a bit confused here.
After my change there is no primary handler anymore, just the threaded
where you can take the (sleeping) spinlock.
Everything what you wrote is correct:
- you can't take a spinlock in the primary handler
- all spinlocks may sleep
Sebastian
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-10-07 7:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <2CD18B42-2489-4DF7-98D6-4D002329DC63@m3y3r.de>
2013-10-04 10:12 ` Kernel panic in 3.10.10-rt7 (iwlwifi) Sebastian Andrzej Siewior
2013-10-06 6:00 ` [Ilw] " Grumbach, Emmanuel
2013-10-07 7:33 ` Sebastian Andrzej Siewior
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).