All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	Sathvika Vasireddy <sv@linux.ibm.com>
Cc: "aik@ozlabs.ru" <aik@ozlabs.ru>,
	"jpoimboe@redhat.com" <jpoimboe@redhat.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>
Subject: Re: [RFC PATCH 2/3] objtool: Enable and implement 'mcount' subcommand
Date: Mon, 21 Mar 2022 08:26:55 +0000	[thread overview]
Message-ID: <b06bb9bc-22d1-acce-fe68-c7c4cb7c15b5@csgroup.eu> (raw)
In-Reply-To: <1647850610.961i89najm.naveen@linux.ibm.com>



Le 21/03/2022 à 09:19, Naveen N. Rao a écrit :
> Christophe Leroy wrote:
>>
>>
>> Le 18/03/2022 à 11:51, Sathvika Vasireddy a écrit :
>>> This patch adds 'mcount' as a subcommand to objtool, and enables
>>> the same for x86. objtool is built if CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
>>> is selected. Additionally, architectures can select HAVE_NOP_MCOUNT
>>> if they choose to nop out mcount call sites. If that config option is
>>> selected, then --mnop is passed as an option to 'objtool mcount'
>>>
>>> Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
>>> ---
>>>   Makefile                                |   6 ++
>>>   arch/x86/Kconfig                        |   3 +-
>>>   scripts/Makefile.build                  |  12 +++
>>>   tools/objtool/Build                     |   2 +
>>>   tools/objtool/Makefile                  |   4 +-
>>>   tools/objtool/builtin-mcount.c          |  74 +++++++++++++
>>>   tools/objtool/include/objtool/builtin.h |   4 +-
>>>   tools/objtool/include/objtool/objtool.h |   1 +
>>>   tools/objtool/mcount.c                  | 138 ++++++++++++++++++++++++
>>>   tools/objtool/objtool.c                 |   1 +
>>>   tools/objtool/weak.c                    |   5 +
>>>   11 files changed, 247 insertions(+), 3 deletions(-)
>>>   create mode 100644 tools/objtool/builtin-mcount.c
>>>   create mode 100644 tools/objtool/mcount.c
>>>
>>> diff --git a/Makefile b/Makefile
>>> index 55a30ca69350..316f7d08b30a 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -846,7 +846,9 @@ ifdef CONFIG_FTRACE_MCOUNT_USE_CC
>>>     endif
>>>   endif
>>>   ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
>>> + ifdef CONFIG_HAVE_NOP_MCOUNT
>>>     CC_FLAGS_USING    += -DCC_USING_NOP_MCOUNT
>>> + endif
>>>   endif
>>>   ifdef CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
>>>     ifdef CONFIG_HAVE_C_RECORDMCOUNT
>>> @@ -1303,6 +1305,10 @@ ifdef CONFIG_STACK_VALIDATION
>>>   prepare: tools/objtool
>>>   endif
>>> +ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
>>> +prepare: tools/objtool
>>> +endif
>>
>> I don't think that will work for powerpc.
>>
>> See arch/powerpc/Makefile
>>
>> powerpc builds the VDSO under prepare: , and powerpc has 
>> CONFIG_HAVE_GENERIC_VDSO so there are some C files in that step that 
>> seem to use objtool, allthough that looks odd to me. Must be something 
>> to fix somewhere.
>>
>>    powerpc64-linux-gcc 
>> -Wp,-MMD,arch/powerpc/kernel/vdso/.vgettimeofday-64.o.d -nostdinc 
>> -I./arch/powerpc/include -I./arch/powerpc/include/generated  
>> -I./include -I./arch/powerpc/include/uapi 
>> -I./arch/powerpc/include/generated/uapi -I./include/uapi 
>> -I./include/generated/uapi -include ./include/linux/compiler-version.h 
>> -include ./include/linux/kconfig.h -include 
>> ./include/linux/compiler_types.h -D__KERNEL__ -I ./arch/powerpc 
>> -DHAVE_AS_ATHIGH=1 -fmacro-prefix-map=./= -Wall -Wundef 
>> -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing 
>> -fno-common -fshort-wchar -fno-PIE 
>> -Werror=implicit-function-declaration -Werror=implicit-int 
>> -Werror=return-type -Wno-format-security -std=gnu89 -mbig-endian -m64 
>> -msoft-float -pipe -mtraceback=no -mabi=elfv1 -mcall-aixdesc 
>> -mcmodel=medium -mno-pointers-to-nested-functions -mtune=power7 
>> -mcpu=power5 -mno-altivec -mno-vsx -fno-asynchronous-unwind-tables 
>> -mno-string -Wa,-maltivec -Wa,-mpower4 -Wa,-many -mabi=elfv1 
>> -mcall-aixdesc -mbig-endian -mstack-protector-guard=tls 
>> -mstack-protector-guard-reg=r13 -fno-delete-null-pointer-checks 
>> -Wno-frame-address -Wno-format-truncation -Wno-format-overflow 
>> -Wno-address-of-packed-member -O2 -fno-allow-store-data-races 
>> -Wframe-larger-than=2048 -fstack-protector-strong 
>> -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable 
>> -Wno-unused-const-variable -fno-stack-clash-protection 
>> -Wdeclaration-after-statement -Wvla -Wno-pointer-sign 
>> -Wcast-function-type -Wno-stringop-truncation -Wno-zero-length-bounds 
>> -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict 
>> -Wno-maybe-uninitialized -Wno-alloc-size-larger-than 
>> -fno-strict-overflow -fno-stack-check -fconserve-stack 
>> -Werror=date-time -Werror=incompatible-pointer-types 
>> -Werror=designated-init -Wno-packed-not-aligned 
>> -mstack-protector-guard-offset=3200 -shared -fno-common -fno-builtin 
>> -nostdlib -Wl,--hash-style=both -include 
>> /home/chleroy/linux-powerpc/lib/vdso/gettimeofday.c 
>> -fno-stack-protector -DDISABLE_BRANCH_PROFILING -ffreestanding 
>> -fasynchronous-unwind-tables -ffixed-r30 
>> -DKBUILD_MODFILE='"arch/powerpc/kernel/vdso/vgettimeofday-64"' 
>> -DKBUILD_BASENAME='"vgettimeofday_64"' 
>> -DKBUILD_MODNAME='"vgettimeofday_64"' 
>> -D__KBUILD_MODNAME=kmod_vgettimeofday_64 -c -o 
>> arch/powerpc/kernel/vdso/vgettimeofday-64.o 
>> arch/powerpc/kernel/vdso/vgettimeofday.c  ; ./tools/objtool/objtool 
>> mcount arch/powerpc/kernel/vdso/vgettimeofday-64.o
> 
> We don't enable ftrace for vdso, so I suspect objtool run above will be 
> a no-op. This needs to be confirmed, of course.
> 

