From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: "Poulain, Loic" <loic.poulain@intel.com>
Cc: "Jin, Yao" <yao.jin@intel.com>,
"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: 8250_dw DMA issue with BYT ?
Date: Thu, 17 Apr 2014 13:21:01 +0300 [thread overview]
Message-ID: <20140417102101.GA17611@xps8300> (raw)
In-Reply-To: <50C3158CF44D924791C15F1437EF2EC65DA634@HASMSX104.ger.corp.intel.com>
Hi Loic,
On Wed, Apr 16, 2014 at 04:34:58PM +0000, Poulain, Loic wrote:
> After analysis, here is my status:
>
> The Bluetooth chip generates hardware errors due to unexpected
> data. These unexpected data are caused by 8250 concurrent TX.
>
> - Concurrent DMA TX (8250_dma.c):
>
> After each DMA transfer, __dma_tx_complete() is called.
> This function updates the circular buffer tail and calls
> serial8250_tx_dma() if data remains.
>
> However these operations are not protected against concurrent
> call of serial8250_tx_dma() (via uart start_tx). So, this concurrent
> call may use non-updated tail index and may be called in parallel
> of an other serial8250_tx_dma().
>
>
> - Concurrent Chars TX (8250_corec.c):
>
> In the serial8250_handle_irq(), serial8250_tx_chars is called if
> UART_LSR_THRE. However we should not call this function
> if we are using the DMA. Moreover, for the same reason as above,
> serial8250_tx_chars could be called with bad tail index or in parallel
> of a serial8250_tx_dma.
Nice job! Thanks a lot for the analysis!
> I think two fixes are necessary:
>
> to avoid tx chars usage:
<snip>
> The last one fixes TX issues but causes random freeze of my
> platform (when uploading file via bluetooth). It seems to be a deadlock.
> I have no kernel trace in my console, system is stuck.
>
> To temporally workaround this, I simply moved "tx_running=0" after updating
> tail index (in __dma_tx_complete) so that no dma_tx can happen before
> this update.
>
> xmit->tail += dma->tx_size;
> xmit->tail &= UART_XMIT_SIZE - 1;
> p->port.icount.tx += dma->tx_size;
>
> dma->tx_running = 0;
As a side note. Since you are in any case playing with the tx_running
flag, could you check if it's possible to drop it and just rely on the
status from the dma engine (with dmaengine_tx_status())?
Thanks,
--
heikki
prev parent reply other threads:[~2014-04-17 10:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-14 15:54 8250_dw DMA issue with BYT ? Poulain, Loic
2014-04-15 6:56 ` Heikki Krogerus
2014-04-15 7:25 ` Andy Shevchenko
2014-04-16 1:33 ` Jin, Yao
2014-04-16 16:34 ` Poulain, Loic
2014-04-17 10:21 ` Heikki Krogerus [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=20140417102101.GA17611@xps8300 \
--to=heikki.krogerus@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=linux-serial@vger.kernel.org \
--cc=loic.poulain@intel.com \
--cc=yao.jin@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).