All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
@ 2021-09-29 19:08 ` Nick Desaulniers
  0 siblings, 0 replies; 19+ messages in thread
From: Nick Desaulniers @ 2021-09-29 19:08 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Fangrui Song, Peter Smith, Nick Desaulniers, Ard Biesheuvel,
	Nathan Chancellor, Richard Henderson, Russell King,
	Arnd Bergmann, Geert Uytterhoeven, Linus Walleij, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, YiFei Zhu,
	Uwe Kleine-König, Dave Martin, Nicolas Pitre, linux-kernel,
	llvm

QEMU 6.1.0 is more correct about trapping on misaligned accesses. A
kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
assembler could generate non-naturally-aligned v7wbi_tlb_fns which
results in a boot failure. The original commit adding the macro missed
the .align directive on this data.

Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
Link: https://github.com/ClangBuiltLinux/linux/issues/1447
Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
Debugged-by: Ard Biesheuvel <ardb@kernel.org>
Debugged-by: Nathan Chancellor <nathan@kernel.org>
Debugged-by: Richard Henderson <richard.henderson@linaro.org>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 arch/arm/Kconfig          | 1 +
 arch/arm/mm/proc-macros.S | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fc196421b2ce..b760dd45b734 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -92,6 +92,7 @@ config ARM
 	select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
 	select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
 	select HAVE_FUNCTION_TRACER if !XIP_KERNEL
+	select HAVE_FUTEX_CMPXCHG if FUTEX
 	select HAVE_GCC_PLUGINS
 	select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
 	select HAVE_IRQ_TIME_ACCOUNTING
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index e2c743aa2eb2..d9f7dfe2a7ed 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
 
 .macro define_tlb_functions name:req, flags_up:req, flags_smp
 	.type	\name\()_tlb_fns, #object
+	.align 2
 ENTRY(\name\()_tlb_fns)
 	.long	\name\()_flush_user_tlb_range
 	.long	\name\()_flush_kern_tlb_range
-- 
2.33.0.685.g46640cef36-goog


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
@ 2021-09-29 19:08 ` Nick Desaulniers
  0 siblings, 0 replies; 19+ messages in thread
From: Nick Desaulniers @ 2021-09-29 19:08 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Fangrui Song, Peter Smith, Nick Desaulniers, Ard Biesheuvel,
	Nathan Chancellor, Richard Henderson, Russell King,
	Arnd Bergmann, Geert Uytterhoeven, Linus Walleij, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, YiFei Zhu,
	Uwe Kleine-König, Dave Martin, Nicolas Pitre, linux-kernel,
	llvm

QEMU 6.1.0 is more correct about trapping on misaligned accesses. A
kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
assembler could generate non-naturally-aligned v7wbi_tlb_fns which
results in a boot failure. The original commit adding the macro missed
the .align directive on this data.

Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
Link: https://github.com/ClangBuiltLinux/linux/issues/1447
Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
Debugged-by: Ard Biesheuvel <ardb@kernel.org>
Debugged-by: Nathan Chancellor <nathan@kernel.org>
Debugged-by: Richard Henderson <richard.henderson@linaro.org>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
 arch/arm/Kconfig          | 1 +
 arch/arm/mm/proc-macros.S | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fc196421b2ce..b760dd45b734 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -92,6 +92,7 @@ config ARM
 	select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
 	select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
 	select HAVE_FUNCTION_TRACER if !XIP_KERNEL
+	select HAVE_FUTEX_CMPXCHG if FUTEX
 	select HAVE_GCC_PLUGINS
 	select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
 	select HAVE_IRQ_TIME_ACCOUNTING
diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index e2c743aa2eb2..d9f7dfe2a7ed 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
 
 .macro define_tlb_functions name:req, flags_up:req, flags_smp
 	.type	\name\()_tlb_fns, #object
+	.align 2
 ENTRY(\name\()_tlb_fns)
 	.long	\name\()_flush_user_tlb_range
 	.long	\name\()_flush_kern_tlb_range
-- 
2.33.0.685.g46640cef36-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
  2021-09-29 19:08 ` Nick Desaulniers
@ 2021-09-29 19:10   ` Nick Desaulniers
  -1 siblings, 0 replies; 19+ messages in thread
From: Nick Desaulniers @ 2021-09-29 19:10 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Fangrui Song, Peter Smith, Ard Biesheuvel, Nathan Chancellor,
	Richard Henderson, Russell King, Arnd Bergmann,
	Geert Uytterhoeven, Linus Walleij, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, YiFei Zhu,
	Uwe Kleine-König, Nicolas Pitre, linux-kernel, llvm,
	Dave Martin

+ Dave (Dave, I got a bounceback on your linaro.org email address.
Consider sending a patch updating the .mailmap)

