Patchwork Correct build warnings with CONFIG_TRANSPARENT_HUGEPAGE disabled

login
register
mail settings
Submitter Nathan Fontenot
Date June 24, 2013, 2:35 p.m.
Message ID <51C8594B.1080701@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/253856/
State Accepted
Commit ff1e7683418798e44eb8af1ab9f28dd475af6034
Headers show

Comments

Nathan Fontenot - June 24, 2013, 2:35 p.m.
Building with CONFIG_TRANSPARENT_HUGEPAGE disabled causes the following
build wearnings;

powerpc/arch/powerpc/include/asm/mmu-hash64.h: In function ‘__hash_page_thp’:
powerpc/arch/powerpc/include/asm/mmu-hash64.h:354: warning: no return statement in function returning non-void

This patch adds a return -1 to the static inline for __hash_page_thp()
to correct the warnings.

Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/mmu-hash64.h |    1 +
 1 file changed, 1 insertion(+)
Aneesh Kumar K.V - June 24, 2013, 3:05 p.m.
Nathan Fontenot <nfont@linux.vnet.ibm.com> writes:

> Building with CONFIG_TRANSPARENT_HUGEPAGE disabled causes the following
> build wearnings;
>
> powerpc/arch/powerpc/include/asm/mmu-hash64.h: In function ‘__hash_page_thp’:
> powerpc/arch/powerpc/include/asm/mmu-hash64.h:354: warning: no return statement in function returning non-void
>
> This patch adds a return -1 to the static inline for __hash_page_thp()
> to correct the warnings.
>
> Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

Wondering why i am not finding this

[root@llmp24l02 thp]# make arch/powerpc/mm/hash_utils_64.o
....
.....
  CC      arch/powerpc/mm/hash_utils_64.o
[root@llmp24l02 thp]# grep TRANSPARENT_HUGEPAGE .config
CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
# CONFIG_TRANSPARENT_HUGEPAGE is not set
[root@llmp24l02 thp]# 
[root@llmp24l02 thp]# gcc --version
gcc (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


> ---
>  arch/powerpc/include/asm/mmu-hash64.h |    1 +
>  1 file changed, 1 insertion(+)
>
> Index: powerpc/arch/powerpc/include/asm/mmu-hash64.h
> ===================================================================
> --- powerpc.orig/arch/powerpc/include/asm/mmu-hash64.h	2013-06-24 07:54:08.000000000 -0500
> +++ powerpc/arch/powerpc/include/asm/mmu-hash64.h	2013-06-24 08:07:56.000000000 -0500
> @@ -351,6 +351,7 @@
>  				  int ssize, unsigned int psize)
>  {
>  	BUG();
> +	return -1;
>  }
>  #endif
>  extern void hash_failure_debug(unsigned long ea, unsigned long access,
Aneesh Kumar K.V - June 24, 2013, 3:31 p.m.
"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> writes:

> Nathan Fontenot <nfont@linux.vnet.ibm.com> writes:
>
>> Building with CONFIG_TRANSPARENT_HUGEPAGE disabled causes the following
>> build wearnings;
>>
>> powerpc/arch/powerpc/include/asm/mmu-hash64.h: In function ‘__hash_page_thp’:
>> powerpc/arch/powerpc/include/asm/mmu-hash64.h:354: warning: no return statement in function returning non-void
>>
>> This patch adds a return -1 to the static inline for __hash_page_thp()
>> to correct the warnings.
>>
>> Signed-off-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>
>
> Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
>
> Wondering why i am not finding this
>
> [root@llmp24l02 thp]# make arch/powerpc/mm/hash_utils_64.o
> ....
> .....
>   CC      arch/powerpc/mm/hash_utils_64.o
> [root@llmp24l02 thp]# grep TRANSPARENT_HUGEPAGE .config
> CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE=y
> # CONFIG_TRANSPARENT_HUGEPAGE is not set
> [root@llmp24l02 thp]# 
> [root@llmp24l02 thp]# gcc --version
> gcc (GCC) 4.7.2 20121109 (Red Hat 4.7.2-8)
> Copyright (C) 2012 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
>
>

new compilers have __builtin_unreachable in BUG. That is why it didn't
trigger for me. 

new compiler:
David Laight - June 24, 2013, 4:27 p.m.
> failure:
> __________
> static inline __attribute__((always_inline)) __attribute__((no_instrument_function)) int
> __hash_page_thp(unsigned long ea, unsigned long access,
>       unsigned long vsid, pmd_t *pmdp,
>       unsigned long trap, int local,
>       int ssize, unsigned int psize)
> {
>  do { __asm__ __volatile__( "1: twi 31,0,0\n" ".section __bug_table,\"a\"\n" "2:\t" ".llong" " " "1b,
> %0\n" "\t.short %1, %2\n" ".org 2b+%3\n" ".previous\n" : : "i"
> ("/home/nfont/src/powerpc/arch/powerpc/include/asm/mmu-hash64.h"), "i" (353), "i" (0), "i"
> (sizeof(struct bug_entry))); do { } while (1); } while (0);
> }

Why isn't the "do { } while (1);" enough to stop the compiler
expecting the above to return?
I know I've added "for (;;);" in some code before now.
Disabling optimisations would be enough - but unlikely to be true.

	David

Patch

Index: powerpc/arch/powerpc/include/asm/mmu-hash64.h
===================================================================
--- powerpc.orig/arch/powerpc/include/asm/mmu-hash64.h	2013-06-24 07:54:08.000000000 -0500
+++ powerpc/arch/powerpc/include/asm/mmu-hash64.h	2013-06-24 08:07:56.000000000 -0500
@@ -351,6 +351,7 @@ 
 				  int ssize, unsigned int psize)
 {
 	BUG();
+	return -1;
 }
 #endif
 extern void hash_failure_debug(unsigned long ea, unsigned long access,