From: petr.cvek@tul.cz (Petr Cvek)
To: linux-arm-kernel@lists.infradead.org
Subject: [BUG] dmaengine: pxa_dma: + mmc: pxamci: race condition with DMA error on tx channel
Date: Wed, 8 Mar 2017 07:57:08 +0100 [thread overview]
Message-ID: <e749aff1-0ffc-c9ed-42b2-82397b4e8ba2@tul.cz> (raw)
Hello,
PXA27x DMA changes between:
v4.7
d52bd54db8be8999df6df5a776f38c4f8b5e9cea
and
v4.10-rc5
a4685d2f58e2230d4e27fb2ee581d7ea35e5d046
seems to expose a race condition while using PXA MMC driver on a PXA27x (magician.c machine).
The failure causes one line in the kernel log, after which the filesystem on SD card is inaccessible (and machine too).
mmc0: DMA error on tx channel
I wasn't able to track the problem to a single patch as the problem occurs at random time (from the boot to like a half an hour) and it's maybe dependent on a level of a battery charge (maybe because of kernel log writes of charging messages).
It seems that most occurrency is during writes on an SD card. Using an SDHC card decreases the time to fail. After failure the OS is unavailable (rootfs in on the card).
>From my poking in the kernel source code it seems there is a probability that pxamci_irq() takes longer to call and its subsequent call pxamci_data_done() isn't fast enough to set [1]
host->data = NULL;
>From the DMA side, the DMA done interrupt is generated:
pxad_chan_handler() -> vchan_cookie_complete()
...where a tasklet for vchan_complete() is scheduled, where finally with interrupts enabled (can pxamci_irq() be called here?) the callback pxamci_dma_irq() is called.
>From my tests it seems at this point [2] the host->data is always NULL and rest of the callback is never called. It is called once with a nonempty host->data only just before the failure.
During the testing I put udelay(100) at the start of pxamci_dma_irq() and fail occurred after like 2 hours (when I for the first time tapped the touchscreen - higher CPU usage and interrupts).
[1] http://elixir.free-electrons.com/source/drivers/mmc/host/pxamci.c?v=4.10#L385
[2] http://elixir.free-electrons.com/source/drivers/mmc/host/pxamci.c?v=4.10#L561
Best regards,
Petr
next reply other threads:[~2017-03-08 6:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-08 6:57 Petr Cvek [this message]
2017-03-08 16:43 ` [BUG] dmaengine: pxa_dma: + mmc: pxamci: race condition with DMA error on tx channel Robert Jarzmik
2017-03-10 0:49 ` Petr Cvek
2017-03-14 21:11 ` Robert Jarzmik
2017-03-26 2:43 ` Petr Cvek
2017-04-06 6:42 ` Robert Jarzmik
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=e749aff1-0ffc-c9ed-42b2-82397b4e8ba2@tul.cz \
--to=petr.cvek@tul.cz \
--cc=linux-arm-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox