The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 1/1 fyi] tools headers UAPI: Sync linux/prctl.h with the kernel sources to pick FUTEX knob
@ 2025-06-10 20:40 Arnaldo Carvalho de Melo
  2025-06-11  8:43 ` Sebastian Andrzej Siewior
  0 siblings, 1 reply; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-06-10 20:40 UTC (permalink / raw)
  To: linux-kernel
  Cc: Adrian Hunter, Ian Rogers, James Clark, Jiri Olsa, Kan Liang,
	Namhyung Kim, Peter Zijlstra, Sebastian Andrzej Siewior

tldr; Just FYI, I'm carrying this on the perf tools tree.

Full explanation:

There used to be no copies, with tools/ code using kernel headers
directly. From time to time tools/perf/ broke due to legitimate kernel
hacking. At some point Linus complained about such direct usage. Then we
adopted the current model.

See further details at:

 https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/include/uapi/README

To pick the changes in:

  63e8595c060a1fef ("futex: Allow to make the private hash immutable")
  80367ad01d93ac78 ("futex: Add basic infrastructure for local task local hash")

That adds a FUTEX knob:

  $ tools/perf/trace/beauty/prctl_option.sh > before
  $ cp include/uapi/linux/prctl.h tools/perf/trace/beauty/include/uapi/linux/prctl.h
  $ tools/perf/trace/beauty/prctl_option.sh > after
  $ diff -u before after
  --- before	2025-06-09 14:50:45.162579336 -0300
  +++ after	2025-06-09 14:50:52.797660024 -0300
  @@ -72,6 +72,7 @@
   	[75] = "SET_SHADOW_STACK_STATUS",
   	[76] = "LOCK_SHADOW_STACK_STATUS",
   	[77] = "TIMER_CREATE_RESTORE_IDS",
  +	[78] = "FUTEX_HASH",
   };
   static const char *prctl_set_mm_options[] = {
   	[1] = "START_CODE",
  $

That now will be used to decode the syscall option and also to compose
filters, for instance:

  [root@five ~]# perf trace -e syscalls:sys_enter_prctl --filter option==SET_NAME
       0.000 Isolated Servi/3474327 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23f13b7aee)
       0.032 DOM Worker/3474327 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23deb25670)
       7.920 :3474328/3474328 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24fbb10)
       7.935 StreamT~s #374/3474328 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24fb970)
       8.400 Isolated Servi/3474329 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24bab10)
       8.418 StreamT~s #374/3474329 syscalls:sys_enter_prctl(option: SET_NAME, arg2: 0x7f23e24ba970)
  ^C[root@five ~]#

This addresses this perf build warning:

  Warning: Kernel ABI header differences:
    diff -u tools/include/uapi/linux/prctl.h include/uapi/linux/prctl.h

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Ian Rogers <irogers@google.com>
Cc: James Clark <james.clark@linaro.org>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Kan Liang <kan.liang@linux.intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/trace/beauty/include/uapi/linux/prctl.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/perf/trace/beauty/include/uapi/linux/prctl.h b/tools/perf/trace/beauty/include/uapi/linux/prctl.h
index 15c18ef4eb11a013..43dec6eed559a686 100644
--- a/tools/perf/trace/beauty/include/uapi/linux/prctl.h
+++ b/tools/perf/trace/beauty/include/uapi/linux/prctl.h
@@ -364,4 +364,11 @@ struct prctl_mm_map {
 # define PR_TIMER_CREATE_RESTORE_IDS_ON		1
 # define PR_TIMER_CREATE_RESTORE_IDS_GET	2
 
+/* FUTEX hash management */
+#define PR_FUTEX_HASH			78
+# define PR_FUTEX_HASH_SET_SLOTS	1
+# define FH_FLAG_IMMUTABLE		(1ULL << 0)
+# define PR_FUTEX_HASH_GET_SLOTS	2
+# define PR_FUTEX_HASH_GET_IMMUTABLE	3
+
 #endif /* _LINUX_PRCTL_H */
-- 
2.49.0


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

* Re: [PATCH 1/1 fyi] tools headers UAPI: Sync linux/prctl.h with the kernel sources to pick FUTEX knob
  2025-06-10 20:40 [PATCH 1/1 fyi] tools headers UAPI: Sync linux/prctl.h with the kernel sources to pick FUTEX knob Arnaldo Carvalho de Melo
@ 2025-06-11  8:43 ` Sebastian Andrzej Siewior
  2025-06-11 13:24   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Sebastian Andrzej Siewior @ 2025-06-11  8:43 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Adrian Hunter, Ian Rogers, James Clark, Jiri Olsa,
	Kan Liang, Namhyung Kim, Peter Zijlstra