On Wed, Sep 29, 2021 at 12:08 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> QEMU 6.1.0 is more correct about trapping on misaligned accesses. A
> kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
> assembler could generate non-naturally-aligned v7wbi_tlb_fns which
> results in a boot failure. The original commit adding the macro missed
> the .align directive on this data.
>
> Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1447
> Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
> Debugged-by: Ard Biesheuvel <ardb@kernel.org>
> Debugged-by: Nathan Chancellor <nathan@kernel.org>
> Debugged-by: Richard Henderson <richard.henderson@linaro.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
>  arch/arm/Kconfig          | 1 +
>  arch/arm/mm/proc-macros.S | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index fc196421b2ce..b760dd45b734 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -92,6 +92,7 @@ config ARM
>         select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
>         select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
>         select HAVE_FUNCTION_TRACER if !XIP_KERNEL
> +       select HAVE_FUTEX_CMPXCHG if FUTEX
>         select HAVE_GCC_PLUGINS
>         select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
>         select HAVE_IRQ_TIME_ACCOUNTING
> diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> index e2c743aa2eb2..d9f7dfe2a7ed 100644
> --- a/arch/arm/mm/proc-macros.S
> +++ b/arch/arm/mm/proc-macros.S
> @@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
>
>  .macro define_tlb_functions name:req, flags_up:req, flags_smp
>         .type   \name\()_tlb_fns, #object
> +       .align 2
>  ENTRY(\name\()_tlb_fns)
>         .long   \name\()_flush_user_tlb_range
>         .long   \name\()_flush_kern_tlb_range
> --
> 2.33.0.685.g46640cef36-goog
>


-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
@ 2021-09-29 19:10   ` Nick Desaulniers
  0 siblings, 0 replies; 19+ messages in thread
From: Nick Desaulniers @ 2021-09-29 19:10 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Fangrui Song, Peter Smith, Ard Biesheuvel, Nathan Chancellor,
	Richard Henderson, Russell King, Arnd Bergmann,
	Geert Uytterhoeven, Linus Walleij, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, YiFei Zhu,
	Uwe Kleine-König, Nicolas Pitre, linux-kernel, llvm,
	Dave Martin

+ Dave (Dave, I got a bounceback on your linaro.org email address.
Consider sending a patch updating the .mailmap)

On Wed, Sep 29, 2021 at 12:08 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> QEMU 6.1.0 is more correct about trapping on misaligned accesses. A
> kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
> assembler could generate non-naturally-aligned v7wbi_tlb_fns which
> results in a boot failure. The original commit adding the macro missed
> the .align directive on this data.
>
> Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1447
> Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
> Debugged-by: Ard Biesheuvel <ardb@kernel.org>
> Debugged-by: Nathan Chancellor <nathan@kernel.org>
> Debugged-by: Richard Henderson <richard.henderson@linaro.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
>  arch/arm/Kconfig          | 1 +
>  arch/arm/mm/proc-macros.S | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index fc196421b2ce..b760dd45b734 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -92,6 +92,7 @@ config ARM
>         select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
>         select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
>         select HAVE_FUNCTION_TRACER if !XIP_KERNEL
> +       select HAVE_FUTEX_CMPXCHG if FUTEX
>         select HAVE_GCC_PLUGINS
>         select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
>         select HAVE_IRQ_TIME_ACCOUNTING
> diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> index e2c743aa2eb2..d9f7dfe2a7ed 100644
> --- a/arch/arm/mm/proc-macros.S
> +++ b/arch/arm/mm/proc-macros.S
> @@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
>
>  .macro define_tlb_functions name:req, flags_up:req, flags_smp
>         .type   \name\()_tlb_fns, #object
> +       .align 2
>  ENTRY(\name\()_tlb_fns)
>         .long   \name\()_flush_user_tlb_range
>         .long   \name\()_flush_kern_tlb_range
> --
> 2.33.0.685.g46640cef36-goog
>


-- 
Thanks,
~Nick Desaulniers

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
  2021-09-29 19:10   ` Nick Desaulniers
@ 2021-09-29 19:14     ` Nick Desaulniers
  -1 siblings, 0 replies; 19+ messages in thread
From: Nick Desaulniers @ 2021-09-29 19:14 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Fangrui Song, Peter Smith, Ard Biesheuvel, Nathan Chancellor,
	Richard Henderson, Russell King, Arnd Bergmann,
	Geert Uytterhoeven, Linus Walleij, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, YiFei Zhu,
	Uwe Kleine-König, Nicolas Pitre, linux-kernel, llvm,
	Dave Martin

On Wed, Sep 29, 2021 at 12:10 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> + Dave (Dave, I got a bounceback on your linaro.org email address.
> Consider sending a patch updating the .mailmap)
>
> On Wed, Sep 29, 2021 at 12:08 PM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
> >
> > QEMU 6.1.0 is more correct about trapping on misaligned accesses. A
> > kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
> > assembler could generate non-naturally-aligned v7wbi_tlb_fns which
> > results in a boot failure. The original commit adding the macro missed
> > the .align directive on this data.
> >
> > Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1447
> > Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
> > Debugged-by: Ard Biesheuvel <ardb@kernel.org>
> > Debugged-by: Nathan Chancellor <nathan@kernel.org>
> > Debugged-by: Richard Henderson <richard.henderson@linaro.org>
> > Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > ---
> >  arch/arm/Kconfig          | 1 +

d'oh, had an unintentional `-a` when I did `git commit`. Will resend a v2...

> >  arch/arm/mm/proc-macros.S | 1 +
> >  2 files changed, 2 insertions(+)
> >
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index fc196421b2ce..b760dd45b734 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -92,6 +92,7 @@ config ARM
> >         select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
> >         select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
> >         select HAVE_FUNCTION_TRACER if !XIP_KERNEL
> > +       select HAVE_FUTEX_CMPXCHG if FUTEX
> >         select HAVE_GCC_PLUGINS
> >         select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
> >         select HAVE_IRQ_TIME_ACCOUNTING
> > diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> > index e2c743aa2eb2..d9f7dfe2a7ed 100644
> > --- a/arch/arm/mm/proc-macros.S
> > +++ b/arch/arm/mm/proc-macros.S
> > @@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
> >
> >  .macro define_tlb_functions name:req, flags_up:req, flags_smp
> >         .type   \name\()_tlb_fns, #object
> > +       .align 2
> >  ENTRY(\name\()_tlb_fns)
> >         .long   \name\()_flush_user_tlb_range
> >         .long   \name\()_flush_kern_tlb_range
> > --
> > 2.33.0.685.g46640cef36-goog
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers



-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
@ 2021-09-29 19:14     ` Nick Desaulniers
  0 siblings, 0 replies; 19+ messages in thread
