Subject: Re: [PATCH] Correct build warnings with CONFIG_TRANSPARENT_HUGEPAGE disabled

From: "Aneesh Kumar K.V" <[email-masked]>
Date: Mon, 24 Jun 2013 21:01:31 +0530

"Aneesh Kumar K.V" <[email-masked]> writes:

> Nathan Fontenot <[email-masked]> 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 <[email-masked]>
>
> Reviewed-by: Aneesh Kumar K.V <[email-masked]>
>
> 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:
_____________
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/opensource/sources/kernels/linux-powerpc/arch/powerpc/include/asm/mmu-hash64.h"), "i" (353), "i" (0), "i" (sizeof(struct bug_entry))); __builtin_unreachable(); } while (0);
}

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);
}

-aneesh