From: vinod.koul@intel.com (Vinod Koul)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] dmaengine: virt-dma: don't always free descriptor upon completion
Date: Thu, 24 Sep 2015 22:56:21 +0530 [thread overview]
Message-ID: <20150924172621.GD2381@localhost> (raw)
In-Reply-To: <1441539654-19055-1-git-send-email-robert.jarzmik@free.fr>
On Sun, Sep 06, 2015 at 01:40:52PM +0200, Robert Jarzmik wrote:
> @@ -29,7 +29,7 @@ dma_cookie_t vchan_tx_submit(struct dma_async_tx_descriptor *tx)
> spin_lock_irqsave(&vc->lock, flags);
> cookie = dma_cookie_assign(tx);
>
> - list_add_tail(&vd->node, &vc->desc_submitted);
> + list_move_tail(&vd->node, &vc->desc_submitted);
I am not sure I follow this, why move ?
> +int vchan_tx_desc_free(struct dma_async_tx_descriptor *tx)
> +{
> + struct virt_dma_chan *vc = to_virt_chan(tx->chan);
> + struct virt_dma_desc *vd = to_virt_desc(tx);
> + unsigned long flags;
> +
> + spin_lock_irqsave(&vc->lock, flags);
> + list_del(&vd->node);
> + spin_unlock_irqrestore(&vc->lock, flags);
> +
> + dev_dbg(vc->chan.device->dev, "vchan %p: txd %p[%x]: freeing\n",
> + vc, vd, vd->tx.cookie);
> + vc->desc_free(vd);
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(vchan_tx_desc_free);
this one seems okay, can you add comments here and also update documentation
for this
> @@ -96,9 +115,13 @@ void vchan_dma_desc_free_list(struct virt_dma_chan *vc, struct list_head *head)
> while (!list_empty(head)) {
> struct virt_dma_desc *vd = list_first_entry(head,
> struct virt_dma_desc, node);
> - list_del(&vd->node);
> - dev_dbg(vc->chan.device->dev, "txd %p: freeing\n", vd);
> - vc->desc_free(vd);
> + if (dmaengine_desc_test_reuse(&vd->tx)) {
> + list_move_tail(&vd->node, &vc->desc_allocated);
should we check this if the list is to be freed? Why would anyone call free
except when cleaning up ?
> static inline void vchan_free_chan_resources(struct virt_dma_chan *vc)
> {
> + struct virt_dma_desc *vd;
> unsigned long flags;
> LIST_HEAD(head);
>
> spin_lock_irqsave(&vc->lock, flags);
> vchan_get_all_descriptors(vc, &head);
> + list_for_each_entry(vd, &head, node)
> + dmaengine_desc_clear_reuse(&vd->tx);
why do we want to do this, if we are freeing them
--
~Vinod
WARNING: multiple messages have this Message-ID (diff)
From: Vinod Koul <vinod.koul@intel.com>
To: Robert Jarzmik <robert.jarzmik@free.fr>
Cc: Daniel Mack <daniel@zonque.org>,
Haojian Zhuang <haojian.zhuang@gmail.com>,
Jun Nie <jun.nie@linaro.org>,
Lars-Peter Clausen <lars@metafoo.de>,
dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/3] dmaengine: virt-dma: don't always free descriptor upon completion
Date: Thu, 24 Sep 2015 22:56:21 +0530 [thread overview]
Message-ID: <20150924172621.GD2381@localhost> (raw)
In-Reply-To: <1441539654-19055-1-git-send-email-robert.jarzmik@free.fr>
On Sun, Sep 06, 2015 at 01:40:52PM +0200, Robert Jarzmik wrote:
> @@ -29,7 +29,7 @@ dma_cookie_t vchan_tx_submit(struct dma_async_tx_descriptor *tx)
> spin_lock_irqsave(&vc->lock, flags);
> cookie = dma_cookie_assign(tx);
>
> - list_add_tail(&vd->node, &vc->desc_submitted);
> + list_move_tail(&vd->node, &vc->desc_submitted);
I am not sure I follow this, why move ?
> +int vchan_tx_desc_free(struct dma_async_tx_descriptor *tx)
> +{
> + struct virt_dma_chan *vc = to_virt_chan(tx->chan);
> + struct virt_dma_desc *vd = to_virt_desc(tx);
> + unsigned long flags;
> +
> + spin_lock_irqsave(&vc->lock, flags);
> + list_del(&vd->node);
> + spin_unlock_irqrestore(&vc->lock, flags);
> +
> + dev_dbg(vc->chan.device->dev, "vchan %p: txd %p[%x]: freeing\n",
> + vc, vd, vd->tx.cookie);
> + vc->desc_free(vd);
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(vchan_tx_desc_free);
this one seems okay, can you add comments here and also update documentation
for this
> @@ -96,9 +115,13 @@ void vchan_dma_desc_free_list(struct virt_dma_chan *vc, struct list_head *head)
> while (!list_empty(head)) {
> struct virt_dma_desc *vd = list_first_entry(head,
> struct virt_dma_desc, node);
> - list_del(&vd->node);
> - dev_dbg(vc->chan.device->dev, "txd %p: freeing\n", vd);
> - vc->desc_free(vd);
> + if (dmaengine_desc_test_reuse(&vd->tx)) {
> + list_move_tail(&vd->node, &vc->desc_allocated);
should we check this if the list is to be freed? Why would anyone call free
except when cleaning up ?
> static inline void vchan_free_chan_resources(struct virt_dma_chan *vc)
> {
> + struct virt_dma_desc *vd;
> unsigned long flags;
> LIST_HEAD(head);
>
> spin_lock_irqsave(&vc->lock, flags);
> vchan_get_all_descriptors(vc, &head);
> + list_for_each_entry(vd, &head, node)
> + dmaengine_desc_clear_reuse(&vd->tx);
why do we want to do this, if we are freeing them
--
~Vinod
next prev parent reply other threads:[~2015-09-24 17:26 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-06 11:40 [PATCH 1/3] dmaengine: virt-dma: don't always free descriptor upon completion Robert Jarzmik
2015-09-06 11:40 ` Robert Jarzmik
2015-09-06 11:40 ` [PATCH 2/3] dmaengine: enable DMA_CTRL_REUSE Robert Jarzmik
2015-09-06 11:40 ` Robert Jarzmik
2015-09-06 11:40 ` [PATCH 3/3] dmaengine: pxa_dma: declare transfer are reusable Robert Jarzmik
2015-09-06 11:40 ` Robert Jarzmik
2015-09-12 13:08 ` [PATCH 1/3] dmaengine: virt-dma: don't always free descriptor upon completion Robert Jarzmik
2015-09-12 13:08 ` Robert Jarzmik
2015-09-16 19:20 ` Robert Jarzmik
2015-09-16 19:20 ` Robert Jarzmik
2015-09-24 17:26 ` Vinod Koul [this message]
2015-09-24 17:26 ` Vinod Koul
2015-09-24 19:48 ` Robert Jarzmik
2015-09-24 19:48 ` 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=20150924172621.GD2381@localhost \
--to=vinod.koul@intel.com \
--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 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.