From: Nick Desaulniers @ 2021-09-29 19:14 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Fangrui Song, Peter Smith, Ard Biesheuvel, Nathan Chancellor,
	Richard Henderson, Russell King, Arnd Bergmann,
	Geert Uytterhoeven, Linus Walleij, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, YiFei Zhu,
	Uwe Kleine-König, Nicolas Pitre, linux-kernel, llvm,
	Dave Martin

On Wed, Sep 29, 2021 at 12:10 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> + Dave (Dave, I got a bounceback on your linaro.org email address.
> Consider sending a patch updating the .mailmap)
>
> On Wed, Sep 29, 2021 at 12:08 PM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
> >
> > QEMU 6.1.0 is more correct about trapping on misaligned accesses. A
> > kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
> > assembler could generate non-naturally-aligned v7wbi_tlb_fns which
> > results in a boot failure. The original commit adding the macro missed
> > the .align directive on this data.
> >
> > Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1447
> > Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
> > Debugged-by: Ard Biesheuvel <ardb@kernel.org>
> > Debugged-by: Nathan Chancellor <nathan@kernel.org>
> > Debugged-by: Richard Henderson <richard.henderson@linaro.org>
> > Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > ---
> >  arch/arm/Kconfig          | 1 +

d'oh, had an unintentional `-a` when I did `git commit`. Will resend a v2...

> >  arch/arm/mm/proc-macros.S | 1 +
> >  2 files changed, 2 insertions(+)
> >
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index fc196421b2ce..b760dd45b734 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -92,6 +92,7 @@ config ARM
> >         select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
> >         select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
> >         select HAVE_FUNCTION_TRACER if !XIP_KERNEL
> > +       select HAVE_FUTEX_CMPXCHG if FUTEX
> >         select HAVE_GCC_PLUGINS
> >         select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
> >         select HAVE_IRQ_TIME_ACCOUNTING
> > diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> > index e2c743aa2eb2..d9f7dfe2a7ed 100644
> > --- a/arch/arm/mm/proc-macros.S
> > +++ b/arch/arm/mm/proc-macros.S
> > @@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
> >
> >  .macro define_tlb_functions name:req, flags_up:req, flags_smp
> >         .type   \name\()_tlb_fns, #object
> > +       .align 2
> >  ENTRY(\name\()_tlb_fns)
> >         .long   \name\()_flush_user_tlb_range
> >         .long   \name\()_flush_kern_tlb_range
> > --
> > 2.33.0.685.g46640cef36-goog
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers



-- 
Thanks,
~Nick Desaulniers

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
  2021-09-29 19:08 ` Nick Desaulniers
@ 2021-09-29 19:14   ` Ard Biesheuvel
  -1 siblings, 0 replies; 19+ messages in thread
From: Ard Biesheuvel @ 2021-09-29 19:14 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Linux ARM, Fangrui Song, Peter Smith, Nathan Chancellor,
	Richard Henderson, Russell King, Arnd Bergmann,
	Geert Uytterhoeven, Linus Walleij, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, YiFei Zhu,
	Uwe Kleine-König, Dave Martin, Nicolas Pitre,
	Linux Kernel Mailing List, llvm

On Wed, 29 Sept 2021 at 21:08, Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> QEMU 6.1.0 is more correct about trapping on misaligned accesses. A
> kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
> assembler could generate non-naturally-aligned v7wbi_tlb_fns which
> results in a boot failure. The original commit adding the macro missed
> the .align directive on this data.
>
> Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1447
> Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
> Debugged-by: Ard Biesheuvel <ardb@kernel.org>
> Debugged-by: Nathan Chancellor <nathan@kernel.org>
> Debugged-by: Richard Henderson <richard.henderson@linaro.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
>  arch/arm/Kconfig          | 1 +
>  arch/arm/mm/proc-macros.S | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index fc196421b2ce..b760dd45b734 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -92,6 +92,7 @@ config ARM
>         select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
>         select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
>         select HAVE_FUNCTION_TRACER if !XIP_KERNEL
> +       select HAVE_FUTEX_CMPXCHG if FUTEX
>         select HAVE_GCC_PLUGINS
>         select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
>         select HAVE_IRQ_TIME_ACCOUNTING

I take it this hunk got included by accident?

> diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> index e2c743aa2eb2..d9f7dfe2a7ed 100644
> --- a/arch/arm/mm/proc-macros.S
> +++ b/arch/arm/mm/proc-macros.S
> @@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
>
>  .macro define_tlb_functions name:req, flags_up:req, flags_smp
>         .type   \name\()_tlb_fns, #object
> +       .align 2
>  ENTRY(\name\()_tlb_fns)
>         .long   \name\()_flush_user_tlb_range
>         .long   \name\()_flush_kern_tlb_range
> --
> 2.33.0.685.g46640cef36-goog
>

For this part,

