All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeff Johnson <quic_jjohnson@quicinc.com>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
	<kvalo@codeaurora.org>, <linux-wireless@vger.kernel.org>,
	<wcn36xx@lists.infradead.org>
Cc: <loic.poulain@linaro.org>, <benl@squareup.com>,
	<daniel.thompson@linaro.org>, <johannes@sipsolutions.net>
Subject: Re: [PATCH v2 0/5] wcn36xx: Fix DMA buffer allocation and free logic
Date: Tue, 19 Oct 2021 08:59:28 -0700	[thread overview]
Message-ID: <9ac46348-23da-7180-3f80-6a223de97d0e@quicinc.com> (raw)
In-Reply-To: <20211018231722.873525-1-bryan.odonoghue@linaro.org>

On 10/18/2021 4:17 PM, Bryan O'Donoghue wrote:
> V2:
> - Functionally decomposes the DXE reset in an additional patch.
>    Since we call this logic more than once, it should be in a function.
> 
> - Leaves as-is the DXE reset write.
> 
>    Johannes Berg asked me if we are sure by the time the write to the reset
>    register completes that DXE transactions will be suitably quiesced.
> 
>    The answer is:
>    1. I believe these writes are non-posted writes
>    2. Downstream doesn't poll for DXE reset completion
> 
>    So on #2 I have no real data for or against a polling operation, my tests
>    indicate the reset indication in the register is atomic and as far as I
>    can discern that also means DMA transactions are terminated.
> 
> V1:
> Digging around through some bugs reported from an extensive testing cycle
> we've found that wcn36xx has a number of unexplained RX related oopses.
> 
> In at least one case we appear to have DMA'd data to an unmapped region.
> The written data appears to be a correctly formed DMA buffer descriptor - a
> DXE BD in WCNSS parlance, with an AP beacon inside of it.
> 
> Reasoning about how such a situation might come about and reviewing the
> run-time code, there was no obvious path where we might free a BD or an
> skbuff pointed to by a BD, which DXE might not be aware of.
> 
> However looking at the ieee80211_ops.start and ieee80211_ops.stop callbacks
> in wcn36xx we can see a number of bugs associated with BD allocation, error
> handling and leaving the DMA engine active, despite freeing SKBs on the MSM
> side.
> 
> This last mention - failure to quiesce potential DMA from the downstream
> agent - WCNSS DXE despite freeing the memory @ the skbuffs is a decent
> candidate for our unexplained upstream DMA transaction to unmapped memory.
> 
> Since wcn36xx_stop and wcn36xx_start can be called a number of times by the
> controlling upper layers it means there is a potential gap between
> wcn36xx_stop and wcn36xx_start which could leave WCNSS in a state where it
> will try to DMA to memory we have freed.
> 
> This series addresses the obvious bugs that jump out on the start()/stop()
> path.
> 
> Patch #1
>    In order to make it easier to read the DXE code, I've moved all of the
>    lock taking and freeing for DXE into dxe.c
> 
> Patch #2
>    Fixes a very obviously broken channel enable/disable cycle
> 
> Patch #3
>    Fixes a very obvious memory leak with dma_alloc_coherent()
> 
> Patch #4
>    Makes sure before we release skbuffs which we assigned to the RX channels
>    that we ensure the DXE block is put into reset
> 
> Bryan O'Donoghue (5):
>    wcn36xx: Fix dxe lock layering violation
>    wcn36xx: Fix DMA channel enable/disable cycle
>    wcn36xx: Release DMA channel descriptor allocations
>    wcn36xx: Functionally decompose DXE reset
>    wcn36xx: Put DXE block into reset before freeing memory
> 
>   drivers/net/wireless/ath/wcn36xx/dxe.c  | 83 +++++++++++++++++++++----
>   drivers/net/wireless/ath/wcn36xx/dxe.h  |  2 +
>   drivers/net/wireless/ath/wcn36xx/txrx.c | 15 +----
>   3 files changed, 74 insertions(+), 26 deletions(-)
> 

Reviewed-by: Jeff Johnson <quic_jjohnson@quicinc.com>

      parent reply	other threads:[~2021-10-19 15:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-18 23:17 [PATCH v2 0/5] wcn36xx: Fix DMA buffer allocation and free logic Bryan O'Donoghue
2021-10-18 23:17 ` [PATCH v2 1/5] wcn36xx: Fix dxe lock layering violation Bryan O'Donoghue
2021-10-25 13:31   ` Kalle Valo
2021-10-18 23:17 ` [PATCH v2 2/5] wcn36xx: Fix DMA channel enable/disable cycle Bryan O'Donoghue
2021-10-18 23:17 ` [PATCH v2 3/5] wcn36xx: Release DMA channel descriptor allocations Bryan O'Donoghue
2021-10-18 23:17 ` [PATCH v2 4/5] wcn36xx: Functionally decompose DXE reset Bryan O'Donoghue
2021-10-18 23:17 ` [PATCH v2 5/5] wcn36xx: Put DXE block into reset before freeing memory Bryan O'Donoghue
2021-10-19 15:59 ` Jeff Johnson [this message]

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=9ac46348-23da-7180-3f80-6a223de97d0e@quicinc.com \
    --to=quic_jjohnson@quicinc.com \
    --cc=benl@squareup.com \
    --cc=bryan.odonoghue@linaro.org \
    --cc=daniel.thompson@linaro.org \
    --cc=johannes@sipsolutions.net \
    --cc=kvalo@codeaurora.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=wcn36xx@lists.infradead.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.