Re: [PATCH] gcov,x86: Mark GCOV broken for x86

From: Nick Desaulniers
Date: Mon Jun 14 2021 - 12:05:21 EST


On Mon, Jun 14, 2021 at 3:17 AM Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
>
> As recently discovered, there is no function attribute to disable the
> -fprofile-generate instrumentation. As such, GCOV is fundamentally
> incompatible with architectures that rely on 'noinstr' for correctness.

Is there context for comment, or is this patch meant as a joke?

>
> Until such time as that compilers have added a function attribute to
> disable this instrumentation, mark GCOV as broken.
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> ---
> arch/x86/Kconfig | 2 +-
> kernel/gcov/Kconfig | 4 ++++
> 2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
> index 86dae426798b..c0f8c9d4c31a 100644
> --- a/arch/x86/Kconfig
> +++ b/arch/x86/Kconfig
> @@ -75,7 +75,7 @@ config X86
> select ARCH_HAS_FAST_MULTIPLIER
> select ARCH_HAS_FILTER_PGPROT
> select ARCH_HAS_FORTIFY_SOURCE
> - select ARCH_HAS_GCOV_PROFILE_ALL
> + select ARCH_HAS_GCOV_BROKEN
> select ARCH_HAS_KCOV if X86_64 && STACK_VALIDATION
> select ARCH_HAS_MEM_ENCRYPT
> select ARCH_HAS_MEMBARRIER_SYNC_CORE
> diff --git a/kernel/gcov/Kconfig b/kernel/gcov/Kconfig
> index 58f87a3092f3..74b028a66ebe 100644
> --- a/kernel/gcov/Kconfig
> +++ b/kernel/gcov/Kconfig
> @@ -1,10 +1,14 @@
> # SPDX-License-Identifier: GPL-2.0-only
> menu "GCOV-based kernel profiling"
>
> +config ARCH_HAS_GCOV_BROKEN
> + def_bool n
> +
> config GCOV_KERNEL
> bool "Enable gcov-based kernel profiling"
> depends on DEBUG_FS
> depends on !CC_IS_CLANG || CLANG_VERSION >= 110000
> + depends on !ARCH_HAS_GCOV_BROKEN
> select CONSTRUCTORS
> default n
> help



--
Thanks,
~Nick Desaulniers