Acked-by: Ard Biesheuvel <ardb@kernel.org>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
@ 2021-09-29 19:14   ` Ard Biesheuvel
  0 siblings, 0 replies; 19+ messages in thread
From: Ard Biesheuvel @ 2021-09-29 19:14 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Linux ARM, Fangrui Song, Peter Smith, Nathan Chancellor,
	Richard Henderson, Russell King, Arnd Bergmann,
	Geert Uytterhoeven, Linus Walleij, Andrew Morton,
	Anshuman Khandual, Mike Rapoport, YiFei Zhu,
	Uwe Kleine-König, Dave Martin, Nicolas Pitre,
	Linux Kernel Mailing List, llvm

On Wed, 29 Sept 2021 at 21:08, Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> QEMU 6.1.0 is more correct about trapping on misaligned accesses. A
> kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
> assembler could generate non-naturally-aligned v7wbi_tlb_fns which
> results in a boot failure. The original commit adding the macro missed
> the .align directive on this data.
>
> Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1447
> Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
> Debugged-by: Ard Biesheuvel <ardb@kernel.org>
> Debugged-by: Nathan Chancellor <nathan@kernel.org>
> Debugged-by: Richard Henderson <richard.henderson@linaro.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
>  arch/arm/Kconfig          | 1 +
>  arch/arm/mm/proc-macros.S | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index fc196421b2ce..b760dd45b734 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -92,6 +92,7 @@ config ARM
>         select HAVE_FTRACE_MCOUNT_RECORD if !XIP_KERNEL
>         select HAVE_FUNCTION_GRAPH_TRACER if !THUMB2_KERNEL && !CC_IS_CLANG
>         select HAVE_FUNCTION_TRACER if !XIP_KERNEL
> +       select HAVE_FUTEX_CMPXCHG if FUTEX
>         select HAVE_GCC_PLUGINS
>         select HAVE_HW_BREAKPOINT if PERF_EVENTS && (CPU_V6 || CPU_V6K || CPU_V7)
>         select HAVE_IRQ_TIME_ACCOUNTING

I take it this hunk got included by accident?

> diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> index e2c743aa2eb2..d9f7dfe2a7ed 100644
> --- a/arch/arm/mm/proc-macros.S
> +++ b/arch/arm/mm/proc-macros.S
> @@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
>
>  .macro define_tlb_functions name:req, flags_up:req, flags_smp
>         .type   \name\()_tlb_fns, #object
> +       .align 2
>  ENTRY(\name\()_tlb_fns)
>         .long   \name\()_flush_user_tlb_range
>         .long   \name\()_flush_kern_tlb_range
> --
> 2.33.0.685.g46640cef36-goog
>

For this part,

Acked-by: Ard Biesheuvel <ardb@kernel.org>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
  2021-09-29 19:14     ` Nick Desaulniers
  (?)
@ 2021-09-29 19:20       ` Nick Desaulniers
  -1 siblings, 0 replies; 19+ messages in thread
From: Nick Desaulniers @ 2021-09-29 19:20 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Fangrui Song, Peter Smith, Nick Desaulniers, Ard Biesheuvel,
	Nathan Chancellor, Richard Henderson, Russell King, Dave Martin,
	Nicolas Pitre, linux-kernel, llvm

QEMU 6.1.0 is more correct about trapping on misaligned accesses. A
kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
assembler could generate non-naturally-aligned v7wbi_tlb_fns which
results in a boot failure. The original commit adding the macro missed
the .align directive on this data.

Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
Link: https://github.com/ClangBuiltLinux/linux/issues/1447
Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
Debugged-by: Ard Biesheuvel <ardb@kernel.org>
Debugged-by: Nathan Chancellor <nathan@kernel.org>
Debugged-by: Richard Henderson <richard.henderson@linaro.org>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
Changes V1 -> V2:
* Drop accidentally committed Kconfig change.
* Pick up Ard's AB tag.

 arch/arm/mm/proc-macros.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index e2c743aa2eb2..d9f7dfe2a7ed 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
 
 .macro define_tlb_functions name:req, flags_up:req, flags_smp
 	.type	\name\()_tlb_fns, #object
+	.align 2
 ENTRY(\name\()_tlb_fns)
 	.long	\name\()_flush_user_tlb_range
 	.long	\name\()_flush_kern_tlb_range

base-commit: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
prerequisite-patch-id: 3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0
-- 
2.33.0.685.g46640cef36-goog


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
@ 2021-09-29 19:20       ` Nick Desaulniers
  0 siblings, 0 replies; 19+ messages in thread
From: Nick Desaulniers @ 2021-09-29 19:20 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Fangrui Song, Peter Smith, Nick Desaulniers, Ard Biesheuvel,
	Nathan Chancellor, Richard Henderson, Russell King, Dave Martin,
	Nicolas Pitre, linux-kernel, llvm

QEMU 6.1.0 is more correct about trapping on misaligned accesses. A
kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
assembler could generate non-naturally-aligned v7wbi_tlb_fns which
results in a boot failure. The original commit adding the macro missed
the .align directive on this data.

Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
Link: https://github.com/ClangBuiltLinux/linux/issues/1447
Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
Debugged-by: Ard Biesheuvel <ardb@kernel.org>
Debugged-by: Nathan Chancellor <nathan@kernel.org>
Debugged-by: Richard Henderson <richard.henderson@linaro.org>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
Changes V1 -> V2:
* Drop accidentally committed Kconfig change.
* Pick up Ard's AB tag.

 arch/arm/mm/proc-macros.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index e2c743aa2eb2..d9f7dfe2a7ed 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
 
 .macro define_tlb_functions name:req, flags_up:req, flags_smp
 	.type	\name\()_tlb_fns, #object