I just checked without the series: recordmcount isn't run for VDSO, so 
objtool shouldn't be run either when the series is applied.

Christophe

WARNING: multiple messages have this Message-ID (diff)
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>,
	Sathvika Vasireddy <sv@linux.ibm.com>
Cc: "aik@ozlabs.ru" <aik@ozlabs.ru>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"jpoimboe@redhat.com" <jpoimboe@redhat.com>
Subject: Re: [RFC PATCH 2/3] objtool: Enable and implement 'mcount' subcommand
Date: Mon, 21 Mar 2022 08:26:55 +0000	[thread overview]
Message-ID: <b06bb9bc-22d1-acce-fe68-c7c4cb7c15b5@csgroup.eu> (raw)
In-Reply-To: <1647850610.961i89najm.naveen@linux.ibm.com>



Le 21/03/2022 à 09:19, Naveen N. Rao a écrit :
> Christophe Leroy wrote:
>>
>>
>> Le 18/03/2022 à 11:51, Sathvika Vasireddy a écrit :
>>> This patch adds 'mcount' as a subcommand to objtool, and enables
>>> the same for x86. objtool is built if CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
>>> is selected. Additionally, architectures can select HAVE_NOP_MCOUNT
>>> if they choose to nop out mcount call sites. If that config option is
>>> selected, then --mnop is passed as an option to 'objtool mcount'
>>>
>>> Signed-off-by: Sathvika Vasireddy <sv@linux.ibm.com>
>>> ---
>>>   Makefile                                |   6 ++
>>>   arch/x86/Kconfig                        |   3 +-
>>>   scripts/Makefile.build                  |  12 +++
>>>   tools/objtool/Build                     |   2 +
>>>   tools/objtool/Makefile                  |   4 +-
>>>   tools/objtool/builtin-mcount.c          |  74 +++++++++++++
>>>   tools/objtool/include/objtool/builtin.h |   4 +-
>>>   tools/objtool/include/objtool/objtool.h |   1 +
>>>   tools/objtool/mcount.c                  | 138 ++++++++++++++++++++++++
>>>   tools/objtool/objtool.c                 |   1 +
>>>   tools/objtool/weak.c                    |   5 +
>>>   11 files changed, 247 insertions(+), 3 deletions(-)
>>>   create mode 100644 tools/objtool/builtin-mcount.c
>>>   create mode 100644 tools/objtool/mcount.c
>>>
>>> diff --git a/Makefile b/Makefile
>>> index 55a30ca69350..316f7d08b30a 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -846,7 +846,9 @@ ifdef CONFIG_FTRACE_MCOUNT_USE_CC
>>>     endif
>>>   endif
>>>   ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
>>> + ifdef CONFIG_HAVE_NOP_MCOUNT
>>>     CC_FLAGS_USING    += -DCC_USING_NOP_MCOUNT
>>> + endif
>>>   endif
>>>   ifdef CONFIG_FTRACE_MCOUNT_USE_RECORDMCOUNT
>>>     ifdef CONFIG_HAVE_C_RECORDMCOUNT
>>> @@ -1303,6 +1305,10 @@ ifdef CONFIG_STACK_VALIDATION
>>>   prepare: tools/objtool
>>>   endif
>>> +ifdef CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
>>> +prepare: tools/objtool
>>> +endif
>>
>> I don't think that will work for powerpc.
>>
>> See arch/powerpc/Makefile
>>
>> powerpc builds the VDSO under prepare: , and powerpc has 
>> CONFIG_HAVE_GENERIC_VDSO so there are some C files in that step that 
>> seem to use objtool, allthough that looks odd to me. Must be something 
>> to fix somewhere.
>>
>>    powerpc64-linux-gcc 
>> -Wp,-MMD,arch/powerpc/kernel/vdso/.vgettimeofday-64.o.d -nostdinc 
>> -I./arch/powerpc/include -I./arch/powerpc/include/generated  
>> -I./include -I./arch/powerpc/include/uapi 
>> -I./arch/powerpc/include/generated/uapi -I./include/uapi 
>> -I./include/generated/uapi -include ./include/linux/compiler-version.h 
>> -include ./include/linux/kconfig.h -include 
>> ./include/linux/compiler_types.h -D__KERNEL__ -I ./arch/powerpc 
>> -DHAVE_AS_ATHIGH=1 -fmacro-prefix-map=./= -Wall -Wundef 
>> -Werror=strict-prototypes -Wno-trigraphs -fno-strict-aliasing 
>> -fno-common -fshort-wchar -fno-PIE 
>> -Werror=implicit-function-declaration -Werror=implicit-int 
>> -Werror=return-type -Wno-format-security -std=gnu89 -mbig-endian -m64 
>> -msoft-float -pipe -mtraceback=no -mabi=elfv1 -mcall-aixdesc 
>> -mcmodel=medium -mno-pointers-to-nested-functions -mtune=power7 
>> -mcpu=power5 -mno-altivec -mno-vsx -fno-asynchronous-unwind-tables 
>> -mno-string -Wa,-maltivec -Wa,-mpower4 -Wa,-many -mabi=elfv1 
>> -mcall-aixdesc -mbig-endian -mstack-protector-guard=tls 
>> -mstack-protector-guard-reg=r13 -fno-delete-null-pointer-checks 
>> -Wno-frame-address -Wno-format-truncation -Wno-format-overflow 
>> -Wno-address-of-packed-member -O2 -fno-allow-store-data-races 
>> -Wframe-larger-than=2048 -fstack-protector-strong 
>> -Wimplicit-fallthrough=5 -Wno-main -Wno-unused-but-set-variable 
>> -Wno-unused-const-variable -fno-stack-clash-protection 
>> -Wdeclaration-after-statement -Wvla -Wno-pointer-sign 
>> -Wcast-function-type -Wno-stringop-truncation -Wno-zero-length-bounds 
>> -Wno-array-bounds -Wno-stringop-overflow -Wno-restrict 
>> -Wno-maybe-uninitialized -Wno-alloc-size-larger-than 
>> -fno-strict-overflow -fno-stack-check -fconserve-stack 
>> -Werror=date-time -Werror=incompatible-pointer-types 
>> -Werror=designated-init -Wno-packed-not-aligned 
>> -mstack-protector-guard-offset=3200 -shared -fno-common -fno-builtin 
>> -nostdlib -Wl,--hash-style=both -include 
>> /home/chleroy/linux-powerpc/lib/vdso/gettimeofday.c 
>> -fno-stack-protector -DDISABLE_BRANCH_PROFILING -ffreestanding 
>> -fasynchronous-unwind-tables -ffixed-r30 
>> -DKBUILD_MODFILE='"arch/powerpc/kernel/vdso/vgettimeofday-64"' 
>> -DKBUILD_BASENAME='"vgettimeofday_64"' 
>> -DKBUILD_MODNAME='"vgettimeofday_64"' 
>> -D__KBUILD_MODNAME=kmod_vgettimeofday_64 -c -o 
>> arch/powerpc/kernel/vdso/vgettimeofday-64.o 
>> arch/powerpc/kernel/vdso/vgettimeofday.c  ; ./tools/objtool/objtool 
>> mcount arch/powerpc/kernel/vdso/vgettimeofday-64.o
> 
> We don't enable ftrace for vdso, so I suspect objtool run above will be 
> a no-op. This needs to be confirmed, of course.
> 

I just checked without the series: recordmcount isn't run for VDSO, so 
objtool shouldn't be run either when the series is applied.

Christophe

  reply	other threads:[~2022-03-21  8:27 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-18 10:51 [RFC PATCH 0/3] objtool: Add mcount sub-command Sathvika Vasireddy
2022-03-18 10:51 ` Sathvika Vasireddy
2022-03-18 10:51 ` [RFC PATCH 1/3] objtool: Move common code to utils.c Sathvika Vasireddy
2022-03-18 10:51   ` Sathvika Vasireddy
2022-03-23 18:02   ` Miroslav Benes
2022-03-23 18:02     ` Miroslav Benes
2022-03-18 10:51 ` [RFC PATCH 2/3] objtool: Enable and implement 'mcount' subcommand Sathvika Vasireddy
2022-03-18 10:51   ` Sathvika Vasireddy
2022-03-21  7:06   ` Christophe Leroy
2022-03-21  8:19     ` Naveen N. Rao
2022-03-21  8:19       ` Naveen N. Rao
2022-03-21  8:26       ` Christophe Leroy [this message]
2022-03-21  8:26         ` Christophe Leroy
2022-03-21  9:48         ` Naveen N. Rao
2022-03-21  9:48           ` Naveen N. Rao
2022-03-18 10:51 ` [RFC PATCH 3/3] objtool/mcount: Add powerpc specific functions Sathvika Vasireddy
2022-03-18 10:51   ` Sathvika Vasireddy
2022-03-18 12:26   ` Peter Zijlstra
2022-03-18 12:26     ` Peter Zijlstra
2022-03-18 13:59     ` Christophe Leroy
2022-03-18 13:59       ` Christophe Leroy
2022-03-21  2:27       ` Michael Ellerman
2022-03-21  6:47         ` Christophe Leroy
2022-03-21  7:46         ` Christophe Leroy
2022-03-21  7:56         ` Christophe Leroy
2022-03-21  8:30           ` Christophe Leroy
2022-03-21  8:59             ` Christophe Leroy
2022-03-26  7:58           ` Christophe Leroy
2022-03-26  7:58             ` Christophe Leroy
2022-03-21  6:25     ` Naveen N. Rao
2022-03-21  6:25       ` Naveen N. Rao
2022-03-27  9:09     ` Christophe Leroy
2022-03-27  9:09       ` Christophe Leroy
2022-03-28 19:59       ` Josh Poimboeuf
2022-03-28 19:59         ` Josh Poimboeuf
2022-03-28 20:14         ` Peter Zijlstra
2022-03-28 20:14           ` Peter Zijlstra
2022-03-28 20:15           ` Peter Zijlstra
2022-03-28 20:15             ` Peter Zijlstra
2022-03-28 20:21           ` Josh Poimboeuf
2022-03-28 20:21             ` Josh Poimboeuf
2022-03-29 12:01         ` Michael Ellerman
2022-03-29 12:01           ` Michael Ellerman
2022-03-29 17:32           ` Christophe Leroy
2022-03-30  4:26             ` Josh Poimboeuf
2022-03-30  4:26               ` Josh Poimboeuf
2022-03-30 18:40             ` Naveen N. Rao
2022-03-30 18:40               ` Naveen N. Rao
2022-05-12 14:52         ` Christophe Leroy
2022-05-12 14:52           ` Christophe Leroy
2022-05-12 15:12           ` Josh Poimboeuf
2022-05-12 15:12             ` Josh Poimboeuf
2022-05-21  9:38             ` Christophe Leroy
2022-05-21  9:38               ` Christophe Leroy
2022-05-21 10:57               ` Peter Zijlstra
2022-05-21 10:57                 ` Peter Zijlstra
2022-05-23  5:39                 ` Naveen N. Rao
2022-05-23  5:39                   ` Naveen N. Rao
2022-03-19  1:35 ` [RFC PATCH 0/3] objtool: Add mcount sub-command Josh Poimboeuf
2022-03-19  1:35   ` Josh Poimboeuf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b06bb9bc-22d1-acce-fe68-c7c4cb7c15b5@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=aik@ozlabs.ru \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sv@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.