From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Vinod Koul <vinod.koul@intel.com>,
Kuninori Morimoto <kuninori.morimoto.gx@gmail.com>,
dmaengine@vger.kernel.org, linux-sh@vger.kernel.org,
Magnus Damm <magnus.damm@gmail.com>,
Linux-ALSA <alsa-devel@alsa-project.org>,
linux-arm-kernel@lists.infradead.org,
Maxime Ripard <maxime.ripard@free-electrons.com>
Subject: Re: DMA engine API issue (was: [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support)
Date: Mon, 04 Aug 2014 19:00:36 +0200 [thread overview]
Message-ID: <2568292.I2Yo4lJlu6@avalon> (raw)
In-Reply-To: <20140801143020.GQ30282@n2100.arm.linux.org.uk>
Hi Russell,
On Friday 01 August 2014 15:30:20 Russell King - ARM Linux wrote:
> On Fri, Aug 01, 2014 at 10:51:26AM +0200, Laurent Pinchart wrote:
> > I'll take this opportunity to question why we have a separation between
> > tx_submit and issue_pending. What's the rationale for that, especially
> > given that dma_issue_pending_all() might kick in at any point and issue
> > pending transfers for all devices. A driver could thus see its submitted
> > but not issued transactions being issued before it explicitly calls
> > dma_async_issue_pending().
>
> A prepared but not submitted transaction is not a pending transaction.
>
> The split is necessary so that a callback can be attached to the
> transaction. This partially comes from the async-tx API, and also
> gets a lot of use with the slave API.
>
> The prepare function allocates the descriptor and does the initial
> setup, but does not mark the descriptor as a pending transaction.
> It returns the descriptor, and the caller is then free to add a
> callback function and data pointer to the descriptor before finally
> submitting it.
No disagreement on that. However, as Geert pointed out, my question was
related to the split between dmaengine_submit() and dma_async_issue_pending(),
not between the prep_* functions and dmaengine_submit().
> This sequence must occur in a timely manner as some DMA engine
> implementations hold a lock between the prepare and submit callbacks (Dan
> explicitly permits this as part of the API.)
That really triggers a red alarm in the part of my brain that deals with API
design, but I suppose it would be too difficult to change that.
> > The DMA_PRIVATE capability flag seems to play a role here, but it's far
> > from being clear how that mechanism is supposed to work. This should be
> > documented as well, and any light you could shed on this dark corner of
> > the API would help.
>
> Why do you think that DMA_PRIVATE has a bearing in the callbacks? It
> doesn't.
Not on callbacks, but on how pending descriptors are pushed to the hardware.
The flag is explicitly checked in dma_issue_pending_all().
> DMA_PRIVATE is all about channel allocation as I explained yesterday, and
> whether the channel is available for async_tx usage.
>
> A channel marked DMA_PRIVATE is not available for async_tx usage at
> any moment. A channel without DMA_PRIVATE is available for async_tx
> usage until it is allocated for the slave API - at which point the
> generic DMA engine code will mark the channel with DMA_PRIVATE,
> thereby taking it away from async_tx API usage. When the slave API
> frees the channel, DMA_PRIVATE will be cleared, making the channel
> available for async_tx usage.
>
> So, basically, DMA_PRIVATE set -> async_tx usage not allowed.
> DMA_PRIVATE clear -> async_tx usage permitted. It really is that
> simple.
DMA_PRIVATE is a dma_device flag, not a dma_chan flag. As soon as one channel
is allocated by __dma_request_channel() the whole device is marked with
DMA_PRIVATE, making all channels private. What am I missing ?
> > Similarly, the DMA engine API is split in functions with different
> > prefixes (mostly dmaengine_*, dma_async_*, dma_*, and various
> > unprefixed niceties such as async_tx_ack or txd_lock. If there's a
> > rationale for that (beyond just historical reasons) it should also
> > be documented, otherwise a cleanup would help all the confused DMA
> > engine users (myself included).
>
> dmaengine_* are generally the interface functions to the DMA engine code,
> which have been recently introduced to avoid the multiple levels of
> pointer indirection having to be typed in every driver.
>
> dma_async_* are the DMA engine interface functions for the async_tx API.
>
> dma_* predate the dmaengine_* naming, and are probably too generic, so
> should probably end up being renamed to dmaengine_*.
Thank you for the confirmation. I'll see if I can cook up a patch. It will
likely be pretty large and broad though, but I guess there's no way around it.
> txd_* are all about the DMA engine descriptors.
>
> async_tx_* are the higher level async_tx API functions.
Thank you for the information. How about the dma_async_* functions, should
they be renamed to dmaengine_* as well ? Or are some of them part of the
async_tx_* API ?
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: Vinod Koul <vinod.koul@intel.com>,
Kuninori Morimoto <kuninori.morimoto.gx@gmail.com>,
dmaengine@vger.kernel.org, linux-sh@vger.kernel.org,
Magnus Damm <magnus.damm@gmail.com>,
Linux-ALSA <alsa-devel@alsa-project.org>,
linux-arm-kernel@lists.infradead.org,
Maxime Ripard <maxime.ripard@free-electrons.com>
Subject: Re: DMA engine API issue (was: [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support)
Date: Mon, 04 Aug 2014 17:00:36 +0000 [thread overview]
Message-ID: <2568292.I2Yo4lJlu6@avalon> (raw)
In-Reply-To: <20140801143020.GQ30282@n2100.arm.linux.org.uk>
Hi Russell,
On Friday 01 August 2014 15:30:20 Russell King - ARM Linux wrote:
> On Fri, Aug 01, 2014 at 10:51:26AM +0200, Laurent Pinchart wrote:
> > I'll take this opportunity to question why we have a separation between
> > tx_submit and issue_pending. What's the rationale for that, especially
> > given that dma_issue_pending_all() might kick in at any point and issue
> > pending transfers for all devices. A driver could thus see its submitted
> > but not issued transactions being issued before it explicitly calls
> > dma_async_issue_pending().
>
> A prepared but not submitted transaction is not a pending transaction.
>
> The split is necessary so that a callback can be attached to the
> transaction. This partially comes from the async-tx API, and also
> gets a lot of use with the slave API.
>
> The prepare function allocates the descriptor and does the initial
> setup, but does not mark the descriptor as a pending transaction.
> It returns the descriptor, and the caller is then free to add a
> callback function and data pointer to the descriptor before finally
> submitting it.
No disagreement on that. However, as Geert pointed out, my question was
related to the split between dmaengine_submit() and dma_async_issue_pending(),
not between the prep_* functions and dmaengine_submit().
> This sequence must occur in a timely manner as some DMA engine
> implementations hold a lock between the prepare and submit callbacks (Dan
> explicitly permits this as part of the API.)
That really triggers a red alarm in the part of my brain that deals with API
design, but I suppose it would be too difficult to change that.
> > The DMA_PRIVATE capability flag seems to play a role here, but it's far
> > from being clear how that mechanism is supposed to work. This should be
> > documented as well, and any light you could shed on this dark corner of
> > the API would help.
>
> Why do you think that DMA_PRIVATE has a bearing in the callbacks? It
> doesn't.
Not on callbacks, but on how pending descriptors are pushed to the hardware.
The flag is explicitly checked in dma_issue_pending_all().
> DMA_PRIVATE is all about channel allocation as I explained yesterday, and
> whether the channel is available for async_tx usage.
>
> A channel marked DMA_PRIVATE is not available for async_tx usage at
> any moment. A channel without DMA_PRIVATE is available for async_tx
> usage until it is allocated for the slave API - at which point the
> generic DMA engine code will mark the channel with DMA_PRIVATE,
> thereby taking it away from async_tx API usage. When the slave API
> frees the channel, DMA_PRIVATE will be cleared, making the channel
> available for async_tx usage.
>
> So, basically, DMA_PRIVATE set -> async_tx usage not allowed.
> DMA_PRIVATE clear -> async_tx usage permitted. It really is that
> simple.
DMA_PRIVATE is a dma_device flag, not a dma_chan flag. As soon as one channel
is allocated by __dma_request_channel() the whole device is marked with
DMA_PRIVATE, making all channels private. What am I missing ?
> > Similarly, the DMA engine API is split in functions with different
> > prefixes (mostly dmaengine_*, dma_async_*, dma_*, and various
> > unprefixed niceties such as async_tx_ack or txd_lock. If there's a
> > rationale for that (beyond just historical reasons) it should also
> > be documented, otherwise a cleanup would help all the confused DMA
> > engine users (myself included).
>
> dmaengine_* are generally the interface functions to the DMA engine code,
> which have been recently introduced to avoid the multiple levels of
> pointer indirection having to be typed in every driver.
>
> dma_async_* are the DMA engine interface functions for the async_tx API.
>
> dma_* predate the dmaengine_* naming, and are probably too generic, so
> should probably end up being renamed to dmaengine_*.
Thank you for the confirmation. I'll see if I can cook up a patch. It will
likely be pretty large and broad though, but I guess there's no way around it.
> txd_* are all about the DMA engine descriptors.
>
> async_tx_* are the higher level async_tx API functions.
Thank you for the information. How about the dma_async_* functions, should
they be renamed to dmaengine_* as well ? Or are some of them part of the
async_tx_* API ?
--
Regards,
Laurent Pinchart
WARNING: multiple messages have this Message-ID (diff)
From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: DMA engine API issue (was: [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support)
Date: Mon, 04 Aug 2014 19:00:36 +0200 [thread overview]
Message-ID: <2568292.I2Yo4lJlu6@avalon> (raw)
In-Reply-To: <20140801143020.GQ30282@n2100.arm.linux.org.uk>
Hi Russell,
On Friday 01 August 2014 15:30:20 Russell King - ARM Linux wrote:
> On Fri, Aug 01, 2014 at 10:51:26AM +0200, Laurent Pinchart wrote:
> > I'll take this opportunity to question why we have a separation between
> > tx_submit and issue_pending. What's the rationale for that, especially
> > given that dma_issue_pending_all() might kick in at any point and issue
> > pending transfers for all devices. A driver could thus see its submitted
> > but not issued transactions being issued before it explicitly calls
> > dma_async_issue_pending().
>
> A prepared but not submitted transaction is not a pending transaction.
>
> The split is necessary so that a callback can be attached to the
> transaction. This partially comes from the async-tx API, and also
> gets a lot of use with the slave API.
>
> The prepare function allocates the descriptor and does the initial
> setup, but does not mark the descriptor as a pending transaction.
> It returns the descriptor, and the caller is then free to add a
> callback function and data pointer to the descriptor before finally
> submitting it.
No disagreement on that. However, as Geert pointed out, my question was
related to the split between dmaengine_submit() and dma_async_issue_pending(),
not between the prep_* functions and dmaengine_submit().
> This sequence must occur in a timely manner as some DMA engine
> implementations hold a lock between the prepare and submit callbacks (Dan
> explicitly permits this as part of the API.)
That really triggers a red alarm in the part of my brain that deals with API
design, but I suppose it would be too difficult to change that.
> > The DMA_PRIVATE capability flag seems to play a role here, but it's far
> > from being clear how that mechanism is supposed to work. This should be
> > documented as well, and any light you could shed on this dark corner of
> > the API would help.
>
> Why do you think that DMA_PRIVATE has a bearing in the callbacks? It
> doesn't.
Not on callbacks, but on how pending descriptors are pushed to the hardware.
The flag is explicitly checked in dma_issue_pending_all().
> DMA_PRIVATE is all about channel allocation as I explained yesterday, and
> whether the channel is available for async_tx usage.
>
> A channel marked DMA_PRIVATE is not available for async_tx usage at
> any moment. A channel without DMA_PRIVATE is available for async_tx
> usage until it is allocated for the slave API - at which point the
> generic DMA engine code will mark the channel with DMA_PRIVATE,
> thereby taking it away from async_tx API usage. When the slave API
> frees the channel, DMA_PRIVATE will be cleared, making the channel
> available for async_tx usage.
>
> So, basically, DMA_PRIVATE set -> async_tx usage not allowed.
> DMA_PRIVATE clear -> async_tx usage permitted. It really is that
> simple.
DMA_PRIVATE is a dma_device flag, not a dma_chan flag. As soon as one channel
is allocated by __dma_request_channel() the whole device is marked with
DMA_PRIVATE, making all channels private. What am I missing ?
> > Similarly, the DMA engine API is split in functions with different
> > prefixes (mostly dmaengine_*, dma_async_*, dma_*, and various
> > unprefixed niceties such as async_tx_ack or txd_lock. If there's a
> > rationale for that (beyond just historical reasons) it should also
> > be documented, otherwise a cleanup would help all the confused DMA
> > engine users (myself included).
>
> dmaengine_* are generally the interface functions to the DMA engine code,
> which have been recently introduced to avoid the multiple levels of
> pointer indirection having to be typed in every driver.
>
> dma_async_* are the DMA engine interface functions for the async_tx API.
>
> dma_* predate the dmaengine_* naming, and are probably too generic, so
> should probably end up being renamed to dmaengine_*.
Thank you for the confirmation. I'll see if I can cook up a patch. It will
likely be pretty large and broad though, but I guess there's no way around it.
> txd_* are all about the DMA engine descriptors.
>
> async_tx_* are the higher level async_tx API functions.
Thank you for the information. How about the dma_async_* functions, should
they be renamed to dmaengine_* as well ? Or are some of them part of the
async_tx_* API ?
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-08-04 17:00 UTC|newest]
Thread overview: 78+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-22 12:33 [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support Laurent Pinchart
2014-07-23 2:17 ` Kuninori Morimoto
2014-07-23 10:28 ` Laurent Pinchart
2014-07-23 10:28 ` Laurent Pinchart
2014-07-23 11:07 ` DMA engine API issue (was: [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support) Laurent Pinchart
2014-07-23 11:07 ` Laurent Pinchart
2014-07-23 11:07 ` Laurent Pinchart
2014-07-24 0:46 ` Kuninori Morimoto
2014-07-24 0:46 ` Kuninori Morimoto
2014-07-24 0:46 ` Kuninori Morimoto
2014-07-24 1:35 ` Kuninori Morimoto
2014-07-24 1:35 ` Kuninori Morimoto
2014-07-24 1:35 ` Kuninori Morimoto
2014-07-24 4:53 ` Vinod Koul
2014-07-24 4:59 ` Vinod Koul
2014-07-24 4:53 ` Vinod Koul
2014-07-24 4:52 ` Vinod Koul
2014-07-24 4:58 ` Vinod Koul
2014-07-24 4:52 ` Vinod Koul
2014-08-01 8:51 ` Laurent Pinchart
2014-08-01 8:51 ` Laurent Pinchart
2014-08-01 8:51 ` Laurent Pinchart
2014-08-01 14:30 ` Russell King - ARM Linux
2014-08-01 14:30 ` Russell King - ARM Linux
2014-08-01 14:30 ` Russell King - ARM Linux
2014-08-01 17:09 ` Vinod Koul
2014-08-01 17:21 ` Vinod Koul
2014-08-01 17:09 ` Vinod Koul
2014-08-04 13:47 ` Geert Uytterhoeven
2014-08-04 13:47 ` Geert Uytterhoeven
2014-08-04 13:47 ` Geert Uytterhoeven
2014-08-04 17:00 ` Laurent Pinchart [this message]
2014-08-04 17:00 ` Laurent Pinchart
2014-08-04 17:00 ` Laurent Pinchart
2014-08-04 17:54 ` Russell King - ARM Linux
2014-08-04 17:54 ` Russell King - ARM Linux
2014-08-04 17:54 ` Russell King - ARM Linux
2014-08-05 23:19 ` Laurent Pinchart
2014-08-05 23:19 ` Laurent Pinchart
2014-08-05 23:19 ` Laurent Pinchart
2014-08-06 7:17 ` Geert Uytterhoeven
2014-08-06 7:17 ` Geert Uytterhoeven
2014-08-06 7:17 ` Geert Uytterhoeven
2014-08-06 11:04 ` Arnd Bergmann
2014-08-06 11:04 ` Arnd Bergmann
2014-08-06 11:04 ` Arnd Bergmann
2014-08-01 17:07 ` Vinod Koul
2014-08-01 17:19 ` Vinod Koul
2014-08-01 17:07 ` Vinod Koul
2014-08-04 16:50 ` Laurent Pinchart
2014-08-04 16:50 ` Laurent Pinchart
2014-08-04 16:50 ` Laurent Pinchart
2014-08-04 18:03 ` DMA engine API issue Lars-Peter Clausen
2014-08-04 18:03 ` Lars-Peter Clausen
2014-08-04 18:03 ` Lars-Peter Clausen
2014-08-04 18:32 ` Russell King - ARM Linux
2014-08-04 18:32 ` Russell King - ARM Linux
2014-08-04 18:32 ` Russell King - ARM Linux
2014-08-04 23:12 ` Laurent Pinchart
2014-08-04 23:12 ` Laurent Pinchart
2014-08-04 23:12 ` Laurent Pinchart
2014-08-05 16:56 ` DMA engine API issue (was: [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support) Vinod Koul
2014-08-05 17:08 ` Vinod Koul
2014-08-05 16:56 ` Vinod Koul
2014-07-24 12:29 ` DMA engine API issue Lars-Peter Clausen
2014-07-24 12:29 ` [alsa-devel] " Lars-Peter Clausen
2014-07-24 12:29 ` Lars-Peter Clausen
2014-07-24 12:51 ` DMA engine API issue (was: [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support) Russell King - ARM Linux
2014-07-24 12:51 ` Russell King - ARM Linux
2014-07-24 12:51 ` Russell King - ARM Linux
2014-08-01 9:24 ` Laurent Pinchart
2014-08-01 9:24 ` Laurent Pinchart
2014-08-01 9:24 ` Laurent Pinchart
2014-07-23 9:48 ` [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support Laurent Pinchart
2014-07-23 23:56 ` Kuninori Morimoto
2014-07-24 8:51 ` [PATCH] ASoC: rsnd: fixup dai remove callback operation Kuninori Morimoto
2014-07-25 17:50 ` Mark Brown
2014-07-24 0:12 ` [PATCH/RFC 0/5] R-Car Gen2 DMAC hardware descriptor list support Laurent Pinchart
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=2568292.I2Yo4lJlu6@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=alsa-devel@alsa-project.org \
--cc=dmaengine@vger.kernel.org \
--cc=kuninori.morimoto.gx@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=magnus.damm@gmail.com \
--cc=maxime.ripard@free-electrons.com \
--cc=vinod.koul@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.