Re: [PATCH v4 00/16] objtool: Enable and implement --mcount option on powerpc

Naveen N. Rao
2022-10-10T11:49:34Z

Sathvika Vasireddy wrote:
> This patchset enables and implements objtool --mcount
> option on powerpc. This applies atop powerpc/merge branch.
>
> Changelog:
>
> ----
> v4:
>
> * Patch 11/16 - Introduce a new config option
> CONFIG_HAVE_OBJTOOL_NOP_MCOUNT as a means for
> architectures to enable nop'ing ftrace locations.
>
> - Remove Acked-by tag from Peter Zijlstra (Intel),
> and Reviewed-by tag from Christophe Leroy.
> [This is done because I reworked the patch to add
> a new config option to objtool. Please let me know
> if you want me to retain the tags. Thanks!]
>
> * Patch 16/16 - Rework the patch to handle only 'bl' instruction
> decoding.

With changes to the two patches in this series that I have described,
and with my patch to have ftrace ignore weak symbols (*) applied, I
built a ppc64le config.

(*) http://lkml.kernel.org/r/20220809105425.424045-1-naveen.n.rao@linux.vnet.ibm.com

I then used the below diff to disable objtool and to build with
recordmcount:

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 7e28a8fd4c24fa..81c9f895d69012 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -238,8 +238,6 @@ config PPC
select HAVE_MOD_ARCH_SPECIFIC
select HAVE_NMI if PERF_EVENTS || (PPC64 && PPC_BOOK3S)
select HAVE_OPTPROBES
- select HAVE_OBJTOOL if PPC32 || MPROFILE_KERNEL
- select HAVE_OBJTOOL_MCOUNT if HAVE_OBJTOOL
select HAVE_PERF_EVENTS
select HAVE_PERF_EVENTS_NMI if PPC64
select HAVE_PERF_REGS

Comparing available_filter_functions across the two builds showed the
below differences:
$ diff ftrace_funcs_recordmcount_20221010.sort.out ftrace_funcs_objtool_20221010.sort.out
6799d6798
< __dev_alloc_name
6800a6800
> dev_alloc_name_ns
11680d11679
< find_zone.isra.0
22396a22396
> ns_capable_common.part.0

All the above changes are down to compiler optimizations and shuffling
due to CONFIG_OBJTOOL being enabled and changing annotate_unreachable().

As such, for this series:
Reviewed-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Tested-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>

Josh,
Are you ok if this series is taken in through the powerpc tree?

- Naveen