On 2025-06-10 17:40:26 [-0300], Arnaldo Carvalho de Melo wrote:
> tldr; Just FYI, I'm carrying this on the perf tools tree.

Thank you.

>   $ tools/perf/trace/beauty/prctl_option.sh > before
>   $ cp include/uapi/linux/prctl.h tools/perf/trace/beauty/include/uapi/linux/prctl.h
>   $ tools/perf/trace/beauty/prctl_option.sh > after

Ah. I missed that copy of prctl.h

…
> This addresses this perf build warning:
> 
>   Warning: Kernel ABI header differences:
>     diff -u tools/include/uapi/linux/prctl.h include/uapi/linux/prctl.h

But I did cover this one.

Sebastian

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

* Re: [PATCH 1/1 fyi] tools headers UAPI: Sync linux/prctl.h with the kernel sources to pick FUTEX knob
  2025-06-11  8:43 ` Sebastian Andrzej Siewior
@ 2025-06-11 13:24   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2025-06-11 13:24 UTC (permalink / raw)
  To: Sebastian Andrzej Siewior
  Cc: John Hubbard, linux-kernel, Adrian Hunter, Ian Rogers,
	James Clark, Jiri Olsa, Kan Liang, Namhyung Kim, Peter Zijlstra,
	linux-perf-users

On Wed, Jun 11, 2025 at 10:43:26AM +0200, Sebastian Andrzej Siewior wrote:
> On 2025-06-10 17:40:26 [-0300], Arnaldo Carvalho de Melo wrote:
> > tldr; Just FYI, I'm carrying this on the perf tools tree.
> 
> Thank you.
> 
> >   $ tools/perf/trace/beauty/prctl_option.sh > before
> >   $ cp include/uapi/linux/prctl.h tools/perf/trace/beauty/include/uapi/linux/prctl.h
> >   $ tools/perf/trace/beauty/prctl_option.sh > after
> 
> Ah. I missed that copy of prctl.h
> 
> …
> > This addresses this perf build warning:
> > 
> >   Warning: Kernel ABI header differences:
> >     diff -u tools/include/uapi/linux/prctl.h include/uapi/linux/prctl.h
> 
> But I did cover this one.

I fixed up the warning message being addressed, the attempt was at
having what used in perf just in
tools/perf/trace/beauty/include/uapi/linux/prctl.h, i.e. just for
scrapping, not for building things with it.

But then:

commit c142850fbc956058ff2f2987d3d11eb2c628f710
Author: John Hubbard <jhubbard@nvidia.com>
Date:   Mon Jun 17 19:24:21 2024 -0700

    selftests/mm: kvm, mdwe fixes to avoid requiring "make headers"

this adds another copy there.

I think we should then remove the
tools/perf/trace/beauty/include/uapi/linux/prctl.h one and make
tools/perf/check_headers.sh to go back to check
tools/include/uapi/linux/prctl.h.

But then, as mentioned in tools/include/uapi/README, its better for
people updating the kernel original files not to update the copy, as it
may break tools/ code if it, for instance, starts including some other
header, etc.

tools people should notice the warning from tools/perf/check_headers.sh
(that now probably should be moved to tools/ as these copies are not
used just by perf...) and check how to update it.

- Arnaldo

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

end of thread, other threads:[~2025-06-11 13:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-10 20:40 [PATCH 1/1 fyi] tools headers UAPI: Sync linux/prctl.h with the kernel sources to pick FUTEX knob Arnaldo Carvalho de Melo
2025-06-11  8:43 ` Sebastian Andrzej Siewior
2025-06-11 13:24   ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox