linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL] ftrace: Changes for v6.17
@ 2025-07-29 18:42 Steven Rostedt
  2025-07-30 23:15 ` Linus Torvalds
  2025-07-31  0:35 ` pr-tracker-bot
  0 siblings, 2 replies; 5+ messages in thread
From: Steven Rostedt @ 2025-07-29 18:42 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: LKML, Masami Hiramatsu, Mathieu Desnoyers, Mark Rutland,
	Artem Sadovnikov


Linus,

ftrace changes for v6.17:

- Keep track of when fgraph_ops are registered or not

  Keep accounting of when fgraph_ops are registered as if a fgraph_ops is
  registered twice it can mess up the accounting and it will not work as
  expected later. Trigger a warning if something registers it twice as to
  catch bugs before they are found by things just not working as expected.

- Make DYNAMIC_FTRACE always enabled for architectures that support it

  As static ftrace (where all functions are always traced) is very expensive
  and only exists to help architectures support ftrace, do not make it an
  option. As soon as an architecture supports DYNAMIC_FTRACE make it use it.
  This simplifies the code.

- Remove redundant config HAVE_FTRACE_MCOUNT_RECORD

  The CONFIG_HAVE_FTRACE_MCOUNT was added to help simplify the
  DYNAMIC_FTRACE work, but now every architecture that implements
  DYNAMIC_FTRACE also has HAVE_FTRACE_MCOUNT set too, making it redundant
  with the HAVE_DYNAMIC_FTRACE.

- Make pid_ptr string size match the comment

  In print_graph_proc() the pid_ptr string is of size 11, but the comment says
  /* sign + log10(MAX_INT) + '\0' */ which is actually 12.


Please pull the latest ftrace-v6.17 tree, which can be found at:


  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
ftrace-v6.17

Tag SHA1: 58cc39c90ea0e6a1213b565a4859ed6f2a9a0b1a
Head SHA1: 4d6d0a6263babf7c43faa55de4fa3c6637dec624


Artem Sadovnikov (1):
      fgraph: Make pid_str size match the comment

Steven Rostedt (3):
      fgraph: Keep track of when fgraph_ops are registered or not
      ftrace: Make DYNAMIC_FTRACE always enabled for architectures that support it
      tracing: Remove redundant config HAVE_FTRACE_MCOUNT_RECORD

----
 Documentation/trace/ftrace-design.rst | 12 ++++--------
 arch/arm/Kconfig                      |  1 -
 arch/arm64/Kconfig                    |  1 -
 arch/csky/Kconfig                     |  1 -
 arch/loongarch/Kconfig                |  1 -
 arch/microblaze/Kconfig               |  1 -
 arch/mips/Kconfig                     |  1 -
 arch/parisc/Kconfig                   |  1 -
 arch/powerpc/Kconfig                  |  1 -
 arch/riscv/Kconfig                    |  1 -
 arch/s390/Kconfig                     |  1 -
 arch/sh/Kconfig                       |  1 -
 arch/sparc/Kconfig                    |  1 -
 arch/x86/Kconfig                      |  1 -
 include/asm-generic/vmlinux.lds.h     |  2 +-
 include/linux/ftrace.h                |  2 +-
 include/linux/kernel.h                |  6 +++---
 include/linux/module.h                |  2 +-
 kernel/module/main.c                  |  2 +-
 kernel/trace/Kconfig                  | 20 +++++---------------
 kernel/trace/fgraph.c                 | 16 +++++++++++++---
 kernel/trace/ftrace.c                 |  4 ----
 kernel/trace/trace_functions_graph.c  |  2 +-
 scripts/recordmcount.pl               |  2 +-
 24 files changed, 31 insertions(+), 52 deletions(-)
---------------------------

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [GIT PULL] ftrace: Changes for v6.17
  2025-07-29 18:42 [GIT PULL] ftrace: Changes for v6.17 Steven Rostedt
