From: Stephen Warren <swarren@wwwdotorg.org>
To: Dmitry Osipenko <digetx@gmail.com>,
Laxman Dewangan <ldewangan@nvidia.com>
Cc: vinod.koul@intel.com, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] dma: tegra20-apbdma: channel freeing correction
Date: Mon, 29 Oct 2012 09:27:09 -0600 [thread overview]
Message-ID: <508EA04D.5050805@wwwdotorg.org> (raw)
In-Reply-To: <1351433873-14082-1-git-send-email-digetx@gmail.com>
On 10/28/2012 08:17 AM, Dmitry Osipenko wrote:
> Fixed channel "lock" after free.
>
> Example: Channel 1 was allocated and prepared as slave_sg, used and freed. Now preparation of cyclic dma on channel 1 will fail with err "DMA
> configuration conflict" because tdc->isr_handler still selected to handle_once_dma_done.
>
> This happens because tegra_dma_abort_all() won't be called on channel freeing if pending list is empty.
That commit description isn't correctly wrapped.
> diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
> @@ -1147,6 +1147,7 @@ static void tegra_dma_free_chan_resources(struct dma_chan *dc)
>
> if (tdc->busy)
> tegra_dma_terminate_all(dc);
> + tdc->isr_handler = NULL;
Should we remove that assignment from tegra_dma_abort_all(); perhaps it
is redundant now?
Actually, I wonder if the correct fix isn't to:
a) Always call tegra_dma_terminate_all() from
tegra_dma_free_chan_resources() irrespective of busy state.
b) Make tegra_dma_terminate_all() always call tegra_dma_abort_all()
irrespective of whether list_empty(&tdc->pending_sg_req).
But then I wonder: should tdc->isr_handler get left set to non-NULL in
the scenario mentioned in your commit description at all; should it be
cleared as soon as the channel is idle in all cases, so that it doesn't
need to be cleared when freeing the channel?
I CC'd Laxman, the driver author, to comment here.
next prev parent reply other threads:[~2012-10-29 15:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-28 14:17 [PATCH 2/2] dma: tegra20-apbdma: channel freeing correction Dmitry Osipenko
2012-10-29 15:27 ` Stephen Warren [this message]
2012-10-29 23:20 ` [PATCH V2] dma: tegra: avoid channel lock up after free Dmitry Osipenko
2012-10-30 18:05 ` Stephen Warren
2012-10-31 14:58 ` Laxman Dewangan
[not found] ` <1351433873-14082-1-git-send-email-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2012-10-31 14:48 ` [PATCH 2/2] dma: tegra20-apbdma: channel freeing correction Laxman Dewangan
2012-10-31 14:48 ` Laxman Dewangan
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=508EA04D.5050805@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=digetx@gmail.com \
--cc=ldewangan@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=vinod.koul@intel.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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).