lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AANLkTikY8bV1DbMEspUNivD2zTiZOyNKL4ydHttLrFKk@mail.gmail.com>
Date:	Fri, 11 Jun 2010 17:05:31 -0700
From:	Dan Williams <dan.j.williams@...el.com>
To:	Linus Walleij <linus.walleij@...ricsson.com>
Cc:	linux-kernel@...r.kernel.org,
	Jonas Aaberg <jonas.aberg@...ricsson.com>
Subject: Re: [PATCH 12/18] DMAENGINE: ste_dma40: allocate LCLA dynamically

On Tue, Jun 1, 2010 at 5:22 AM, Linus Walleij
<linus.walleij@...ricsson.com> wrote:
> Switch to allocating LCLA in memory instead of having a fixed
> address.
>
> Signed-off-by: Jonas Aaberg <jonas.aberg@...ricsson.com>
> Signed-off-by: Linus Walleij <linus.walleij@...ricsson.com>
> ---
>  drivers/dma/ste_dma40.c    |  246 +++++++++++++++++++++++++++-----------------
>  drivers/dma/ste_dma40_ll.c |    5 +-
>  drivers/dma/ste_dma40_ll.h |   12 +-
>  3 files changed, 161 insertions(+), 102 deletions(-)
>
> diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c
> index 5579401..ec092fa 100644
> --- a/drivers/dma/ste_dma40.c
> +++ b/drivers/dma/ste_dma40.c
[..]
> @@ -2482,6 +2501,71 @@ static void __init d40_hw_init(struct d40_base *base)
>
>  }
>
> +static int __init d40_lcla_allocate(struct d40_base *base)
> +{
> +       unsigned long *page_list;
> +       int i, j;
> +       int ret = 0;
> +
> +       /*
> +        * This is somewhat ugly. We need 8192 bytes that are 18 bit aligned,
> +        * To full fill this hardware requirement without wasting 256 kb
> +        * we allocate pages until we get an aligned one.
> +        */
> +       page_list = kmalloc(sizeof(unsigned long) * MAX_LCLA_ALLOC_ATTEMPTS,
> +                           GFP_KERNEL);
> +
> +       if (!page_list) {
> +               ret = -ENOMEM;
> +               goto failure;
> +       }
> +
> +       /* Calculating how many pages that are required */
> +       base->lcla_pool.pages = SZ_1K * (base->num_phy_chans + PAGE_SIZE /
> +                                        SZ_1K - 1) / PAGE_SIZE + 3;
> +

What?

> +       for (i = 0; i < MAX_LCLA_ALLOC_ATTEMPTS; i++) {
> +               page_list[i] = __get_free_pages(GFP_KERNEL,
> +                                               base->lcla_pool.pages);
> +
> +               if ((virt_to_phys((void *)page_list[i]) &
> +                    (LCLA_ALIGNMENT - 1)) == 0 && page_list[i] != 0)
> +                       break;

It looks odd to test for page_list[i] being null after determining if
this is the desired alignment.

--
Dan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