@ 2025-07-30 23:15 ` Linus Torvalds
  2025-07-31 11:53   ` Steven Rostedt
  2025-07-31  0:35 ` pr-tracker-bot
  1 sibling, 1 reply; 5+ messages in thread
From: Linus Torvalds @ 2025-07-30 23:15 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, Masami Hiramatsu, Mathieu Desnoyers, Mark Rutland,
	Artem Sadovnikov

On Tue, 29 Jul 2025 at 11:42, Steven Rostedt <rostedt@goodmis.org> wrote:
>
>   In print_graph_proc() the pid_ptr string is of size 11, but the comment says
>   /* sign + log10(MAX_INT) + '\0' */ which is actually 12.

Lol. Quoting the ancient Greeks: "Math is hard, let's go shopping".

That said, the comment is garbage anyway.

Because "sign + log10(MAX_INT) + '\0'" really is just 11 - if you
round or truncate.

So somebody may have actually done the math "correctly", but the math
was just stated wrongly.

Much better to actually write things out properly instead of trying to be fancy.

Becasue might be more legible to actually write it out and let the
compiler do things, ie just do

   // This includes the sign and the terminating '\0'
   #define MAX_INT_CHARACTERS sizeof("-2147483648")

which doesn't require people to know - or think they know - logarithms.

Random rule for the day: don't ask people to do more than third-grade math.

         Linus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [GIT PULL] ftrace: Changes for v6.17
  2025-07-29 18:42 [GIT PULL] ftrace: Changes for v6.17 Steven Rostedt
  2025-07-30 23:15 ` Linus Torvalds
@ 2025-07-31  0:35 ` pr-tracker-bot
  1 sibling, 0 replies; 5+ messages in thread
From: pr-tracker-bot @ 2025-07-31  0:35 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Linus Torvalds, LKML, Masami Hiramatsu, Mathieu Desnoyers,
	Mark Rutland, Artem Sadovnikov

The pull request you sent on Tue, 29 Jul 2025 14:42:26 -0400:

> git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git ftrace-v6.17

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/90a871f74b70027779a4f312c0c74b6a89e22412

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [GIT PULL] ftrace: Changes for v6.17
  2025-07-30 23:15 ` Linus Torvalds
@ 2025-07-31 11:53   ` Steven Rostedt
  2025-07-31 11:55     ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2025-07-31 11:53 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: LKML, Masami Hiramatsu, Mathieu Desnoyers, Mark Rutland,
	Artem Sadovnikov

On Wed, 30 Jul 2025 16:15:21 -0700
Linus Torvalds <torvalds@linux-foundation.org> wrote:

> On Tue, 29 Jul 2025 at 11:42, Steven Rostedt <rostedt@goodmis.org> wrote:
> >
> >   In print_graph_proc() the pid_ptr string is of size 11, but the comment says
> >   /* sign + log10(MAX_INT) + '\0' */ which is actually 12.  
> 
> Lol. Quoting the ancient Greeks: "Math is hard, let's go shopping".
> 
> That said, the comment is garbage anyway.
> 
> Because "sign + log10(MAX_INT) + '\0'" really is just 11 - if you
> round or truncate.

I'm confused, sizeof("-2147483648") is equal to 12.

$ echo '
#include <stdio.h>
int main (int argc, char **argv)
{
        printf("%ld\n", sizeof("-2147483648"));
        return 0;
}' > maxchar.c

$ gcc -o maxchar maxchar.c
$ ./maxchar
12

> 
> So somebody may have actually done the math "correctly", but the math
> was just stated wrongly.
> 
> Much better to actually write things out properly instead of trying to be fancy.
> 
> Becasue might be more legible to actually write it out and let the
> compiler do things, ie just do
> 
>    // This includes the sign and the terminating '\0'
>    #define MAX_INT_CHARACTERS sizeof("-2147483648")
> 
> which doesn't require people to know - or think they know - logarithms.

Hmm, should we add that to a header file?

-- Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [GIT PULL] ftrace: Changes for v6.17
  2025-07-31 11:53   ` Steven Rostedt
@ 2025-07-31 11:55     ` Steven Rostedt
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2025-07-31 11:55 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: LKML, Masami Hiramatsu, Mathieu Desnoyers, Mark Rutland,
	Artem Sadovnikov

On Thu, 31 Jul 2025 07:53:18 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> > Because "sign + log10(MAX_INT) + '\0'" really is just 11 - if you
> > round or truncate.  
> 
> I'm confused, sizeof("-2147483648") is equal to 12.

Never mind, I just realized you meant rounding or truncating the "log10(MAX_INT)".


-- Steve

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-07-31 11:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-29 18:42 [GIT PULL] ftrace: Changes for v6.17 Steven Rostedt
2025-07-30 23:15 ` Linus Torvalds
2025-07-31 11:53   ` Steven Rostedt
2025-07-31 11:55     ` Steven Rostedt
2025-07-31  0:35 ` pr-tracker-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).