RE: [PATCH] ARM: dma-mapping: fix atomic allocation alignment

2012-08-07 Thread Marek Szyprowski
Hi Aaro,

On Sunday, August 05, 2012 7:32 PM Aaro Koskinen wrote:

> The alignment mask is calculated incorrectly. Fixing the calculation
> makes strange hangs/lockups disappear during the boot with Amstrad E3
> and 3.6-rc1 kernel.
> 
> Signed-off-by: Aaro Koskinen 

Again, thanks for spotting and fixing the issue. I've applied it to my fixes 
branch. 
I'm really sorry for introducing such stupid bugs together with my changes.

Best regards
-- 
Marek Szyprowski
Samsung Poland R Center


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


RE: [PATCH] ARM: dma-mapping: fix atomic allocation alignment

2012-08-07 Thread Marek Szyprowski
Hi Aaro,

On Sunday, August 05, 2012 7:32 PM Aaro Koskinen wrote:

 The alignment mask is calculated incorrectly. Fixing the calculation
 makes strange hangs/lockups disappear during the boot with Amstrad E3
 and 3.6-rc1 kernel.
 
 Signed-off-by: Aaro Koskinen aaro.koski...@iki.fi

Again, thanks for spotting and fixing the issue. I've applied it to my fixes 
branch. 
I'm really sorry for introducing such stupid bugs together with my changes.

Best regards
-- 
Marek Szyprowski
Samsung Poland RD Center


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


[PATCH] ARM: dma-mapping: fix atomic allocation alignment

2012-08-05 Thread Aaro Koskinen
The alignment mask is calculated incorrectly. Fixing the calculation
makes strange hangs/lockups disappear during the boot with Amstrad E3
and 3.6-rc1 kernel.

Signed-off-by: Aaro Koskinen 
---
 arch/arm/mm/dma-mapping.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 2cc77b7..0e0466d 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -423,7 +423,7 @@ static void *__alloc_from_pool(size_t size, struct page 
**ret_page)
unsigned int pageno;
unsigned long flags;
void *ptr = NULL;
-   size_t align;
+   unsigned long align_mask;
 
if (!pool->vaddr) {
WARN(1, "coherent pool not initialised!\n");
@@ -435,11 +435,11 @@ static void *__alloc_from_pool(size_t size, struct page 
**ret_page)
 * small, so align them to their order in pages, minimum is a page
 * size. This helps reduce fragmentation of the DMA space.
 */
-   align = PAGE_SIZE << get_order(size);
+   align_mask = (1 << get_order(size)) - 1;
 
spin_lock_irqsave(>lock, flags);
pageno = bitmap_find_next_zero_area(pool->bitmap, pool->nr_pages,
-   0, count, (1 << align) - 1);
+   0, count, align_mask);
if (pageno < pool->nr_pages) {
bitmap_set(pool->bitmap, pageno, count);
ptr = pool->vaddr + PAGE_SIZE * pageno;
-- 
1.7.2.5

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


[PATCH] ARM: dma-mapping: fix atomic allocation alignment

2012-08-05 Thread Aaro Koskinen
The alignment mask is calculated incorrectly. Fixing the calculation
makes strange hangs/lockups disappear during the boot with Amstrad E3
and 3.6-rc1 kernel.

Signed-off-by: Aaro Koskinen aaro.koski...@iki.fi
---
 arch/arm/mm/dma-mapping.c |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 2cc77b7..0e0466d 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -423,7 +423,7 @@ static void *__alloc_from_pool(size_t size, struct page 
**ret_page)
unsigned int pageno;
unsigned long flags;
void *ptr = NULL;
-   size_t align;
+   unsigned long align_mask;
 
if (!pool-vaddr) {
WARN(1, coherent pool not initialised!\n);
@@ -435,11 +435,11 @@ static void *__alloc_from_pool(size_t size, struct page 
**ret_page)
 * small, so align them to their order in pages, minimum is a page
 * size. This helps reduce fragmentation of the DMA space.
 */
-   align = PAGE_SIZE  get_order(size);
+   align_mask = (1  get_order(size)) - 1;
 
spin_lock_irqsave(pool-lock, flags);
pageno = bitmap_find_next_zero_area(pool-bitmap, pool-nr_pages,
-   0, count, (1  align) - 1);
+   0, count, align_mask);
if (pageno  pool-nr_pages) {
bitmap_set(pool-bitmap, pageno, count);
ptr = pool-vaddr + PAGE_SIZE * pageno;
-- 
1.7.2.5

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