+	.align 2
 ENTRY(\name\()_tlb_fns)
 	.long	\name\()_flush_user_tlb_range
 	.long	\name\()_flush_kern_tlb_range

base-commit: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
prerequisite-patch-id: 3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0
-- 
2.33.0.685.g46640cef36-goog


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
@ 2021-09-29 19:20       ` Nick Desaulniers
  0 siblings, 0 replies; 19+ messages in thread
From: Nick Desaulniers @ 2021-09-29 19:20 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Fangrui Song, Peter Smith, Nick Desaulniers, Ard Biesheuvel,
	Nathan Chancellor, Richard Henderson, Russell King, Dave Martin,
	Nicolas Pitre, linux-kernel, llvm

QEMU 6.1.0 is more correct about trapping on misaligned accesses. A
kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
assembler could generate non-naturally-aligned v7wbi_tlb_fns which
results in a boot failure. The original commit adding the macro missed
the .align directive on this data.

Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
Link: https://github.com/ClangBuiltLinux/linux/issues/1447
Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
Debugged-by: Ard Biesheuvel <ardb@kernel.org>
Debugged-by: Nathan Chancellor <nathan@kernel.org>
Debugged-by: Richard Henderson <richard.henderson@linaro.org>
Suggested-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
---
Changes V1 -> V2:
* Drop accidentally committed Kconfig change.
* Pick up Ard's AB tag.

 arch/arm/mm/proc-macros.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
index e2c743aa2eb2..d9f7dfe2a7ed 100644
--- a/arch/arm/mm/proc-macros.S
+++ b/arch/arm/mm/proc-macros.S
@@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
 
 .macro define_tlb_functions name:req, flags_up:req, flags_smp
 	.type	\name\()_tlb_fns, #object
+	.align 2
 ENTRY(\name\()_tlb_fns)
 	.long	\name\()_flush_user_tlb_range
 	.long	\name\()_flush_kern_tlb_range

base-commit: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
prerequisite-patch-id: 3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0
-- 
2.33.0.685.g46640cef36-goog


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v2] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
  2021-09-29 19:20       ` Nick Desaulniers
@ 2021-09-29 20:37         ` Nathan Chancellor
  -1 siblings, 0 replies; 19+ messages in thread
From: Nathan Chancellor @ 2021-09-29 20:37 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: linux-arm-kernel, Fangrui Song, Peter Smith, Ard Biesheuvel,
	Richard Henderson, Russell King, Dave Martin, Nicolas Pitre,
	linux-kernel, llvm

On Wed, Sep 29, 2021 at 12:20:24PM -0700, Nick Desaulniers wrote:
> QEMU 6.1.0 is more correct about trapping on misaligned accesses. A
> kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
> assembler could generate non-naturally-aligned v7wbi_tlb_fns which
> results in a boot failure. The original commit adding the macro missed
> the .align directive on this data.
> 
> Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1447
> Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
> Debugged-by: Ard Biesheuvel <ardb@kernel.org>
> Debugged-by: Nathan Chancellor <nathan@kernel.org>
> Debugged-by: Richard Henderson <richard.henderson@linaro.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Acked-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Tested-by: Nathan Chancellor <nathan@kernel.org>

> ---
> Changes V1 -> V2:
> * Drop accidentally committed Kconfig change.
> * Pick up Ard's AB tag.
> 
>  arch/arm/mm/proc-macros.S | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> index e2c743aa2eb2..d9f7dfe2a7ed 100644
> --- a/arch/arm/mm/proc-macros.S
> +++ b/arch/arm/mm/proc-macros.S
> @@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
>  
>  .macro define_tlb_functions name:req, flags_up:req, flags_smp
>  	.type	\name\()_tlb_fns, #object
> +	.align 2
>  ENTRY(\name\()_tlb_fns)
>  	.long	\name\()_flush_user_tlb_range
>  	.long	\name\()_flush_kern_tlb_range
> 
> base-commit: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
> prerequisite-patch-id: 3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0
> -- 
> 2.33.0.685.g46640cef36-goog
> 
> 

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
@ 2021-09-29 20:37         ` Nathan Chancellor
  0 siblings, 0 replies; 19+ messages in thread
From: Nathan Chancellor @ 2021-09-29 20:37 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: linux-arm-kernel, Fangrui Song, Peter Smith, Ard Biesheuvel,
	Richard Henderson, Russell King, Dave Martin, Nicolas Pitre,
	linux-kernel, llvm

On Wed, Sep 29, 2021 at 12:20:24PM -0700, Nick Desaulniers wrote:
> QEMU 6.1.0 is more correct about trapping on misaligned accesses. A
> kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
> assembler could generate non-naturally-aligned v7wbi_tlb_fns which
> results in a boot failure. The original commit adding the macro missed
> the .align directive on this data.
> 
> Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1447
> Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
> Debugged-by: Ard Biesheuvel <ardb@kernel.org>
> Debugged-by: Nathan Chancellor <nathan@kernel.org>
> Debugged-by: Richard Henderson <richard.henderson@linaro.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Acked-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>

Tested-by: Nathan Chancellor <nathan@kernel.org>

