x86_64: kill 19000+ sparse warnings
PATCH 1/1 x86_64: kill 19000+ sparse warnings
From: Randy Dunlap <[email protected]>
Eliminate 19439 (!!) sparse warnings like:include/linux/mm.h:321:22: warning: constant 0xffff810000000000 is so big it is unsigned long
Eliminate 56 sparse warnings like:arch/x86_64/kernel/setup.c:248:16: warning: constant 0xffffffff80000000 is so big it is unsigned long
Eliminate 5 sparse warnings like:arch/x86_64/kernel/module.c:49:13: warning: constant 0xfffffffffff00000 is so big it is unsigned long
Eliminate 23 sparse warnings like:arch/x86_64/mm/init.c:551:37: warning: constant 0xffffc20000000000 is so big it is unsigned long
Eliminate 6 sparse warnings like:arch/x86_64/kernel/module.c:49:13: warning: constant 0xffffffff88000000 is so big it is unsigned long
Eliminate 23 sparse warnings like:arch/x86_64/mm/init.c:552:6: warning: constant 0xffffe1ffffffffff is so big it is unsigned long
Eliminate 3 sparse warnings like:arch/x86_64/kernel/e820.c:186:17: warning: constant 0x3fffffffffff is so big it is long
--- include/asm-x86_64/page.h | 11 +++++++++++ include/asm-x86_64/pgtable.h | 9 +++++++++ 2 files changed, 20 insertions(+)
include/asm-x86_64/page.h +11 -0
@@ -80,9 +80,16 @@ extern unsigned long phys_base;#define __PHYSICAL_START CONFIG_PHYSICAL_START#define __KERNEL_ALIGN 0x200000 + +#ifdef __ASSEMBLY__#define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START)#define __START_KERNEL_map 0xffffffff80000000#define __PAGE_OFFSET 0xffff810000000000 +#else +#define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START) +#define __START_KERNEL_map 0xffffffff80000000UL +#define __PAGE_OFFSET 0xffff810000000000UL +#endif /* to align the pointer to the (next) page boundary */ #define PAGE_ALIGN (addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
@@ -94,7 +101,11 @@ extern unsigned long phys_base;#define __VIRTUAL_MASK ((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - 1)#define KERNEL_TEXT_SIZE (40*1024*1024) +#ifdef __ASSEMBLY__#define KERNEL_TEXT_START 0xffffffff80000000 +#else +#define KERNEL_TEXT_START 0xffffffff80000000UL +#endif #ifndef __ASSEMBLY__
include/asm-x86_64/pgtable.h +9 -0
@@ -134,12 +134,21 @@ static inline pte_t ptep_get_and_clear_f#define USER_PTRS_PER_PGD ((TASK_SIZE-1)/PGDIR_SIZE+1)#define FIRST_USER_ADDRESS 0 +#ifdef __ASSEMBLY__#define MAXMEM 0x3fffffffffff#define VMALLOC_START 0xffffc20000000000#define VMALLOC_END 0xffffe1ffffffffff#define MODULES_VADDR 0xffffffff88000000#define MODULES_END 0xfffffffffff00000#define MODULES_LEN (MODULES_END - MODULES_VADDR) +#else +#define MAXMEM 0x3fffffffffffUL +#define VMALLOC_START 0xffffc20000000000UL +#define VMALLOC_END 0xffffe1ffffffffffUL +#define MODULES_VADDR 0xffffffff88000000UL +#define MODULES_END 0xfffffffffff00000UL +#define MODULES_LEN (MODULES_END - MODULES_VADDR) +#endif #define _PAGE_BIT_PRESENT 0#define _PAGE_BIT_RW 1
Quoted 31 lines · On Wed, 25 Apr 2007 22:45:09 -0700 Randy Dunlap <[email protected]> wrote:
From: Randy Dunlap <[email protected]>
Eliminate 19439 (!!) sparse warnings like:
include/linux/mm.h:321:22: warning: constant0xffff810000000000is so big it is unsigned longEliminate 56 sparse warnings like:
arch/x86_64/kernel/setup.c:248:16: warning: constant0xffffffff80000000is so big it is unsigned longEliminate 5 sparse warnings like:
arch/x86_64/kernel/module.c:49:13: warning: constant0xfffffffffff00000is so big it is unsigned longEliminate 23 sparse warnings like:
arch/x86_64/mm/init.c:551:37: warning: constant0xffffc20000000000is so big it is unsigned longEliminate 6 sparse warnings like:
arch/x86_64/kernel/module.c:49:13: warning: constant0xffffffff88000000is so big it is unsigned longEliminate 23 sparse warnings like:
arch/x86_64/mm/init.c:552:6: warning: constant0xffffe1ffffffffffis so big it is unsigned longEliminate 3 sparse warnings like:
arch/x86_64/kernel/e820.c:186:17: warning: constant0x3fffffffffffis so big it is long...
include/asm-x86_64/pgtable.h +1
-0+#ifdef __ASSEMBLY__#define MAXMEM 0x3fffffffffff#define VMALLOC_START 0xffffc20000000000#define VMALLOC_END 0xffffe1ffffffffff#define MODULES_VADDR 0xffffffff88000000
include/asm-x86_64/pgtable.h static inline pte_t ptep_get_and_clear_f · line 151
Quoted 10 lines
include/asm-x86_64/pgtable.h +8
-0#define MODULES_END 0xfffffffffff00000#define MODULES_LEN (MODULES_END - MODULES_VADDR) +#else +#define MAXMEM 0x3fffffffffffUL +#define VMALLOC_START 0xffffc20000000000UL +#define VMALLOC_END 0xffffe1ffffffffffUL +#define MODULES_VADDR 0xffffffff88000000UL +#define MODULES_END 0xfffffffffff00000UL +#define MODULES_LEN (MODULES_END - MODULES_VADDR) +#endif
hm, the duplication is unfortunate.
I wonder if it's worth doing a cpp token-pasting trick to avoid having to do that.
Quoted 37 lines · Andrew Morton
Quoted 35 lines · On Wed, 25 Apr 2007 22:45:09 -0700 Randy Dunlap <[email protected]> wrote:
From: Randy Dunlap <[email protected]>
Eliminate 19439 (!!) sparse warnings like:
include/linux/mm.h:321:22: warning: constant0xffff810000000000is so big it is unsigned longEliminate 56 sparse warnings like:
arch/x86_64/kernel/setup.c:248:16: warning: constant0xffffffff80000000is so big it is unsigned longEliminate 5 sparse warnings like:
arch/x86_64/kernel/module.c:49:13: warning: constant0xfffffffffff00000is so big it is unsigned longEliminate 23 sparse warnings like:
arch/x86_64/mm/init.c:551:37: warning: constant0xffffc20000000000is so big it is unsigned longEliminate 6 sparse warnings like:
arch/x86_64/kernel/module.c:49:13: warning: constant0xffffffff88000000is so big it is unsigned longEliminate 23 sparse warnings like:
arch/x86_64/mm/init.c:552:6: warning: constant0xffffe1ffffffffffis so big it is unsigned longEliminate 3 sparse warnings like:
arch/x86_64/kernel/e820.c:186:17: warning: constant0x3fffffffffffis so big it is long...
include/asm-x86_64/pgtable.h +4
-0+#ifdef __ASSEMBLY__#define MAXMEM 0x3fffffffffff#define VMALLOC_START 0xffffc20000000000#define VMALLOC_END 0xffffe1ffffffffff#define MODULES_VADDR 0xffffffff88000000#define MODULES_END 0xfffffffffff00000#define MODULES_LEN (MODULES_END - MODULES_VADDR) +#else +#define MAXMEM 0x3fffffffffffUL +#define VMALLOC_START 0xffffc20000000000UL
Quoted 8 lines
include/asm-x86_64/pgtable.h static inline pte_t ptep_get_and_clear_f · line 151
Quoted 6 lines
include/asm-x86_64/pgtable.h +5
-0+#define VMALLOC_END 0xffffe1ffffffffffUL +#define MODULES_VADDR 0xffffffff88000000UL +#define MODULES_END 0xfffffffffff00000UL +#define MODULES_LEN (MODULES_END - MODULES_VADDR) +#endif hm, the duplication is unfortunate.
Yep.
Quoted 2 lines
I wonder if it's worth doing a cpp token-pasting trick to avoid having to do that.
oh. there is already an include/asm-x86_64/const.h that will help with that. I'll try it out.
Signature · 2 lines
~Randy *** Remember to use Documentation/SubmitChecklist when testing your code ***
Quoted 2 lines · On Wed, 25 Apr 2007 23:07:56 -0700 Randy Dunlap <[email protected]> wrote:
oh. there is already an
include/asm-x86_64/const.hthat will help with that. I'll try it out.
No there isn't ;) There's a sparc64 one which looks good. Worth promoting to include/linux?
Quoted 7 lines · Andrew Morton
Quoted 2 lines · On Wed, 25 Apr 2007 23:07:56 -0700 Randy Dunlap <[email protected]> wrote:
oh. there is already an
include/asm-x86_64/const.hthat will help with that. I'll try it out.No there isn't ;) There's a sparc64 one which looks good. Worth promoting to
include/linux?
Did you look in -mm? I did.
Signature · 2 lines
~Randy *** Remember to use Documentation/SubmitChecklist when testing your code ***
Quoted 11 lines · On Wed, 25 Apr 2007 23:21:55 -0700 Randy Dunlap <[email protected]> wrote:
Quoted 7 lines · Andrew Morton
Quoted 2 lines · On Wed, 25 Apr 2007 23:07:56 -0700 Randy Dunlap <[email protected]> wrote:
oh. there is already an
include/asm-x86_64/const.hthat will help with that. I'll try it out.No there isn't ;) There's a sparc64 one which looks good. Worth promoting to
include/linux?Did you look in -mm? I did.
Oh.
Still, duplicating that file seems silly.
Quoted 7 lines · Andrew Morton
Quoted 5 lines · On Wed, 25 Apr 2007 23:21:55 -0700 Randy Dunlap <[email protected]> wrote:
Quoted 4 lines · Andrew Morton
Quoted 2 lines · On Wed, 25 Apr 2007 23:07:56 -0700 Randy Dunlap <[email protected]> wrote:
oh. there is already an
include/asm-x86_64/const.hthat will help with that. I'll try it out.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
No there isn't ;) There's a sparc64 one which looks good. Worth promoting to
include/linux?Did you look in -mm? I did.
Oh.
Still, duplicating that file seems silly.
Ack. But that's a different patch. :)
Signature · 2 lines
~Randy *** Remember to use Documentation/SubmitChecklist when testing your code ***
PATCH v2 1/1 x86_64: kill 19000+ sparse warnings
In reply to Andrew MortonQuoted 4 lines
hm, the duplication is unfortunate.
I wonder if it's worth doing a cpp token-pasting trick to avoid having to do that.
From: Randy Dunlap <[email protected]>
Eliminate 19439 (!!) sparse warnings like:include/linux/mm.h:321:22: warning: constant 0xffff810000000000 is so big it is unsigned long
Eliminate 56 sparse warnings like:arch/x86_64/kernel/setup.c:248:16: warning: constant 0xffffffff80000000 is so big it is unsigned long
Eliminate 5 sparse warnings like:arch/x86_64/kernel/module.c:49:13: warning: constant 0xfffffffffff00000 is so big it is unsigned long
Eliminate 23 sparse warnings like:arch/x86_64/mm/init.c:551:37: warning: constant 0xffffc20000000000 is so big it is unsigned long
Eliminate 6 sparse warnings like:arch/x86_64/kernel/module.c:49:13: warning: constant 0xffffffff88000000 is so big it is unsigned long
Eliminate 23 sparse warnings like:arch/x86_64/mm/init.c:552:6: warning: constant 0xffffe1ffffffffff is so big it is unsigned long
Eliminate 3 sparse warnings like:arch/x86_64/kernel/e820.c:186:17: warning: constant 0x3fffffffffff is so big it is long
--- include/asm-x86_64/page.h | 7 ++++--- include/asm-x86_64/pgtable.h | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-)
include/asm-x86_64/page.h +4 -3
@@ -80,9 +80,10 @@ extern unsigned long phys_base;#define __PHYSICAL_START CONFIG_PHYSICAL_START#define __KERNEL_ALIGN 0x200000 +#define __START_KERNEL (__START_KERNEL_map + __PHYSICAL_START) -#define __START_KERNEL_map 0xffffffff80000000 -#define __PAGE_OFFSET 0xffff810000000000 +#define __START_KERNEL_map _AC(0xffffffff80000000, UL) +#define __PAGE_OFFSET _AC(0xffff810000000000, UL)/* to align the pointer to the (next) page boundary */ #define PAGE_ALIGN (addr) (((addr)+PAGE_SIZE-1)&PAGE_MASK)
@@ -94,7 +95,7 @@ extern unsigned long phys_base;#define __VIRTUAL_MASK ((_AC(1,UL) << __VIRTUAL_MASK_SHIFT) - 1)#define KERNEL_TEXT_SIZE (40*1024*1024) -#define KERNEL_TEXT_START 0xffffffff80000000 +#define KERNEL_TEXT_START _AC(0xffffffff80000000, UL)#ifndef __ASSEMBLY__
include/asm-x86_64/pgtable.h +5 -5
@@ -134,11 +134,11 @@ static inline pte_t ptep_get_and_clear_f#define USER_PTRS_PER_PGD ((TASK_SIZE-1)/PGDIR_SIZE+1)#define FIRST_USER_ADDRESS 0 -#define MAXMEM 0x3fffffffffff -#define VMALLOC_START 0xffffc20000000000 -#define VMALLOC_END 0xffffe1ffffffffff -#define MODULES_VADDR 0xffffffff88000000 -#define MODULES_END 0xfffffffffff00000 +#define MAXMEM _AC(0x3fffffffffff, UL) +#define VMALLOC_START _AC(0xffffc20000000000, UL) +#define VMALLOC_END _AC(0xffffe1ffffffffff, UL) +#define MODULES_VADDR _AC(0xffffffff88000000, UL) +#define MODULES_END _AC(0xfffffffffff00000, UL)#define MODULES_LEN (MODULES_END - MODULES_VADDR)#define _PAGE_BIT_PRESENT 0
Quoted 4 lines · On Thursday 26 April 2007 07:45:09 Randy Dunlap wrote:
From: Randy Dunlap <[email protected]>
Eliminate 19439 (!!) sparse warnings like:
include/linux/mm.h:321:22: warning: constant0xffff810000000000is so big it is unsigned long
Sparse is just wrong here. The C standard does make it unsigned long long automatically
-Andi
Quoted 8 lines · Andi Kleen
Quoted 4 lines · On Thursday 26 April 2007 07:45:09 Randy Dunlap wrote:
From: Randy Dunlap <[email protected]>
Eliminate 19439 (!!) sparse warnings like:
include/linux/mm.h:321:22: warning: constant0xffff810000000000is so big it is unsigned longSparse is just wrong here. The C standard does make it unsigned long long automatically
Wish it did...
(32bit i386):
08:47 ichi:/dev/shm > cat foo.c
unsigned long long a = 0x123456789;
08:47 ichi:/dev/shm > cc -c foo.c -Wall
foo.c:1: warning: integer constant is too large for ‘long’ type Or is this something else?
Jan