[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-id: <014101ccdf22$eb610d30$c2232790$%szyprowski@samsung.com>
Date: Mon, 30 Jan 2012 08:43:55 +0100
From: Marek Szyprowski <m.szyprowski@...sung.com>
To: 'Ohad Ben-Cohen' <ohad@...ery.com>
Cc: "'Clark, Rob'" <rob@...com>,
'Daniel Walker' <dwalker@...eaurora.org>,
'Russell King' <linux@....linux.org.uk>,
'Arnd Bergmann' <arnd@...db.de>,
'Jonathan Corbet' <corbet@....net>,
'Mel Gorman' <mel@....ul.ie>,
'Jesse Barker' <jesse.barker@...aro.org>,
linux-kernel@...r.kernel.org,
'Michal Nazarewicz' <mina86@...a86.com>,
'Dave Hansen' <dave@...ux.vnet.ibm.com>,
linaro-mm-sig@...ts.linaro.org, linux-mm@...ck.org,
'Kyungmin Park' <kyungmin.park@...sung.com>,
'KAMEZAWA Hiroyuki' <kamezawa.hiroyu@...fujitsu.com>,
'Andrew Morton' <akpm@...ux-foundation.org>,
linux-arm-kernel@...ts.infradead.org, linux-media@...r.kernel.org
Subject: RE: [Linaro-mm-sig] [PATCH 12/15] drivers: add Contiguous Memory
Allocator
Hello,
On Saturday, January 28, 2012 7:57 PM Ohad Ben-Cohen wrote:
> On Fri, Jan 27, 2012 at 5:17 PM, Marek Szyprowski
> <m.szyprowski@...sung.com> wrote:
> > There have been some vmalloc layout changes merged to v3.3-rc1.
>
> That was dead-on, thanks a lot!
Did you managed to fix this issue?
>
> I did then bump into a different allocation failure which happened
> because dma_alloc_from_contiguous() computes 'mask' before capping the
> 'align' argument.
>
> The early 'mask' computation was added in v18 (and therefore exists in
> v19 too) and I was actually testing v17 previously, so I didn't notice
> it before.
Right, thanks for spotting it, I will squash it to the next release.
> You may want to squash something like this:
>
> diff --git a/drivers/base/dma-contiguous.c b/drivers/base/dma-contiguous.c
> index f41e699..8455cb7 100644
> --- a/drivers/base/dma-contiguous.c
> +++ b/drivers/base/dma-contiguous.c
> @@ -319,8 +319,7 @@ struct page *dma_alloc_from_contiguous(struct device *dev, i
> unsigned int align)
> {
> struct cma *cma = dev_get_cma_area(dev);
> - unsigned long pfn, pageno, start = 0;
> - unsigned long mask = (1 << align) - 1;
> + unsigned long mask, pfn, pageno, start = 0;
> int ret;
>
> if (!cma || !cma->count)
> @@ -329,6 +328,8 @@ struct page *dma_alloc_from_contiguous(struct device *dev, i
> if (align > CONFIG_CMA_ALIGNMENT)
> align = CONFIG_CMA_ALIGNMENT;
>
> + mask = (1 << align) - 1;
> +
> pr_debug("%s(cma %p, count %d, align %d)\n", __func__, (void *)cma,
> count, align);
>
Best regards
--
Marek Szyprowski
Samsung Poland R&D Center
--
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