Re: [PATCH 4/4] vdso: avoid including asm/page.h

2024-02-27 Thread Catalin Marinas
On Mon, Feb 26, 2024 at 05:14:14PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann 
> 
> The recent change to the vdso_data_store broke building compat VDSO
> on at least arm64 because it includes headers outside of the include/vdso/
> namespace:
> 
> In file included from arch/arm64/include/asm/lse.h:5,
>  from arch/arm64/include/asm/cmpxchg.h:14,
>  from arch/arm64/include/asm/atomic.h:16,
>  from include/linux/atomic.h:7,
>  from include/asm-generic/bitops/atomic.h:5,
>  from arch/arm64/include/asm/bitops.h:25,
>  from include/linux/bitops.h:68,
>  from arch/arm64/include/asm/memory.h:209,
>  from arch/arm64/include/asm/page.h:46,
>  from include/vdso/datapage.h:22,
>  from lib/vdso/gettimeofday.c:5,
>  from :
> arch/arm64/include/asm/atomic_ll_sc.h:298:9: error: unknown type name 'u128'
>   298 | u128 full;
> 
> Use an open-coded page size calculation based on the new CONFIG_PAGE_SHIFT
> Kconfig symbol instead.
> 
> Reported-by: Linux Kernel Functional Testing 
> Fixes: a0d2fcd62ac2 ("vdso/ARM: Make union vdso_data_store available for all 
> architectures")
> Link: 
> https://lore.kernel.org/lkml/ca+g9fytrxxm_ko9fnpz3xarxhv7ud_yqp-teupqrnrhu+_0...@mail.gmail.com/
> Signed-off-by: Arnd Bergmann 

Acked-by: Catalin Marinas 



Re: [PATCH 4/4] vdso: avoid including asm/page.h

2024-02-27 Thread Michael Ellerman
Christophe Leroy  writes:
> Le 26/02/2024 à 17:14, Arnd Bergmann a écrit :
>> From: Arnd Bergmann 
>> 
>> The recent change to the vdso_data_store broke building compat VDSO
>> on at least arm64 because it includes headers outside of the include/vdso/
>> namespace:
>
> I understand that powerpc64 also has an issue, see 
> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20231221120410.2226678-1-...@ellerman.id.au/

Yeah, and that patch would silently conflict with this series, which is
not ideal.

I could delay merging my patch above until after this series goes in,
mine only fixes a fairly obscure build warning.

cheers



Re: [PATCH 4/4] vdso: avoid including asm/page.h

2024-02-26 Thread Christophe Leroy


Le 26/02/2024 à 17:14, Arnd Bergmann a écrit :
> From: Arnd Bergmann 
> 
> The recent change to the vdso_data_store broke building compat VDSO
> on at least arm64 because it includes headers outside of the include/vdso/
> namespace:

I understand that powerpc64 also has an issue, see 
https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20231221120410.2226678-1-...@ellerman.id.au/

> 
> In file included from arch/arm64/include/asm/lse.h:5,
>   from arch/arm64/include/asm/cmpxchg.h:14,
>   from arch/arm64/include/asm/atomic.h:16,
>   from include/linux/atomic.h:7,
>   from include/asm-generic/bitops/atomic.h:5,
>   from arch/arm64/include/asm/bitops.h:25,
>   from include/linux/bitops.h:68,
>   from arch/arm64/include/asm/memory.h:209,
>   from arch/arm64/include/asm/page.h:46,
>   from include/vdso/datapage.h:22,
>   from lib/vdso/gettimeofday.c:5,
>   from :
> arch/arm64/include/asm/atomic_ll_sc.h:298:9: error: unknown type name 'u128'
>298 | u128 full;
> 
> Use an open-coded page size calculation based on the new CONFIG_PAGE_SHIFT
> Kconfig symbol instead.
> 
> Reported-by: Linux Kernel Functional Testing 
> Fixes: a0d2fcd62ac2 ("vdso/ARM: Make union vdso_data_store available for all 
> architectures")
> Link: 
> https://lore.kernel.org/lkml/ca+g9fytrxxm_ko9fnpz3xarxhv7ud_yqp-teupqrnrhu+_0...@mail.gmail.com/
> Signed-off-by: Arnd Bergmann 
> ---
>   include/vdso/datapage.h | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h
> index 7ba44379a095..2c39a67d7e23 100644
> --- a/include/vdso/datapage.h
> +++ b/include/vdso/datapage.h
> @@ -19,8 +19,6 @@
>   #include 
>   #include 
>   
> -#include 
> -
>   #ifdef CONFIG_ARCH_HAS_VDSO_DATA
>   #include 
>   #else
> @@ -128,7 +126,7 @@ extern struct vdso_data _timens_data[CS_BASES] 
> __attribute__((visibility("hidden
>*/
>   union vdso_data_store {
>   struct vdso_datadata[CS_BASES];
> - u8  page[PAGE_SIZE];
> + u8  page[1ul << CONFIG_PAGE_SHIFT];

Usually 1UL is used (capital letter)

Maybe better to (re)define PAGE_SIZE instead, something like:

#define PAGE_SIZE (1UL << CONFIG_PAGE_SHIFT)


>   };
>   
>   /*


[PATCH 4/4] vdso: avoid including asm/page.h

2024-02-26 Thread Arnd Bergmann
From: Arnd Bergmann 

The recent change to the vdso_data_store broke building compat VDSO
on at least arm64 because it includes headers outside of the include/vdso/
namespace:

In file included from arch/arm64/include/asm/lse.h:5,
 from arch/arm64/include/asm/cmpxchg.h:14,
 from arch/arm64/include/asm/atomic.h:16,
 from include/linux/atomic.h:7,
 from include/asm-generic/bitops/atomic.h:5,
 from arch/arm64/include/asm/bitops.h:25,
 from include/linux/bitops.h:68,
 from arch/arm64/include/asm/memory.h:209,
 from arch/arm64/include/asm/page.h:46,
 from include/vdso/datapage.h:22,
 from lib/vdso/gettimeofday.c:5,
 from :
arch/arm64/include/asm/atomic_ll_sc.h:298:9: error: unknown type name 'u128'
  298 | u128 full;

Use an open-coded page size calculation based on the new CONFIG_PAGE_SHIFT
Kconfig symbol instead.

Reported-by: Linux Kernel Functional Testing 
Fixes: a0d2fcd62ac2 ("vdso/ARM: Make union vdso_data_store available for all 
architectures")
Link: 
https://lore.kernel.org/lkml/ca+g9fytrxxm_ko9fnpz3xarxhv7ud_yqp-teupqrnrhu+_0...@mail.gmail.com/
Signed-off-by: Arnd Bergmann 
---
 include/vdso/datapage.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/vdso/datapage.h b/include/vdso/datapage.h
index 7ba44379a095..2c39a67d7e23 100644
--- a/include/vdso/datapage.h
+++ b/include/vdso/datapage.h
@@ -19,8 +19,6 @@
 #include 
 #include 
 
-#include 
-
 #ifdef CONFIG_ARCH_HAS_VDSO_DATA
 #include 
 #else
@@ -128,7 +126,7 @@ extern struct vdso_data _timens_data[CS_BASES] 
__attribute__((visibility("hidden
  */
 union vdso_data_store {
struct vdso_datadata[CS_BASES];
-   u8  page[PAGE_SIZE];
+   u8  page[1ul << CONFIG_PAGE_SHIFT];
 };
 
 /*
-- 
2.39.2