From: Kalle Valo <kvalo@qca.qualcomm.com> To: Michal Kazior <michal.kazior@tieto.com> Cc: <ath10k@lists.infradead.org>, <linux-wireless@vger.kernel.org> Subject: Re: [PATCH] ath10k: move irq setup Date: Tue, 30 Jul 2013 21:35:39 +0300 [thread overview] Message-ID: <87d2pzuc90.fsf@kamboji.qca.qualcomm.com> (raw) In-Reply-To: <1374129572-6079-1-git-send-email-michal.kazior@tieto.com> (Michal Kazior's message of "Thu, 18 Jul 2013 08:39:32 +0200") Michal Kazior <michal.kazior@tieto.com> writes: > There was a slight race during PCI shutdown. Since > interrupts weren't really stopped (only Copy > Engine interrupts were disabled through device hw > registers) it was possible for a firmware > indication (crash) interrupt to come in after > tasklets were synced/killed. This would cause > memory corruption and a panic in most cases. It > was also possible for interrupt to come before CE > was initialized during device probing. > > Interrupts are required for BMI phase so they are enabled as soon as > power_up() is called but are freed upon both power_down() and stop() > so there's asymmetry here. As by design stop() cannot be followed by > start() it is okay. Both power_down() and stop() should be merged > later on to avoid confusion. Why are the interrupts freed both in power_down() and stop()? I don't get that. What if we call disable_irq() in power_down() instead? > Before this can be really properly fixed var/hw > init code split is necessary. > > Signed-off-by: Michal Kazior <michal.kazior@tieto.com> > --- > > Please note: this is based on my (still under > review at the time of posting) previous patchests: > device setup refactor and recovery. > > I'm posting this before those patchsets are merged > so anyone interested in testing this fix (I can't > reproduce the problem on my setup) can give it a > try. This was reported by Ben, right? So this sould have a Reported-by line attributing him. > @@ -1783,16 +1792,24 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar) > return 0; > > err_ce: > + /* XXX: Until var/hw init is split it's impossible to fix the ordering > + * here so we must call stop_intr() here too to prevent interrupts after > + * CE is teared down. It's okay to double call the stop_intr() > */ "FIXME:" > exit: > + ar_pci->intr_started = ret == 0; A bit too clever for the sake of readibility for my taste, but I guess it's ok. > --- a/drivers/net/wireless/ath/ath10k/pci.h > +++ b/drivers/net/wireless/ath/ath10k/pci.h > @@ -198,6 +198,7 @@ struct ath10k_pci { > * interrupts. > */ > int num_msi_intrs; > + bool intr_started; Adding a new state variable makes me worried. I really would prefer a solution which would not require that. Also if we call request_irq() in ath10k_pci_probe() we should also call free_irq() in ath10k_pci_remove() for symmetry. Just doing a temporary hack will most likely stay forever :) -- Kalle Valo
WARNING: multiple messages have this Message-ID (diff)
From: Kalle Valo <kvalo@qca.qualcomm.com> To: Michal Kazior <michal.kazior@tieto.com> Cc: linux-wireless@vger.kernel.org, ath10k@lists.infradead.org Subject: Re: [PATCH] ath10k: move irq setup Date: Tue, 30 Jul 2013 21:35:39 +0300 [thread overview] Message-ID: <87d2pzuc90.fsf@kamboji.qca.qualcomm.com> (raw) In-Reply-To: <1374129572-6079-1-git-send-email-michal.kazior@tieto.com> (Michal Kazior's message of "Thu, 18 Jul 2013 08:39:32 +0200") Michal Kazior <michal.kazior@tieto.com> writes: > There was a slight race during PCI shutdown. Since > interrupts weren't really stopped (only Copy > Engine interrupts were disabled through device hw > registers) it was possible for a firmware > indication (crash) interrupt to come in after > tasklets were synced/killed. This would cause > memory corruption and a panic in most cases. It > was also possible for interrupt to come before CE > was initialized during device probing. > > Interrupts are required for BMI phase so they are enabled as soon as > power_up() is called but are freed upon both power_down() and stop() > so there's asymmetry here. As by design stop() cannot be followed by > start() it is okay. Both power_down() and stop() should be merged > later on to avoid confusion. Why are the interrupts freed both in power_down() and stop()? I don't get that. What if we call disable_irq() in power_down() instead? > Before this can be really properly fixed var/hw > init code split is necessary. > > Signed-off-by: Michal Kazior <michal.kazior@tieto.com> > --- > > Please note: this is based on my (still under > review at the time of posting) previous patchests: > device setup refactor and recovery. > > I'm posting this before those patchsets are merged > so anyone interested in testing this fix (I can't > reproduce the problem on my setup) can give it a > try. This was reported by Ben, right? So this sould have a Reported-by line attributing him. > @@ -1783,16 +1792,24 @@ static int ath10k_pci_hif_power_up(struct ath10k *ar) > return 0; > > err_ce: > + /* XXX: Until var/hw init is split it's impossible to fix the ordering > + * here so we must call stop_intr() here too to prevent interrupts after > + * CE is teared down. It's okay to double call the stop_intr() > */ "FIXME:" > exit: > + ar_pci->intr_started = ret == 0; A bit too clever for the sake of readibility for my taste, but I guess it's ok. > --- a/drivers/net/wireless/ath/ath10k/pci.h > +++ b/drivers/net/wireless/ath/ath10k/pci.h > @@ -198,6 +198,7 @@ struct ath10k_pci { > * interrupts. > */ > int num_msi_intrs; > + bool intr_started; Adding a new state variable makes me worried. I really would prefer a solution which would not require that. Also if we call request_irq() in ath10k_pci_probe() we should also call free_irq() in ath10k_pci_remove() for symmetry. Just doing a temporary hack will most likely stay forever :) -- Kalle Valo _______________________________________________ ath10k mailing list ath10k@lists.infradead.org http://lists.infradead.org/mailman/listinfo/ath10k
next prev parent reply other threads:[~2013-07-30 18:35 UTC|newest] Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-07-18 6:39 [PATCH] ath10k: move irq setup Michal Kazior 2013-07-18 6:39 ` Michal Kazior 2013-07-30 18:35 ` Kalle Valo [this message] 2013-07-30 18:35 ` Kalle Valo 2013-07-31 5:50 ` Michal Kazior 2013-07-31 5:50 ` Michal Kazior 2013-07-31 10:50 ` Michal Kazior 2013-07-31 10:50 ` Michal Kazior 2013-08-02 7:15 ` [PATCH v2] ath10k: fix device teardown Michal Kazior 2013-08-02 7:15 ` Michal Kazior 2013-08-02 7:41 ` Kalle Valo 2013-08-02 7:41 ` Kalle Valo 2013-08-02 7:51 ` Michal Kazior 2013-08-02 7:51 ` Michal Kazior 2013-08-02 8:00 ` Kalle Valo 2013-08-02 8:00 ` Kalle Valo 2013-08-05 16:23 ` Kalle Valo 2013-08-05 16:23 ` Kalle Valo
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=87d2pzuc90.fsf@kamboji.qca.qualcomm.com \ --to=kvalo@qca.qualcomm.com \ --cc=ath10k@lists.infradead.org \ --cc=linux-wireless@vger.kernel.org \ --cc=michal.kazior@tieto.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.