All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Kazior <michal.kazior@tieto.com>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH 5/6] ath10k: wait for CE to drain when shutting down
Date: Fri, 14 Jun 2013 13:46:32 +0200	[thread overview]
Message-ID: <51BB0298.2070807@tieto.com> (raw)
In-Reply-To: <87ip1hopd9.fsf@kamboji.qca.qualcomm.com>

On 13/06/13 20:08, Kalle Valo wrote:
> Michal Kazior <michal.kazior@tieto.com> writes:
>
>> ath10k_pci_process_ce() is used to process
>> completions. Only one thread can do that though.
>>
>> If one thread starts handling completions then the
>> other one (i.e. possibly PCI shutdown) would exit
>> immediatelely and free up memory while completions
>> are being processed leading to corruption.
>>
>> Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
>
> [...]
>
>> +/* This function assumes no new data is going to be submitted/completed. It is
>> + * mainly intended to flush out completions when stopping the device. */
>> +static void ath10k_pci_wait_for_ce_drain(struct ath10k *ar)
>> +{
>> +	struct ath10k_pci *ar_pci = ath10k_pci_priv(ar);
>> +	int ret;
>> +
>> +	ret = wait_event_timeout(ar_pci->compl_wq, ({
>> +			bool processing;
>> +			spin_lock_bh(&ar_pci->compl_lock);
>> +			processing = ar_pci->compl_processing;
>> +			spin_unlock_bh(&ar_pci->compl_lock);
>> +			(!processing);
>> +		}), 5*HZ);
>> +	if (ret == 0)
>> +		ath10k_warn("timed out while waiting for completions to be processed\n");
>> +}
>
> This looks like a hack to me. Wouldn't it be a better to fix make sure
> that all threads/tasklets are stopped, for example with tasklet_kill()
> and cancel_work_sync()? (And of course first making sure that we don't
> fire new instances). That way we could be sure that there is no other
> thread running while we shutdown.

Apparently I can't reproduce this bug anymore. I can't really locate 
where the other thread could be comming from. Maybe an interrupt? We 
don't unregister interrupt handlers at the point where the issue happens 
(we only stop CE interrupts via registers).

Perhaps we can drop this patch for now and look for a proper solution 
later on?


-- Pozdrawiam / Best regards, Michal Kazior.

  reply	other threads:[~2013-06-14 11:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-12 12:27 [ath9k-devel] [PATCH 0/6] ath10k: fixes Michal Kazior
2013-06-12 12:27 ` [ath9k-devel] [PATCH 1/6] ath10k: embed HTC struct inside ath10k Michal Kazior
2013-06-12 12:27 ` [ath9k-devel] [PATCH 2/6] ath10k: embed HTT " Michal Kazior
2013-06-12 12:27 ` [ath9k-devel] [PATCH 3/6] ath10k: improve locking Michal Kazior
2013-06-12 12:27 ` [ath9k-devel] [PATCH 4/6] ath10k: abort scan properly if wmi_scan_stop fails Michal Kazior
2013-06-12 12:27 ` [ath9k-devel] [PATCH 5/6] ath10k: wait for CE to drain when shutting down Michal Kazior
2013-06-13 18:08   ` Kalle Valo
2013-06-14 11:46     ` Michal Kazior [this message]
2013-06-14 12:10       ` Kalle Valo
2013-06-12 12:27 ` [ath9k-devel] [PATCH 6/6] ath10k: add missing debug prints Michal Kazior
2013-06-12 19:08 ` [ath9k-devel] [PATCH 0/6] ath10k: fixes Kalle Valo
2013-06-13 18:08   ` 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=51BB0298.2070807@tieto.com \
    --to=michal.kazior@tieto.com \
    --cc=ath9k-devel@lists.ath9k.org \
    /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: link
Be 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.