> ---
> Changes V1 -> V2:
> * Drop accidentally committed Kconfig change.
> * Pick up Ard's AB tag.
> 
>  arch/arm/mm/proc-macros.S | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> index e2c743aa2eb2..d9f7dfe2a7ed 100644
> --- a/arch/arm/mm/proc-macros.S
> +++ b/arch/arm/mm/proc-macros.S
> @@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
>  
>  .macro define_tlb_functions name:req, flags_up:req, flags_smp
>  	.type	\name\()_tlb_fns, #object
> +	.align 2
>  ENTRY(\name\()_tlb_fns)
>  	.long	\name\()_flush_user_tlb_range
>  	.long	\name\()_flush_kern_tlb_range
> 
> base-commit: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
> prerequisite-patch-id: 3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0
> -- 
> 2.33.0.685.g46640cef36-goog
> 
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
  2021-09-29 19:20       ` Nick Desaulniers
  (?)
@ 2021-09-29 20:57         ` Ard Biesheuvel
  -1 siblings, 0 replies; 19+ messages in thread
From: Ard Biesheuvel @ 2021-09-29 20:57 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Linux ARM, Fangrui Song, Peter Smith, Nathan Chancellor,
	Richard Henderson, Russell King, Dave Martin, Nicolas Pitre,
	Linux Kernel Mailing List, llvm

On Wed, 29 Sept 2021 at 21:20, Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> QEMU 6.1.0 is more correct about trapping on misaligned accesses.

Btw, this is not entirely relevant. QEMU now behaves like every single
hardware implementation does, and reports an alignment fault when
using a load-multiple instruction on an address that is not 32-bit
aligned, as the architecture requires.


> A
> kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
> assembler could generate non-naturally-aligned v7wbi_tlb_fns which
> results in a boot failure. The original commit adding the macro missed
> the .align directive on this data.
>
> Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1447
> Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
> Debugged-by: Ard Biesheuvel <ardb@kernel.org>
> Debugged-by: Nathan Chancellor <nathan@kernel.org>
> Debugged-by: Richard Henderson <richard.henderson@linaro.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Acked-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> Changes V1 -> V2:
> * Drop accidentally committed Kconfig change.
> * Pick up Ard's AB tag.
>
>  arch/arm/mm/proc-macros.S | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> index e2c743aa2eb2..d9f7dfe2a7ed 100644
> --- a/arch/arm/mm/proc-macros.S
> +++ b/arch/arm/mm/proc-macros.S
> @@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
>
>  .macro define_tlb_functions name:req, flags_up:req, flags_smp
>         .type   \name\()_tlb_fns, #object
> +       .align 2
>  ENTRY(\name\()_tlb_fns)
>         .long   \name\()_flush_user_tlb_range
>         .long   \name\()_flush_kern_tlb_range
>
> base-commit: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
> prerequisite-patch-id: 3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0
> --
> 2.33.0.685.g46640cef36-goog
>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
@ 2021-09-29 20:57         ` Ard Biesheuvel
  0 siblings, 0 replies; 19+ messages in thread
From: Ard Biesheuvel @ 2021-09-29 20:57 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Linux ARM, Fangrui Song, Peter Smith, Nathan Chancellor,
	Richard Henderson, Russell King, Dave Martin, Nicolas Pitre,
	Linux Kernel Mailing List, llvm

On Wed, 29 Sept 2021 at 21:20, Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> QEMU 6.1.0 is more correct about trapping on misaligned accesses.

Btw, this is not entirely relevant. QEMU now behaves like every single
hardware implementation does, and reports an alignment fault when
using a load-multiple instruction on an address that is not 32-bit
aligned, as the architecture requires.


> A
> kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
> assembler could generate non-naturally-aligned v7wbi_tlb_fns which
> results in a boot failure. The original commit adding the macro missed
> the .align directive on this data.
>
> Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1447
> Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
> Debugged-by: Ard Biesheuvel <ardb@kernel.org>
> Debugged-by: Nathan Chancellor <nathan@kernel.org>
> Debugged-by: Richard Henderson <richard.henderson@linaro.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Acked-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> Changes V1 -> V2:
> * Drop accidentally committed Kconfig change.
> * Pick up Ard's AB tag.
>
>  arch/arm/mm/proc-macros.S | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> index e2c743aa2eb2..d9f7dfe2a7ed 100644
> --- a/arch/arm/mm/proc-macros.S
> +++ b/arch/arm/mm/proc-macros.S
> @@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
>
>  .macro define_tlb_functions name:req, flags_up:req, flags_smp
>         .type   \name\()_tlb_fns, #object
> +       .align 2
>  ENTRY(\name\()_tlb_fns)
>         .long   \name\()_flush_user_tlb_range
>         .long   \name\()_flush_kern_tlb_range
>
> base-commit: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
> prerequisite-patch-id: 3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0
> --
> 2.33.0.685.g46640cef36-goog
>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
@ 2021-09-29 20:57         ` Ard Biesheuvel
  0 siblings, 0 replies; 19+ messages in thread
From: Ard Biesheuvel @ 2021-09-29 20:57 UTC (permalink / raw)
  To: Nick Desaulniers
  Cc: Linux ARM, Fangrui Song, Peter Smith, Nathan Chancellor,
	Richard Henderson, Russell King, Dave Martin, Nicolas Pitre,
	Linux Kernel Mailing List, llvm

On Wed, 29 Sept 2021 at 21:20, Nick Desaulniers <ndesaulniers@google.com> wrote:
>
> QEMU 6.1.0 is more correct about trapping on misaligned accesses.

Btw, this is not entirely relevant. QEMU now behaves like every single
hardware implementation does, and reports an alignment fault when
using a load-multiple instruction on an address that is not 32-bit
aligned, as the architecture requires.


