mbox series

[v2,0/2] tracing: gfp: Fix regression of printing GFP flags in user space tracing tooling

Message ID 20250116214123.917928229@goodmis.org (mailing list archive)
Headers show
Series tracing: gfp: Fix regression of printing GFP flags in user space tracing tooling | expand

Message

Steven Rostedt Jan. 16, 2025, 9:41 p.m. UTC
This fixes a regression that was brought up last year[1], but due
to missing a response it was forgotten about.

The commit 772dd0342727c ("mm: enumerate all gfp flags") introduced
usage of enums in creating of the __GFP_* flags. But enums are not
converted to their values like macros are in the trace event format
files that are exported to user space to allow tools to properly parse
the raw binary events. This broke the parsing of gfp flags.

Instead of having something like:

  gfp_flags=GFP_HIGHUSER_MOVABLE|__GFP_COMP

It would just have a raw hex value:

  gfp_flags=0x140cca

Which is mostly useless or hard to decipher.

Instead of reverting the enums into macros, use the TRACE_DEFINE_ENUM()
macro that informs the tracing subsystem about enums and it converts them
to their proper values.

The first patch is a fix that fixes the regression and should go into
the current rc release as well as be backported to stable.

The second patch is a clean up that removes duplication of the GFP flags
in the macros of mmflags.h and should be added in the coming merge window.

I kept the two together so that one can see why the solution to the first
patch was made. The use of TRACE_GFP_EM() internally was added to make
it easier to reuse the TRACE_GFP_FLAGS macro.

Changes since v1: https://lore.kernel.org/20250116132359.1f20cdec@gandalf.local.home

- Moved the updates to only include/trace/events/mmflags.h

- Removed the macro call in include/trace/events/kmem.h

- Use an internal TRACE_GFP_EM() macro in TRACE_GFP_FLAGS to allow
  it to be expanded later for use with the __def_gfpflags_names()
  macro

- Added the second non critical patch to show he clean up of removing
  duplicate defines of the ___GFP_*_BITs. 

[1] https://lore.kernel.org/all/87be5f7c-1a0-dad-daa0-54e342efaea7@redhat.com/

Steven Rostedt (2):
      tracing: gfp: Fix the GFP enum values shown for user space tracing tools
      tracing: gfp: Remove duplication of recording GFP flags

----
 include/trace/events/mmflags.h | 104 +++++++++++++++++++++++++++++------------
 1 file changed, 73 insertions(+), 31 deletions(-)

Comments

Steven Rostedt Jan. 16, 2025, 9:48 p.m. UTC | #1
On Thu, 16 Jan 2025 16:41:23 -0500
Steven Rostedt <rostedt@goodmis.org> wrote:

> This fixes a regression that was brought up last year[1], but due
> to missing a response it was forgotten about.

Note, these were only tested by building and booting the kernel to see if
the gfp_flags have been fixed. I did not run this through my normal tests.

I can run them, and if I get an Ack from the memory maintainers I could
push them through my tree.

I would also like to have those that reported the issue confirm this fixes
the problem for them and they give me a "Tested-by".

-- Steve