From: Michal Kazior <michal.kazior@tieto.com>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach
Date: Mon, 29 Apr 2013 09:27:44 +0200 [thread overview]
Message-ID: <517E20F0.9020200@tieto.com> (raw)
In-Reply-To: <20862.7299.137818.979432@gargle.gargle.HOWL>
On 29/04/13 09:08, Sujith Manoharan wrote:
> Sujith Manoharan wrote:
>> ...and it doesn't seem correct to proceed with init after htt_rx_attach() has
>> failed due to memory allocation, since subsequent allocations would probably fail
>> too.
>
> How about something like this ?
>
> [PATCH] ath10k: Remove unneeded locks during HTT RX attach
>
> If buffer allocation fails during attach(), bail out properly
> so the replenish timer doesn't get fired.
>
> Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com>
> ---
> (...)
> @@ -641,23 +645,29 @@ int ath10k_htt_rx_attach(struct ath10k_htt *htt)
> setup_timer(timer, ath10k_htt_rx_ring_refill_retry, (unsigned long)htt);
>
> spin_lock_init(&htt->rx_ring.lock);
> - spin_lock_bh(&htt->rx_ring.lock);
> +
> htt->rx_ring.fill_cnt = 0;
> - ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level);
> - spin_unlock_bh(&htt->rx_ring.lock);
> + if (ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level))
> + goto err_fill_ring;
Won't this still fail the lockdep assertion?
We're also leaking memory upon failure. We need to free up the skbuffs
we successfully allocated & mapped.
If you want to check if the ath10k_htt_rx_ring_fill_n() failed you could
simply compare fill_level and fill_cnt while (still) holding the spinlock:
spin_lock_bh(&htt->rx_ring.lock);
htt->rx_ring.fill_cnt = 0;
ath10k_htt_rx_ring_fill_n(htt, htt->rx_ring.fill_level);
if (htt->rx_ring.fill_cnt != htt->rx_ring.fill_level) {
// handle failure
}
spin_unlock_bh(&htt->rx_ring.lock);
I'm not even sure if we should abort right away. We replenish htt rx
buffers using GFP_ATOMIC allocation. This can fail under memory pressure
more often (then, say, GFP_KERNEL). I wouldn't really consider this as
fatal error. Although we could probably have a ath10k_warn/info if the
initial allocation doesn't fill everything up. Perhaps we could fail
only if the fill_cnt is still 0, or below a defined threshold?
We could also try and split the replenishing functions and use
GFP_KERNEL allocation during htt rx attach.
-- Pozdrawiam / Best regards, Michal Kazior.
next prev parent reply other threads:[~2013-04-29 7:27 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-28 15:31 [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 02/20] ath10k: Merge mac.h with core.h Sujith Manoharan
2013-04-30 18:23 ` Kalle Valo
2013-04-30 23:51 ` Sujith Manoharan
2013-05-02 7:41 ` Kalle Valo
2013-05-02 8:38 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 03/20] ath10k: Rename HIF callback post_init as init Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 04/20] ath10k: Remove "ar" inside WMI structure Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 05/20] ath10k: Remove "htc" inside HTT struct Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 06/20] ath10k: Move debug routines to debug.c Sujith Manoharan
2013-04-30 18:28 ` Kalle Valo
2013-04-28 15:31 ` [ath9k-devel] [PATCH 07/20] ath10k: Remove void pointers in HTC endpoints Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 08/20] ath10k: Use lockless SKB queue routines Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 09/20] ath10k: Optimize HTC queue handling Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 10/20] ath10k: Remove "credits_used" from SKB CB Sujith Manoharan
2013-04-29 5:45 ` Michal Kazior
2013-04-29 6:02 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 11/20] ath10k: Disable credit flow control for EP0 Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 12/20] ath10k: Optimize credit allocation Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 13/20] ath10k: Remove unused variable in processing credit report Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 14/20] ath10k: Print HTC service name Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 15/20] ath10k: Fix typo Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 16/20] ath10k: Merge txrx.c with HTT Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 17/20] ath10k: Use IS_ALIGNED macro to check alignment Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 18/20] ath10k: Move htt_rx_ind_get_mpdu_ranges to htt_rx.c Sujith Manoharan
2013-04-29 5:51 ` Michal Kazior
2013-04-29 6:03 ` Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 19/20] ath10k: Simplify excessively nested HTT structure layout Sujith Manoharan
2013-04-28 15:31 ` [ath9k-devel] [PATCH 20/20] ath10k: Remove unneeded locks during HTT RX attach Sujith Manoharan
2013-04-29 6:07 ` Michal Kazior
2013-04-29 6:41 ` Sujith Manoharan
2013-04-29 6:48 ` Sujith Manoharan
2013-04-29 7:08 ` Sujith Manoharan
2013-04-29 7:27 ` Michal Kazior [this message]
2013-04-29 8:14 ` Sujith Manoharan
2013-04-29 8:34 ` Michal Kazior
2013-04-29 8:47 ` Sujith Manoharan
2013-04-30 11:43 ` [ath9k-devel] [PATCH 01/20] ath10k: Remove duplicate UART init code Kalle Valo
2013-04-30 13:21 ` Sujith Manoharan
2013-04-30 13:38 ` Kalle Valo
2013-04-30 13:42 ` Sujith Manoharan
2013-04-30 13:55 ` Sujith Manoharan
2013-04-30 14:00 ` 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=517E20F0.9020200@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.