> A
> kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
> assembler could generate non-naturally-aligned v7wbi_tlb_fns which
> results in a boot failure. The original commit adding the macro missed
> the .align directive on this data.
>
> Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
> Link: https://github.com/ClangBuiltLinux/linux/issues/1447
> Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
> Debugged-by: Ard Biesheuvel <ardb@kernel.org>
> Debugged-by: Nathan Chancellor <nathan@kernel.org>
> Debugged-by: Richard Henderson <richard.henderson@linaro.org>
> Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> Acked-by: Ard Biesheuvel <ardb@kernel.org>
> Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> ---
> Changes V1 -> V2:
> * Drop accidentally committed Kconfig change.
> * Pick up Ard's AB tag.
>
>  arch/arm/mm/proc-macros.S | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> index e2c743aa2eb2..d9f7dfe2a7ed 100644
> --- a/arch/arm/mm/proc-macros.S
> +++ b/arch/arm/mm/proc-macros.S
> @@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
>
>  .macro define_tlb_functions name:req, flags_up:req, flags_smp
>         .type   \name\()_tlb_fns, #object
> +       .align 2
>  ENTRY(\name\()_tlb_fns)
>         .long   \name\()_flush_user_tlb_range
>         .long   \name\()_flush_kern_tlb_range
>
> base-commit: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
> prerequisite-patch-id: 3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0
> --
> 2.33.0.685.g46640cef36-goog
>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
  2021-09-29 20:57         ` Ard Biesheuvel
  (?)
@ 2021-09-29 20:59           ` Nick Desaulniers
  -1 siblings, 0 replies; 19+ messages in thread
From: Nick Desaulniers @ 2021-09-29 20:59 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Linux ARM, Fangrui Song, Peter Smith, Nathan Chancellor,
	Richard Henderson, Russell King, Dave Martin, Nicolas Pitre,
	Linux Kernel Mailing List, llvm

On Wed, Sep 29, 2021 at 1:57 PM Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Wed, 29 Sept 2021 at 21:20, Nick Desaulniers <ndesaulniers@google.com> wrote:
> >
> > QEMU 6.1.0 is more correct about trapping on misaligned accesses.
>
> Btw, this is not entirely relevant. QEMU now behaves like every single
> hardware implementation does, and reports an alignment fault when
> using a load-multiple instruction on an address that is not 32-bit
> aligned, as the architecture requires.

Sure, I can drop that line from the commit message when submitting to
RMK's queue.

>
>
> > A
> > kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
> > assembler could generate non-naturally-aligned v7wbi_tlb_fns which
> > results in a boot failure. The original commit adding the macro missed
> > the .align directive on this data.
> >
> > Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1447
> > Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
> > Debugged-by: Ard Biesheuvel <ardb@kernel.org>
> > Debugged-by: Nathan Chancellor <nathan@kernel.org>
> > Debugged-by: Richard Henderson <richard.henderson@linaro.org>
> > Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> > Acked-by: Ard Biesheuvel <ardb@kernel.org>
> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > ---
> > Changes V1 -> V2:
> > * Drop accidentally committed Kconfig change.
> > * Pick up Ard's AB tag.
> >
> >  arch/arm/mm/proc-macros.S | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> > index e2c743aa2eb2..d9f7dfe2a7ed 100644
> > --- a/arch/arm/mm/proc-macros.S
> > +++ b/arch/arm/mm/proc-macros.S
> > @@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
> >
> >  .macro define_tlb_functions name:req, flags_up:req, flags_smp
> >         .type   \name\()_tlb_fns, #object
> > +       .align 2
> >  ENTRY(\name\()_tlb_fns)
> >         .long   \name\()_flush_user_tlb_range
> >         .long   \name\()_flush_kern_tlb_range
> >
> > base-commit: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
> > prerequisite-patch-id: 3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0
> > --
> > 2.33.0.685.g46640cef36-goog
> >



-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
@ 2021-09-29 20:59           ` Nick Desaulniers
  0 siblings, 0 replies; 19+ messages in thread
From: Nick Desaulniers @ 2021-09-29 20:59 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Linux ARM, Fangrui Song, Peter Smith, Nathan Chancellor,
	Richard Henderson, Russell King, Dave Martin, Nicolas Pitre,
	Linux Kernel Mailing List, llvm

On Wed, Sep 29, 2021 at 1:57 PM Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Wed, 29 Sept 2021 at 21:20, Nick Desaulniers <ndesaulniers@google.com> wrote:
> >
> > QEMU 6.1.0 is more correct about trapping on misaligned accesses.
>
> Btw, this is not entirely relevant. QEMU now behaves like every single
> hardware implementation does, and reports an alignment fault when
> using a load-multiple instruction on an address that is not 32-bit
> aligned, as the architecture requires.

Sure, I can drop that line from the commit message when submitting to
RMK's queue.

>
>
> > A
> > kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
> > assembler could generate non-naturally-aligned v7wbi_tlb_fns which
> > results in a boot failure. The original commit adding the macro missed
> > the .align directive on this data.
> >
> > Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1447
> > Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
> > Debugged-by: Ard Biesheuvel <ardb@kernel.org>
> > Debugged-by: Nathan Chancellor <nathan@kernel.org>
> > Debugged-by: Richard Henderson <richard.henderson@linaro.org>
> > Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> > Acked-by: Ard Biesheuvel <ardb@kernel.org>
> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > ---
> > Changes V1 -> V2:
> > * Drop accidentally committed Kconfig change.
> > * Pick up Ard's AB tag.
> >
> >  arch/arm/mm/proc-macros.S | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> > index e2c743aa2eb2..d9f7dfe2a7ed 100644
> > --- a/arch/arm/mm/proc-macros.S
> > +++ b/arch/arm/mm/proc-macros.S
> > @@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
> >
> >  .macro define_tlb_functions name:req, flags_up:req, flags_smp
> >         .type   \name\()_tlb_fns, #object
> > +       .align 2
> >  ENTRY(\name\()_tlb_fns)
> >         .long   \name\()_flush_user_tlb_range
> >         .long   \name\()_flush_kern_tlb_range
> >
> > base-commit: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
> > prerequisite-patch-id: 3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0
> > --
> > 2.33.0.685.g46640cef36-goog
> >



-- 
Thanks,
~Nick Desaulniers

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned
@ 2021-09-29 20:59           ` Nick Desaulniers
  0 siblings, 0 replies; 19+ messages in thread
