Re: [PATCH 11/12] DMAENGINE: let PL08X memcpy TXDs wait

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Walleij
Date: Thursday, September 23, 2010 - 12:39 am

2010/9/23 Dan Williams <dan.j.williams@intel.com>:

I was sort of suspecting a discussion around this...

Background: the PL081 that I'm testing on only has *two* physical
channels, they can be used for memcpy, slave transfers (RX/TX).

My first option was to set one channel aside for memcpy and
one for dev xfers and be done with it.

But that would be devastating if
I was only using them for memcpy or only devxfer, since it would
slash performance in half. So I decided to let memcpy and
dev xfers battle for the channels with oversubscription and exposing
two virtual memcpy channels.

Whereas the slave drivers I've written are prepared to handle the
case where a transfer fails gracefully (and not treat it as an error)
and fall back to IRQ/PIO mode, the memcpy tests in
drivers/dma/dmatest.c does treat a failure to prep() or submit()
as an error.

So for this reason I'm queueing memcpy requests until
there is a channel ready.

Are you suggesting I should rewrite the memcpy tests instead
so they gracefully handle a failed prep() call, not treat it as an
error and either:

- retry or
- copy with a regular klibc memcpy() call?


It is possible to do this at prep() time. However that assumes that every
device transfer has code that executes this sequence:

.device_prep_slave_sg()
.tx_submit()
.device_issue_pending()

In direct succession. If there is an arbitrary delay between prep()
and submit() (where I currently fail xfers) the physical channels
may starve if prep() allocates them.

If I can safely assume that prep() and .tx_submit() are in quick
succession, I can reserve the physical channel at prep() time.

This seems to be the case in current code where only quick
things like setting a callback etc is done between prep() and
.tx_submit().

So I'll spin the PL08x around to reserve channels on
prep() instead.

(By the way: we should rename .tx_submit() to just .submit()
since in device context this can just as well be RX!)


OK I've implemented failure path for tx_submit() in all my
drivers but I also have it for prep() of course. I hope I can keep
that code... I'll take out the comments about allocation failure
and move them to the prep() calls though.

Yours,
Linus Walleij
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[00/12] DMAENGINE: PL08X driver updates, Linus Walleij, (Tue Aug 31, 5:12 am)
[PATCH 07/12] DMAENGINE: add debugfs file for PL08X, Linus Walleij, (Tue Aug 31, 5:12 am)
[PATCH 11/12] DMAENGINE: let PL08X memcpy TXDs wait, Linus Walleij, (Tue Aug 31, 5:12 am)
Re: [00/12] DMAENGINE: PL08X driver updates, Linus Walleij, (Wed Sep 8, 7:26 am)
Re: [00/12] DMAENGINE: PL08X driver updates, Dan Williams, (Sat Sep 18, 11:52 am)
Re: [PATCH 11/12] DMAENGINE: let PL08X memcpy TXDs wait, Dan Williams, (Wed Sep 22, 9:59 pm)
Re: [PATCH 11/12] DMAENGINE: let PL08X memcpy TXDs wait, Linus Walleij, (Thu Sep 23, 12:39 am)
Re: [PATCH 11/12] DMAENGINE: let PL08X memcpy TXDs wait, Linus Walleij, (Thu Sep 23, 12:46 am)
Re: [PATCH 11/12] DMAENGINE: let PL08X memcpy TXDs wait, Dan Williams, (Thu Sep 23, 8:29 am)
Re: [PATCH 11/12] DMAENGINE: let PL08X memcpy TXDs wait, Dan Williams, (Thu Sep 23, 8:35 am)