mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams@intel.com>
To: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: maciej.sosnowski@intel.com, avictor.za@gmail.com,
	linux-arm-kernel@lists.arm.linux.org.uk,
	patrice.vilchez@atmel.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2 v2] dmaengine: at_hdmac: new driver for the Atmel AHB  DMA Controller
Date: Wed, 1 Jul 2009 18:18:23 -0700	[thread overview]
Message-ID: <e9c3a7c20907011818q6151b7e1gf6d89f52296362f2@mail.gmail.com> (raw)
In-Reply-To: <1246012936-10812-1-git-send-email-nicolas.ferre@atmel.com>

On Fri, Jun 26, 2009 at 3:42 AM, Nicolas Ferre<nicolas.ferre@atmel.com> wrote:
> This AHB DMA Controller (aka HDMA or DMAC on AT91 systems) is availlable on
> at91sam9rl chip. It will be used on other products in the future.
>
> This first release covers only the memory-to-memory tranfer type. This is the
> only tranfer type supported by this chip.  On other products, it will be used
> also for peripheral DMA transfer (slave API support to come).
>
> I used dmatest client without problem in different configurations to test it.
>
> Full documentation for this controller can be found in the SAM9RL datasheet:
> http://www.atmel.com/dyn/products/product_card.asp?part_id=4243
>
> Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> ---
[..]

A quick review comment:

> +/**
> + * atc_desc_get - get a unsused descriptor from free_list
> + * @atchan: channel we want a new descriptor for
> + */
> +static struct at_desc *atc_desc_get(struct at_dma_chan *atchan)
> +{
> +       struct at_desc *desc, *_desc;
> +       struct at_desc *ret = NULL;
> +       unsigned int i = 0;
> +       LIST_HEAD(tmp_list);
> +
> +       spin_lock_bh(&atchan->lock);
> +       list_for_each_entry_safe(desc, _desc, &atchan->free_list, desc_node) {
> +               i++;
> +               if (async_tx_test_ack(&desc->txd)) {
> +                       list_del(&desc->desc_node);
> +                       ret = desc;
> +                       break;
> +               }
> +               dev_dbg(chan2dev(&atchan->chan_common),
> +                               "desc %p not ACKed\n", desc);
> +       }
> +       spin_unlock_bh(&atchan->lock);
> +       dev_vdbg(chan2dev(&atchan->chan_common),
> +               "scanned %u descriptors on freelist\n", i);
> +
> +       /* no more descriptor available in initial pool : create some more */
> +       if (!ret) {
> +               for (i = 0; i < INIT_NR_DESCS_PER_CHANNEL; i++) {
> +                       desc = atc_alloc_descriptor(&atchan->chan_common,
> +                                                   GFP_KERNEL);

This cannot be GFP_KERNEL as ->prep_dma_memcpy may be called from an
atomic context.  Given that this should only be done in emergency
situations this allocation should probably happen one descriptor at a
time, if it must happen at all.  My recommendation is that if you find
that the driver runs out of descriptors on a regular basis increase
INIT_NR_DESCS_PER_CHANNEL  and only operate with the descriptors
allocated from atc_alloc_chan_resources().  As it stands this allows
the descriptor list to grow without bounds.

Regards,
Dan

  parent reply	other threads:[~2009-07-02  1:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-26 10:42 Nicolas Ferre
2009-06-26 10:42 ` [PATCH 2/2 v2] at91/dmaengine: integration of at_hdmac driver in at91sam9rl Nicolas Ferre
2009-06-27 15:06 ` [PATCH 1/2 v2] dmaengine: at_hdmac: new driver for the Atmel AHB DMA Controller Atsushi Nemoto
2009-07-01 15:30   ` Nicolas Ferre
2009-07-03 15:12     ` Atsushi Nemoto
2009-07-01 13:58 ` Nicolas Ferre
2009-07-02  0:58   ` Dan Williams
2009-07-02  1:18 ` Dan Williams [this message]
2009-07-03 12:59 ` Sosnowski, Maciej
2009-07-03 13:03   ` Nicolas Ferre
     [not found] ` <0bb1aaf3fca441453fbb9296e1a35d7921d74467.1246641180.git.nicolas.ferre@atmel.com>
2009-07-03 17:24   ` [PATCH 1/2 v3] " Nicolas Ferre
2009-07-17 10:38     ` Nicolas Ferre
2009-07-18 16:01     ` Dan Williams
2009-07-21  8:33       ` Nicolas Ferre
2009-07-22 13:35         ` Sosnowski, Maciej
2009-07-22 18:04     ` [PATCH] dmaengine: at_hdmac: add DMA slave transfers Nicolas Ferre
2009-07-23 17:13       ` Dan Williams
2009-07-24  7:35         ` Nicolas Ferre
2009-07-24 13:29           ` Atsushi Nemoto
2009-07-24 14:10             ` Haavard Skinnemoen
2009-07-27 13:24               ` Sosnowski, Maciej
2009-07-28 15:13                 ` Atsushi Nemoto
2009-07-29 13:05                   ` Sosnowski, Maciej
2009-07-29 15:16                     ` Atsushi Nemoto
2009-07-29 14:27                   ` Dan Williams
2009-07-31  3:58                     ` Atsushi Nemoto
2009-07-27 13:22       ` Sosnowski, Maciej

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=e9c3a7c20907011818q6151b7e1gf6d89f52296362f2@mail.gmail.com \
    --to=dan.j.williams@intel.com \
    --cc=avictor.za@gmail.com \
    --cc=linux-arm-kernel@lists.arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maciej.sosnowski@intel.com \
    --cc=nicolas.ferre@atmel.com \
    --cc=patrice.vilchez@atmel.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

all inboxes | Powered by JetHome®