Skip to contentSkip to conversation

Use -mcount-record for dynamic ftrace

PATCH In review Andi Kleen 4 participants 8 messages Apr 13, 2015 – Apr 14, 2015 Kbuild

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Use -mcount-record for dynamic ftrace

From: Andi Kleen <[email protected]>

gcc 5 supports a new -mcount-record option to generate ftrace tables directly. This avoids the need to run record_mcount manually.

Use this option when available.

It also has a -mcount-nop option to generate the mcount calls as nops. So far that is not implemented, but it could be used to optimize patching at boot up.

---
 scripts/Makefile.build | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/Makefile.build +6 -0
index 01df30a..f258e9b 100644
@@ -210,6 +210,11 @@ cmd_modversions =								\
 	fi;
 endif
 
+# gcc 5 supports generating the mcount tables directly
+ifneq ($(call cc-option,-mrecord-mcount,y),y)
+KBUILD_CFLAGS += -mrecord-mcount
+else
+# else do it all manually
 ifdef CONFIG_FTRACE_MCOUNT_RECORD
 ifdef BUILD_C_RECORDMCOUNT
 ifeq ("$(origin RECORDMCOUNT_WARN)", "command line")
@@ -240,6 +245,7 @@ cmd_record_mcount =						\
 		$(sub_cmd_record_mcount)			\
 	fi;
 endif
+endif
 
 define rule_cc_o_c
 	$(call echo-cmd,checksrc) $(cmd_checksrc)			  \
Signature · 1 line
2.3.3
#1 lore raw
Quoted 11 lines · On Sun, 12 Apr 2015 17:54:27 -0700 Andi Kleen <[email protected]> wrote:

From: Andi Kleen <[email protected]>

gcc 5 supports a new -mcount-record option to generate ftrace tables directly. This avoids the need to run record_mcount manually.

Use this option when available.

It also has a -mcount-nop option to generate the mcount calls as nops. So far that is not implemented, but it could be used to optimize patching at boot up.

Interesting. But I can't accept this until I can test it. I don't have the time to build gcc from scratch, and currently none of my boxes have a gcc 5 install.

I wonder who's responsible for
https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/

If they can add a i386/x86_64 build for gcc5 I'll be happy to download it and test this patch.

Thanks,

-- Steve

Quoted 30 lines
---
 scripts/Makefile.build | 6 ++++++
 1 file changed, 6 insertions(+)
scripts/Makefile.build +6 -0
index 01df30a..f258e9b 100644
@@ -210,6 +210,11 @@ cmd_modversions =								\
 	fi;
 endif
 
+# gcc 5 supports generating the mcount tables directly
+ifneq ($(call cc-option,-mrecord-mcount,y),y)
+KBUILD_CFLAGS += -mrecord-mcount
+else
+# else do it all manually
 ifdef CONFIG_FTRACE_MCOUNT_RECORD
 ifdef BUILD_C_RECORDMCOUNT
 ifeq ("$(origin RECORDMCOUNT_WARN)", "command line")
@@ -240,6 +245,7 @@ cmd_record_mcount =						\
 		$(sub_cmd_record_mcount)			\
 	fi;
 endif
+endif
 
 define rule_cc_o_c
 	$(call echo-cmd,checksrc) $(cmd_checksrc)			  \
#2 lore raw
Quoted 1 line

Interesting. But I can't accept this until I can test it. I don't have

AFAIK that's a unique policy. I don't think any other maintainer operates this way.

Quoted 5 lines

I wonder who's responsible for
https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/

If they can add a i386/x86_64 build for gcc5 I'll be happy to download it and test this patch.

That doesn't make any sense.

-Andi

#3 lore raw
Quoted 4 lines · On Mon, 13 Apr 2015 14:55:08 -0700 Andi Kleen <[email protected]> wrote:
Quoted 1 line

Interesting. But I can't accept this until I can test it. I don't have

AFAIK that's a unique policy. I don't think any other maintainer operates this way.

Um, really? Other maintainers don't test patches that they maintain? This isn't like hardware that I don't have. This could certainly affect people if it breaks, and I will be responsible to fix it. I'm not going to do that until I have a setup where I can test things that break.

Quoted 9 lines
Quoted 6 lines

I wonder who's responsible for
https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/

If they can add a i386/x86_64 build for gcc5 I'll be happy to download it and test this patch.

That doesn't make any sense.

What, adding gcc5 to the crosstools suite? Why not?

-- Steve

author
#4 lore raw
Quoted 10 lines
Quoted 8 lines
Quoted 5 lines

I wonder who's responsible for
https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/

If they can add a i386/x86_64 build for gcc5 I'll be happy to download it and test this patch.

That doesn't make any sense.

What, adding gcc5 to the crosstools suite? Why not?

Making patches dependent on someone else building compilers for you.

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only.
#5 lore raw
Quoted 6 lines · On Tue, 14 Apr 2015 00:54:12 +0200 Andi Kleen <[email protected]> wrote:
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

I wonder who's responsible for
https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/

If they can add a i386/x86_64 build for gcc5 I'll be happy to download it and test this patch.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

That doesn't make any sense.

What, adding gcc5 to the crosstools suite? Why not?

Making patches dependent on someone else building compilers for you.

Well, until it's in the distro, I don't currently have time to build the compiler. Thus, it will have to wait till one's already available, or I get around to it.

-- Steve

#7 lore raw
Quoted 8 lines · On Tue, 14 Apr 2015 09:19:58 +0300 Kalle Valo <[email protected]> wrote:
Quoted 5 lines · Steven Rostedt

I wonder who's responsible for
https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/

If they can add a i386/x86_64 build for gcc5 I'll be happy to download it and test this patch.

Quoted 7 lines

Found this:

"For any questions don't hesitate to contact me at tony (at) bake your noodle . com"

https://www.kernel.org/pub/tools/crosstool/

Thanks for the pointer.

-- Steve