Re: BUG: imx.c serial driver DMA race/hang on i.MX6Q

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear Fabio,

On Mon, 22 Jun 2015 08:33:08 +0200
David Jander <david@xxxxxxxxxxx> wrote:

> Dear Fabio,
> 
> Thanks for replying.
> 
> On Sat, 20 Jun 2015 15:05:16 -0300
> Fabio Estevam <festevam@xxxxxxxxx> wrote:
> 
> > On Thu, Jun 18, 2015 at 6:47 AM, David Jander <david@xxxxxxxxxxx> wrote:
> > >
> > > Hi
> > >
> > > I am having the imx.c serial port driver hang in imx_shutdown().
> > > I am running 4.1-rc8 on an i.MX6Q board.
> > > If the user-space application calls close() on the serial device,
> > > imx_shutdown() hangs in his line:
> > >
> > >         ret = wait_event_interruptible(sport->dma_wait,
> > >                         !sport->dma_is_rxing && !sport->dma_is_txing);
> > >
> > > wait_event_interruptible() does not return unless I receive some more
> > > data. When entering wait_event_interruptible, sport->dma_is_rxing == 1
> > > and sport->dma_is_txing == 0.
> > > From that moment onwards, dma_rx_callback() is not called unless I
> > > receive more data, so sport->dma_is_rxing never gets cleared.
> > > While bisecting the problem, I could identify the following commit as the
> > > one that broke the driver for me:
> > >
> > > 068500e serial: imx: initialized DMA w/o HW flow enabled
> > >
> > > Obviously the problem is not in this commit, but probably in the DMA
> > > code. I am using this driver on an i.MX6Q and have tried sdma firmware
> > > version 1.1 and 3.1 so far. The problem appears the same with both.
> > 
> > Could you also try it without loading any external SDMA firmware?
> 
> Just tried and indeed, the problem is gone when using the ROM firmware.
> But isn't the external firmware supposed to patch other bugs in the ROM
> firmware? What are the consequences of using the ROM firmware?

I am afraid this was a little too soon. There are still problems with DMA,
even using the ROM firmware, it is just that the close() system call is not
hanging anymore.

I am considering to propose reversal of '068500e serial: imx: initialized DMA
w/o HW flow enabled', because I suspect that SDMA support in this driver is
just broken. I base this conclusion on the following test results:

Test 1: Incoming data on imx serial port at 115200 baud in bursts
(communication frames).

Test 2: Outgoing data bursts (TX) with single-byte answers (RX).

- imx.c and SDMA firmware version 3.1 or 1.1: The DMA interrupt in imx.c is
  not fired on the 1-byte reply and system call close() hangs on Test 2. I
  also see sporadic corruption in Test 1, where it is always the last byte of
  a frame that gets lost.

- imx.c and SDMA firmware ROM version (no external firmware loaded): Sporadic
  RX data corruption. Single bytes get dropped or corrupted anywhere in the
  middle of a frame on Test 1.

- imx.c with patch 068500e reverted (i.e. no DMA support): Both Test 1 and
  Test 2 work without any errors.

All of this is tested on 4.1-rc8.

Conclusion: (S)DMA support in drivers/tty/serial/imx.c is broken at least for
i.MX6.

So, I guess either we attempt to fix SDMA support in imx.c, or we revert
commit 068500e for the time being.

Best regards,

-- 
David Jander
Protonic Holland.
--
To unsubscribe from this list: send the line "unsubscribe linux-serial" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux