* [PATCH v2] powerpc/64s: Rewrite __real_pte() and __rpte_to_hidx() as static inline
@ 2025-01-12 18:24 Christophe Leroy
2025-01-12 19:13 ` Ritesh Harjani
2025-02-14 12:52 ` Madhavan Srinivasan
0 siblings, 2 replies; 3+ messages in thread
From: Christophe Leroy @ 2025-01-12 18:24 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin, Naveen N Rao,
Madhavan Srinivasan
Cc: Christophe Leroy, linux-kernel, linuxppc-dev, kernel test robot
Rewrite __real_pte() and __rpte_to_hidx() as static inline in order to
avoid following warnings/errors 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;
| ^~~~~~
CC arch/powerpc/mm/book3s64/hash_native.o
arch/powerpc/mm/book3s64/hash_native.c: In function 'native_flush_hash_range':
arch/powerpc/mm/book3s64/hash_native.c:782:29: error: variable 'index' set but not used [-Werror=unused-but-set-variable]
782 | unsigned long hash, index, hidx, shift, slot;
| ^~~~~
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>
---
v2: Also inline __rpte_to_hidx() for the same reason
---
arch/powerpc/include/asm/book3s/64/hash-4k.h | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h
index c3efacab4b94..aa90a048f319 100644
--- a/arch/powerpc/include/asm/book3s/64/hash-4k.h
+++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h
@@ -77,9 +77,17 @@
/*
* 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)
+
+static inline unsigned long __rpte_to_hidx(real_pte_t rpte, unsigned long index)
+{
+ return pte_val(__rpte_to_pte(rpte)) >> H_PAGE_F_GIX_SHIFT;
+}
#define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \
do { \
--
2.47.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] powerpc/64s: Rewrite __real_pte() and __rpte_to_hidx() as static inline
2025-01-12 18:24 [PATCH v2] powerpc/64s: Rewrite __real_pte() and __rpte_to_hidx() as static inline Christophe Leroy
@ 2025-01-12 19:13 ` Ritesh Harjani
2025-02-14 12:52 ` Madhavan Srinivasan
1 sibling, 0 replies; 3+ messages in thread
From: Ritesh Harjani @ 2025-01-12 19:13 UTC (permalink / raw)
To: Christophe Leroy, Michael Ellerman, Nicholas Piggin, Naveen N Rao,
Madhavan Srinivasan
Cc: Christophe Leroy, linux-kernel, linuxppc-dev, kernel test robot
Christophe Leroy <christophe.leroy@csgroup.eu> writes:
> Rewrite __real_pte() and __rpte_to_hidx() as static inline in order to
> avoid following warnings/errors 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;
> | ^~~~~~
>
> CC arch/powerpc/mm/book3s64/hash_native.o
> arch/powerpc/mm/book3s64/hash_native.c: In function 'native_flush_hash_range':
> arch/powerpc/mm/book3s64/hash_native.c:782:29: error: variable 'index' set but not used [-Werror=unused-but-set-variable]
> 782 | unsigned long hash, index, hidx, shift, slot;
> | ^~~~~
>
> 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>
> ---
> v2: Also inline __rpte_to_hidx() for the same reason
Thanks for addressing the other warning too in v2. I also tested the
changes on my system and this fixes both the reported warnings.
The changes looks good to me. Please feel free to add -
Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
> ---
> arch/powerpc/include/asm/book3s/64/hash-4k.h | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/book3s/64/hash-4k.h b/arch/powerpc/include/asm/book3s/64/hash-4k.h
> index c3efacab4b94..aa90a048f319 100644
> --- a/arch/powerpc/include/asm/book3s/64/hash-4k.h
> +++ b/arch/powerpc/include/asm/book3s/64/hash-4k.h
> @@ -77,9 +77,17 @@
> /*
> * 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)
> +
> +static inline unsigned long __rpte_to_hidx(real_pte_t rpte, unsigned long index)
> +{
> + return pte_val(__rpte_to_pte(rpte)) >> H_PAGE_F_GIX_SHIFT;
> +}
>
> #define pte_iterate_hashed_subpages(rpte, psize, va, index, shift) \
> do { \
> --
> 2.47.0
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v2] powerpc/64s: Rewrite __real_pte() and __rpte_to_hidx() as static inline
2025-01-12 18:24 [PATCH v2] powerpc/64s: Rewrite __real_pte() and __rpte_to_hidx() as static inline Christophe Leroy
2025-01-12 19:13 ` Ritesh Harjani
@ 2025-02-14 12:52 ` Madhavan Srinivasan
1 sibling, 0 replies; 3+ messages in thread
From: Madhavan Srinivasan @ 2025-02-14 12:52 UTC (permalink / raw)
To: Michael Ellerman, Nicholas Piggin, Naveen N Rao, Christophe Leroy
Cc: linux-kernel, linuxppc-dev, kernel test robot
On Sun, 12 Jan 2025 19:24:46 +0100, Christophe Leroy wrote:
> Rewrite __real_pte() and __rpte_to_hidx() as static inline in order to
> avoid following warnings/errors 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;
> | ^~~~~~
>
> [...]
Applied to powerpc/fixes.
[1/1] powerpc/64s: Rewrite __real_pte() and __rpte_to_hidx() as static inline
https://git.kernel.org/powerpc/c/61bcc752d1b81fde3cae454ff20c1d3c359df500
Thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-02-14 12:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-12 18:24 [PATCH v2] powerpc/64s: Rewrite __real_pte() and __rpte_to_hidx() as static inline Christophe Leroy
2025-01-12 19:13 ` Ritesh Harjani
2025-02-14 12:52 ` Madhavan Srinivasan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).