From: Nick Desaulniers @ 2021-09-29 20:59 UTC (permalink / raw)
  To: Ard Biesheuvel
  Cc: Linux ARM, Fangrui Song, Peter Smith, Nathan Chancellor,
	Richard Henderson, Russell King, Dave Martin, Nicolas Pitre,
	Linux Kernel Mailing List, llvm

On Wed, Sep 29, 2021 at 1:57 PM Ard Biesheuvel <ardb@kernel.org> wrote:
>
> On Wed, 29 Sept 2021 at 21:20, Nick Desaulniers <ndesaulniers@google.com> wrote:
> >
> > QEMU 6.1.0 is more correct about trapping on misaligned accesses.
>
> Btw, this is not entirely relevant. QEMU now behaves like every single
> hardware implementation does, and reports an alignment fault when
> using a load-multiple instruction on an address that is not 32-bit
> aligned, as the architecture requires.

Sure, I can drop that line from the commit message when submitting to
RMK's queue.

>
>
> > A
> > kernel built with CONFIG_THUMB2_KERNEL=y and using clang as the
> > assembler could generate non-naturally-aligned v7wbi_tlb_fns which
> > results in a boot failure. The original commit adding the macro missed
> > the .align directive on this data.
> >
> > Fixes: 66a625a88174 ("ARM: mm: proc-macros: Add generic proc/cache/tlb struct definition macros")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1447
> > Link: https://lore.kernel.org/all/0699da7b-354f-aecc-a62f-e25693209af4@linaro.org/
> > Debugged-by: Ard Biesheuvel <ardb@kernel.org>
> > Debugged-by: Nathan Chancellor <nathan@kernel.org>
> > Debugged-by: Richard Henderson <richard.henderson@linaro.org>
> > Suggested-by: Ard Biesheuvel <ardb@kernel.org>
> > Acked-by: Ard Biesheuvel <ardb@kernel.org>
> > Signed-off-by: Nick Desaulniers <ndesaulniers@google.com>
> > ---
> > Changes V1 -> V2:
> > * Drop accidentally committed Kconfig change.
> > * Pick up Ard's AB tag.
> >
> >  arch/arm/mm/proc-macros.S | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/arch/arm/mm/proc-macros.S b/arch/arm/mm/proc-macros.S
> > index e2c743aa2eb2..d9f7dfe2a7ed 100644
> > --- a/arch/arm/mm/proc-macros.S
> > +++ b/arch/arm/mm/proc-macros.S
> > @@ -340,6 +340,7 @@ ENTRY(\name\()_cache_fns)
> >
> >  .macro define_tlb_functions name:req, flags_up:req, flags_smp
> >         .type   \name\()_tlb_fns, #object
> > +       .align 2
> >  ENTRY(\name\()_tlb_fns)
> >         .long   \name\()_flush_user_tlb_range
> >         .long   \name\()_flush_kern_tlb_range
> >
> > base-commit: 02d5e016800d082058b3d3b7c3ede136cdc6ddcb
> > prerequisite-patch-id: 3edbe4a8485c7a75a61dbbe299e8ce1985d87ee0
> > --
> > 2.33.0.685.g46640cef36-goog
> >



-- 
Thanks,
~Nick Desaulniers

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2021-09-29 21:02 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-29 19:08 [PATCH] ARM: mm: proc-macros: ensure *_tlb_fns are 4B aligned Nick Desaulniers
2021-09-29 19:08 ` Nick Desaulniers
2021-09-29 19:10 ` Nick Desaulniers
2021-09-29 19:10   ` Nick Desaulniers
2021-09-29 19:14   ` Nick Desaulniers
2021-09-29 19:14     ` Nick Desaulniers
2021-09-29 19:20     ` [PATCH v2] " Nick Desaulniers
2021-09-29 19:20       ` Nick Desaulniers
2021-09-29 19:20       ` Nick Desaulniers
2021-09-29 20:37       ` Nathan Chancellor
2021-09-29 20:37         ` Nathan Chancellor
2021-09-29 20:57       ` Ard Biesheuvel
2021-09-29 20:57         ` Ard Biesheuvel
2021-09-29 20:57         ` Ard Biesheuvel
2021-09-29 20:59         ` Nick Desaulniers
2021-09-29 20:59           ` Nick Desaulniers
2021-09-29 20:59           ` Nick Desaulniers
2021-09-29 19:14 ` [PATCH] " Ard Biesheuvel
2021-09-29 19:14   ` Ard Biesheuvel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.