2014-01-06 09:08:08

by Stephen Rothwell

[permalink] [raw]
Subject: linux-next: build failure after merge of the akpm-current tree

Hi Andrew,

After merging the akpm-current tree, today's linux-next build (arm
multi_v7_defconfig) failed like this:

arch/arm/mm/init.c:199:13: error: conflicting types for 'arm_dma_zone_size'
include/linux/bootmem.h:259:11: note: previous declaration of 'arm_dma_zone_size' was here

Caused by commit a3ae9362fafe ("mm/memblock: add memblock memory
allocation apis").

For this build, BOOTMEM_LOW_LIMIT is defined as __pa(MAX_DMA_ADDRESS) and
MAX_DMA_ADDRESS is defined as:

#define MAX_DMA_ADDRESS ({ \
extern unsigned long arm_dma_zone_size; \
arm_dma_zone_size ? \
(PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })

and in arch/arm/mm/init.c, arm_dma_zone_size is declared as:

phys_addr_t arm_dma_zone_size __read_mostly;

Urk! :-(

OK, so commit 364230b995214 ("ARM: use phys_addr_t for DMA zone sizes")
changed the definition of arm_dma_zone_size except it missed the one in
arch/arm/include/asm/dma.h.

I have applied this merge fix patch for today:

From: Stephen Rothwell <[email protected]>
Date: Mon, 6 Jan 2014 20:02:05 +1100
Subject: [PATCH] ARM: change further appearance of arm_dma_zone_size to phys_addr_t

The definition was chaned in commit 364230b995214 ("ARM: use phys_addr_t
for DMA zone sizes").

Fixes this build error:

arch/arm/mm/init.c:199:13: error: conflicting types for 'arm_dma_zone_size'
include/linux/bootmem.h:259:11: note: previous declaration of 'arm_dma_zone_size' was here

Signed-off-by: Stephen Rothwell <[email protected]>
---
arch/arm/include/asm/dma.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index 58b8c6a0ab1f..1439b80b3a98 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -8,7 +8,7 @@
#define MAX_DMA_ADDRESS 0xffffffffUL
#else
#define MAX_DMA_ADDRESS ({ \
- extern unsigned long arm_dma_zone_size; \
+ extern phys_addr_t arm_dma_zone_size; \
arm_dma_zone_size ? \
(PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
#endif
--
1.8.5.2

--
Cheers,
Stephen Rothwell [email protected]


Attachments:
(No filename) (2.07 kB)
(No filename) (836.00 B)
Download all attachments

2014-01-06 15:06:30

by Santosh Shilimkar

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the akpm-current tree

Stephen,

On Monday 06 January 2014 04:07 AM, Stephen Rothwell wrote:
> Hi Andrew,
>
> After merging the akpm-current tree, today's linux-next build (arm
> multi_v7_defconfig) failed like this:
>
> arch/arm/mm/init.c:199:13: error: conflicting types for 'arm_dma_zone_size'
> include/linux/bootmem.h:259:11: note: previous declaration of 'arm_dma_zone_size' was here
>
> Caused by commit a3ae9362fafe ("mm/memblock: add memblock memory
> allocation apis").
>
> For this build, BOOTMEM_LOW_LIMIT is defined as __pa(MAX_DMA_ADDRESS) and
> MAX_DMA_ADDRESS is defined as:
>
> #define MAX_DMA_ADDRESS ({ \
> extern unsigned long arm_dma_zone_size; \
> arm_dma_zone_size ? \
> (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
>
> and in arch/arm/mm/init.c, arm_dma_zone_size is declared as:
>
> phys_addr_t arm_dma_zone_size __read_mostly;
>
> Urk! :-(
>
> OK, so commit 364230b995214 ("ARM: use phys_addr_t for DMA zone sizes")
> changed the definition of arm_dma_zone_size except it missed the one in
> arch/arm/include/asm/dma.h.
>
> I have applied this merge fix patch for today:
>
The issue was detected earlier and similar patch to yours
was proposed here [1]. But the fix isn't right as rightly
commented by Russell because the DMA_MAX_ADDRESS is a virtual
address which can't be more than 4 GB. Need to figure out
the right fix though.

Regards,
Santosh
[1] http://www.spinics.net/lists/arm-kernel/msg292905.html

2014-01-06 17:29:04

by Russell King

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the akpm-current tree

On Mon, Jan 06, 2014 at 08:07:58PM +1100, Stephen Rothwell wrote:
> Hi Andrew,
>
> After merging the akpm-current tree, today's linux-next build (arm
> multi_v7_defconfig) failed like this:
>
> arch/arm/mm/init.c:199:13: error: conflicting types for 'arm_dma_zone_size'
> include/linux/bootmem.h:259:11: note: previous declaration of 'arm_dma_zone_size' was here
>
> Caused by commit a3ae9362fafe ("mm/memblock: add memblock memory
> allocation apis").
>
> For this build, BOOTMEM_LOW_LIMIT is defined as __pa(MAX_DMA_ADDRESS) and
> MAX_DMA_ADDRESS is defined as:
>
> #define MAX_DMA_ADDRESS ({ \
> extern unsigned long arm_dma_zone_size; \
> arm_dma_zone_size ? \
> (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
>
> and in arch/arm/mm/init.c, arm_dma_zone_size is declared as:
>
> phys_addr_t arm_dma_zone_size __read_mostly;
>
> Urk! :-(
>
> OK, so commit 364230b995214 ("ARM: use phys_addr_t for DMA zone sizes")
> changed the definition of arm_dma_zone_size except it missed the one in
> arch/arm/include/asm/dma.h.
>
> I have applied this merge fix patch for today:

There's more here than just this change required here. We also need to
limit it if PAGE_OFFSET + arm_dma_zone_size is greater than 4GB, as
MAX_DMA_ADDRESS is a virtual address - we really don't want the 32-bit
value of this wrapping.

Exactly how we go about this, I'm not sure at the moment, but maybe
something like this:

#define MAX_DMA_ADDRESS ({ \
extern phys_addr_t arm_dma_zone_size; \
arm_dma_zone_size && arm_dma_zone_size < (0x10000000 - PAGE_OFFSET) ? \
(PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })

--
Russell King
ARM architecture Linux Kernel maintainer

2014-01-06 19:40:25

by Santosh Shilimkar

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the akpm-current tree

On Monday 06 January 2014 12:28 PM, Russell King wrote:
> On Mon, Jan 06, 2014 at 08:07:58PM +1100, Stephen Rothwell wrote:
>> Hi Andrew,
>>
>> After merging the akpm-current tree, today's linux-next build (arm
>> multi_v7_defconfig) failed like this:
>>
>> arch/arm/mm/init.c:199:13: error: conflicting types for 'arm_dma_zone_size'
>> include/linux/bootmem.h:259:11: note: previous declaration of 'arm_dma_zone_size' was here
>>
>> Caused by commit a3ae9362fafe ("mm/memblock: add memblock memory
>> allocation apis").
>>
>> For this build, BOOTMEM_LOW_LIMIT is defined as __pa(MAX_DMA_ADDRESS) and
>> MAX_DMA_ADDRESS is defined as:
>>
>> #define MAX_DMA_ADDRESS ({ \
>> extern unsigned long arm_dma_zone_size; \
>> arm_dma_zone_size ? \
>> (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
>>
>> and in arch/arm/mm/init.c, arm_dma_zone_size is declared as:
>>
>> phys_addr_t arm_dma_zone_size __read_mostly;
>>
>> Urk! :-(
>>
>> OK, so commit 364230b995214 ("ARM: use phys_addr_t for DMA zone sizes")
>> changed the definition of arm_dma_zone_size except it missed the one in
>> arch/arm/include/asm/dma.h.
>>
>> I have applied this merge fix patch for today:
>
> There's more here than just this change required here. We also need to
> limit it if PAGE_OFFSET + arm_dma_zone_size is greater than 4GB, as
> MAX_DMA_ADDRESS is a virtual address - we really don't want the 32-bit
> value of this wrapping.
>
> Exactly how we go about this, I'm not sure at the moment, but maybe
> something like this:
>
> #define MAX_DMA_ADDRESS ({ \
> extern phys_addr_t arm_dma_zone_size; \
> arm_dma_zone_size && arm_dma_zone_size < (0x10000000 - PAGE_OFFSET) ? \
> (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
>
Looks good to me. Will you create a patch or you want me to create based
on above ?

Regards,
Santosh

2014-01-06 22:13:14

by Santosh Shilimkar

[permalink] [raw]
Subject: Re: linux-next: build failure after merge of the akpm-current tree

Stephen, Andrew,

On Monday 06 January 2014 12:28 PM, Russell King wrote:
> On Mon, Jan 06, 2014 at 08:07:58PM +1100, Stephen Rothwell wrote:
>> Hi Andrew,
>>
>> After merging the akpm-current tree, today's linux-next build (arm
>> multi_v7_defconfig) failed like this:
>>
>> arch/arm/mm/init.c:199:13: error: conflicting types for 'arm_dma_zone_size'
>> include/linux/bootmem.h:259:11: note: previous declaration of 'arm_dma_zone_size' was here
>>
>> Caused by commit a3ae9362fafe ("mm/memblock: add memblock memory
>> allocation apis").
>>
>> For this build, BOOTMEM_LOW_LIMIT is defined as __pa(MAX_DMA_ADDRESS) and
>> MAX_DMA_ADDRESS is defined as:
>>
>> #define MAX_DMA_ADDRESS ({ \
>> extern unsigned long arm_dma_zone_size; \
>> arm_dma_zone_size ? \
>> (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
>>
>> and in arch/arm/mm/init.c, arm_dma_zone_size is declared as:
>>
>> phys_addr_t arm_dma_zone_size __read_mostly;
>>
>> Urk! :-(
>>
>> OK, so commit 364230b995214 ("ARM: use phys_addr_t for DMA zone sizes")
>> changed the definition of arm_dma_zone_size except it missed the one in
>> arch/arm/include/asm/dma.h.
>>
>> I have applied this merge fix patch for today:
>
> There's more here than just this change required here. We also need to
> limit it if PAGE_OFFSET + arm_dma_zone_size is greater than 4GB, as
> MAX_DMA_ADDRESS is a virtual address - we really don't want the 32-bit
> value of this wrapping.
>
> Exactly how we go about this, I'm not sure at the moment, but maybe
> something like this:
>
> #define MAX_DMA_ADDRESS ({ \
> extern phys_addr_t arm_dma_zone_size; \
> arm_dma_zone_size && arm_dma_zone_size < (0x10000000 - PAGE_OFFSET) ? \
> (PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
>

Here is the patch as per the discussion. I have merged Steven's patch and update
suggested by Russell. Also attaching it, in case mailer eats tabs.


>From 779ab1fdaffbd7a4c8b3bba41f7a84c666c0c24e Mon Sep 17 00:00:00 2001
From: Russell King <[email protected]>
Date: Mon, 6 Jan 2014 16:57:36 -0500
Subject: [PATCH] ARM: mm: change further appearance of arm_dma_zone_size to
phys_addr_t

The definition was chagned in commit 364230b995214 ("ARM: use phys_addr_t
for DMA zone sizes").

Fixes this build error:

arch/arm/mm/init.c:199:13: error: conflicting types for 'arm_dma_zone_size'
include/linux/bootmem.h:259:11: note: previous declaration of 'arm_dma_zone_size' was here

While changing the type, we also need to limit MAX_DMA_ADDRESS if
PAGE_OFFSET + arm_dma_zone_size is greater than 4GB. The MAX_DMA_ADDRESS
is a virtual address and we really don't want the 32-bit value of
this wrapping.

Cc: Stephen Rothwell <[email protected]>
Cc: Andrew Morton <[email protected]>
Signed-off-by: Santosh Shilimkar <[email protected]>
Signed-off-by: Russell King <[email protected]>
---
arch/arm/include/asm/dma.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index 58b8c6a..9908443 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -8,8 +8,8 @@
#define MAX_DMA_ADDRESS 0xffffffffUL
#else
#define MAX_DMA_ADDRESS ({ \
- extern unsigned long arm_dma_zone_size; \
- arm_dma_zone_size ? \
+ extern phys_addr_t arm_dma_zone_size; \
+ arm_dma_zone_size && arm_dma_zone_size < (0x10000000 - PAGE_OFFSET) ? \
(PAGE_OFFSET + arm_dma_zone_size) : 0xffffffffUL; })
#endif

--
1.7.9.5


Attachments:
0001-ARM-mm-change-further-appearance-of-arm_dma_zone_siz.patch (1.54 kB)