From: Tony Lindgren <tony@atomide.com>
To: Juha Yrjola <juha.yrjola@solidboot.com>
Cc: "Shilimkar, Santosh" <santosh.shilimkar@ti.com>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH] ARM OMAP: Fix race in OMAP2/3 DMA IRQ handling
Date: Thu, 22 Jan 2009 17:27:48 -0800 [thread overview]
Message-ID: <20090123012744.GH7172@atomide.com> (raw)
In-Reply-To: <49782AAF.4070506@solidboot.com>
* Juha Yrjola <juha.yrjola@solidboot.com> [090122 00:34]:
> Shilimkar, Santosh wrote:
>>> --- a/arch/arm/plat-omap/dma.c
>>> +++ b/arch/arm/plat-omap/dma.c
>>> @@ -1898,11 +1898,11 @@ static int omap2_dma_handle_ch(int ch)
>>> status = dma_read(CSR(ch));
>>> }
>>> + dma_write(status, CSR(ch));
>> This is not necessary. Refers line "dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(ch));" just above.
>
> Yes, the current DMA code is full of inconsistencies and illogic. In
> general, clearing a hard-coded mask of bits in an IRQ status register is
> a nice way to enter a race with the machine. And that's a race you
> cannot win every time, so you'll miss IRQs that you haven't handled yet.
>
> A major cleanup should be done to the DMA code, but that's no reason not
> to fix bugs now.
>
>> It will any way do the job of clearing. In a way, clear done after
>> the callback has no effect since the status reg and global IRQ_enable for
>> the particular channel is already disabled before that.
>
> Yes, in a way that completely ignores the code and hardware behaviour.
>
> If you write a 1 to, say, the FRAME bit of the CSR *after* a transfer
> has been completed, *before* handling the event, you lose the CSR value,
> so the channel handling function complains (correctly) about a spurious
> IRQ and refuses to do anything more productive.
>
> If you start a quick transfer from the callback function, the FRAME bit
> *will* get set before control returns from the callback function.
>
>> So dma library is safe from the problem you have described.
>
> Sounds like you're in denial, man. I didn't just randomly send a patch,
> I actually ran into the problem, fixed it, verified it indeed is fixed,
> and only after that did I send it.
Pushed to l-o master and omap-2.6.28 branches, and added to omap-fixes
queue for the mainline.
Tony
next prev parent reply other threads:[~2009-01-23 1:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-21 17:24 [PATCH] ARM OMAP: Fix race in OMAP2/3 DMA IRQ handling Juha Yrjölä
2009-01-22 3:51 ` Shilimkar, Santosh
2009-01-22 8:13 ` Juha Yrjola
2009-01-23 1:27 ` Tony Lindgren [this message]
2009-01-23 4:35 ` Shilimkar, Santosh
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=20090123012744.GH7172@atomide.com \
--to=tony@atomide.com \
--cc=juha.yrjola@solidboot.com \
--cc=linux-omap@vger.kernel.org \
--cc=santosh.shilimkar@ti.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