On Tue, Jan 06, 2026 at 02:16:35AM -0800, Breno Leitao wrote:
> The arm64 kernel doesn't boot with annotated branches
> (PROFILE_ANNOTATED_BRANCHES) enabled and CONFIG_DEBUG_VIRTUAL together.
> 
> Bisecting it, I found that disabling branch profiling in arch/arm64/mm
> solved the problem. Narrowing down a bit further, I found that
> physaddr.c is the file that needs to have branch profiling disabled to
> get the machine to boot.
> 
> I suspect that it might invoke some ftrace helper very early in the boot
> process and ftrace is still not enabled(!?).
> 
> Rather than playing whack-a-mole with individual files, disable branch
> profiling for the entire arch/arm64 tree, similar to what x86 already
> does in arch/x86/Kbuild.
> 
> Cc: [email protected]
> Fixes: ec6d06efb0bac ("arm64: Add support for CONFIG_DEBUG_VIRTUAL")
> Signed-off-by: Breno Leitao <[email protected]>

I don't think ec6d06efb0bac is to blame here, and CONFIG_DEBUG_VIRTUAL
is unsound in a number of places, so I'd prefer to remove that Fixes tag
and backport this for all stable trees.

Regardless, I'm in favour of disabling CONFIG_DEBUG_VIRTUAL widely, so:

Acked-by: Mark Rutland <[email protected]>

Mark.

> ---
> Changes in v2:
> - Expand the scope to arch/arm64 instead of just physaddr.c
> - Link to v1: 
> https://lore.kernel.org/all/[email protected]/
> ---
>  arch/arm64/Kbuild | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/arm64/Kbuild b/arch/arm64/Kbuild
> index 5bfbf7d79c99..d876bc0e5421 100644
> --- a/arch/arm64/Kbuild
> +++ b/arch/arm64/Kbuild
> @@ -1,4 +1,8 @@
>  # SPDX-License-Identifier: GPL-2.0-only
> +
> +# Branch profiling isn't noinstr-safe
> +subdir-ccflags-$(CONFIG_TRACE_BRANCH_PROFILING) += -DDISABLE_BRANCH_PROFILING
> +
>  obj-y                        += kernel/ mm/ net/
>  obj-$(CONFIG_KVM)    += kvm/
>  obj-$(CONFIG_XEN)    += xen/
> 
> ---
> base-commit: c8ebd433459bcbf068682b09544e830acd7ed222
> change-id: 20251231-annotated-75de3f33cd7b
> 
> Best regards,
> --  
> Breno Leitao <[email protected]>
> 

Reply via email to