arch/powerpc/include/asm/book3s/64/hash-4k.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
Rewrite __real_pte() as a static inline in order to avoid
following warning/error when building with 4k page size:
CC arch/powerpc/mm/book3s64/hash_tlb.o
arch/powerpc/mm/book3s64/hash_tlb.c: In function 'hpte_need_flush':
arch/powerpc/mm/book3s64/hash_tlb.c:49:16: error: variable 'offset' set but not used [-Werror=unused-but-set-variable]
49 | int i, offset;
| ^~~~~~
cc1: all warnings being treated as errors
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202501081741.AYFwybsq-lkp@intel.com/
Fixes: ff31e105464d ("powerpc/mm/hash64: Store the slot information at the right offset for hugetlb")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
arch/powerpc/include/asm/book3s/64/hash-4k.h | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h
index c3efacab4b94..a7a68ba9c71b 100644
--- a/arch/powerpc/include/asm/book3s/64/hash-4k.h
+++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h
@@ -77,7 +77,10 @@
/*
* With 4K page size the real_pte machinery is all nops.
*/
-#define __real_pte(e, p, o) ((real_pte_t){(e)})
+static inline real_pte_t __real_pte(pte_t pte, pte_t *ptep, int offset)
+{
+ return (real_pte_t){pte};
+}
#define __rpte_to_pte(r) ((r).pte)
#define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT)
--
2.47.0
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Rewrite __real_pte() as a static inline in order to avoid
> following warning/error when building with 4k page size:
>
> CC arch/powerpc/mm/book3s64/hash_tlb.o
> arch/powerpc/mm/book3s64/hash_tlb.c: In function 'hpte_need_flush':
> arch/powerpc/mm/book3s64/hash_tlb.c:49:16: error: variable 'offset' set but not used [-Werror=unused-but-set-variable]
> 49 | int i, offset;
> | ^~~~~~
> cc1: all warnings being treated as errors
>
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202501081741.AYFwybsq-lkp@intel.com/
Great. Why not fix the other warning as well which is reported in above
link, which is...
--
arch/powerpc/mm/book3s64/hash_native.c: In function 'native_flush_hash_range':
>> arch/powerpc/mm/book3s64/hash_native.c:786:29: warning: variable 'index' set but not used [-Wunused-but-set-variable]
786 | unsigned long hash, index, hidx, shift, slot;
--
...similar to how we fixed this warning by making the macro as static
inline? That means something like this (not tested)?
-#define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT)
+static inline unsigned long __rpte_to_hidx(real_pte_t r, unsigned long index)
+{
+ return pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT;
+}
-ritesh
> Fixes: ff31e105464d ("powerpc/mm/hash64: Store the slot information at the right offset for hugetlb")
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
> arch/powerpc/include/asm/book3s/64/hash-4k.h | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h
> index c3efacab4b94..a7a68ba9c71b 100644
> --- a/arch/powerpc/include/asm/book3s/64/hash-4k.h
> +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h
> @@ -77,7 +77,10 @@
> /*
> * With 4K page size the real_pte machinery is all nops.
> */
> -#define __real_pte(e, p, o) ((real_pte_t){(e)})
> +static inline real_pte_t __real_pte(pte_t pte, pte_t *ptep, int offset)
> +{
> + return (real_pte_t){pte};
> +}
> #define __rpte_to_pte(r) ((r).pte)
> #define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT)
>
> --
> 2.47.0
Le 11/01/2025 à 18:03, Ritesh Harjani a écrit :
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>
>> Rewrite __real_pte() as a static inline in order to avoid
>> following warning/error when building with 4k page size:
>>
>> CC arch/powerpc/mm/book3s64/hash_tlb.o
>> arch/powerpc/mm/book3s64/hash_tlb.c: In function 'hpte_need_flush':
>> arch/powerpc/mm/book3s64/hash_tlb.c:49:16: error: variable 'offset' set but not used [-Werror=unused-but-set-variable]
>> 49 | int i, offset;
>> | ^~~~~~
>> cc1: all warnings being treated as errors
>>
>> Reported-by: kernel test robot <lkp@intel.com>
>> Closes: https://lore.kernel.org/oe-kbuild-all/202501081741.AYFwybsq-lkp@intel.com/
>
> Great. Why not fix the other warning as well which is reported in above
> link, which is...
Just because .... I overlooked the report and missed the second error.
Sent v2 with both fixes now.
>
> --
> arch/powerpc/mm/book3s64/hash_native.c: In function 'native_flush_hash_range':
>>> arch/powerpc/mm/book3s64/hash_native.c:786:29: warning: variable 'index' set but not used [-Wunused-but-set-variable]
> 786 | unsigned long hash, index, hidx, shift, slot;
> --
>
> ...similar to how we fixed this warning by making the macro as static
> inline? That means something like this (not tested)?
>
> -#define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT)
> +static inline unsigned long __rpte_to_hidx(real_pte_t r, unsigned long index)
> +{
> + return pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT;
> +}
>
>
> -ritesh
>
>
>> Fixes: ff31e105464d ("powerpc/mm/hash64: Store the slot information at the right offset for hugetlb")
>> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
>> ---
>> arch/powerpc/include/asm/book3s/64/hash-4k.h | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h
>> index c3efacab4b94..a7a68ba9c71b 100644
>> --- a/arch/powerpc/include/asm/book3s/64/hash-4k.h
>> +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h
>> @@ -77,7 +77,10 @@
>> /*
>> * With 4K page size the real_pte machinery is all nops.
>> */
>> -#define __real_pte(e, p, o) ((real_pte_t){(e)})
>> +static inline real_pte_t __real_pte(pte_t pte, pte_t *ptep, int offset)
>> +{
>> + return (real_pte_t){pte};
>> +}
>> #define __rpte_to_pte(r) ((r).pte)
>> #define __rpte_to_hidx(r,index) (pte_val(__rpte_to_pte(r)) >> H_PAGE_F_GIX_SHIFT)
>>
>> --
>> 2.47.0
© 2016 - 2025 Red Hat, Inc.