Skip to contentSkip to conversation

tools include UAPI: Sync linux/sched.h copy with the kernel sources

PATCH New Arnaldo Carvalho de Melo 1 participant 1 message Sep 30, 2024 perf events

lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

PATCH 1/1 tools include UAPI: Sync linux/sched.h copy with the kernel sources

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.

The way these headers are used in perf are not restricted to just including them to compile something.

There are sometimes used in scripts that convert defines into string tables, etc, so some change may break one of these scripts, or new MSRs may use some different #define pattern, etc.

E.g.:

  $ ls -1 tools/perf/trace/beauty/*.sh | head -5
  tools/perf/trace/beauty/arch_errno_names.sh
  tools/perf/trace/beauty/drm_ioctl.sh
  tools/perf/trace/beauty/fadvise.sh
  tools/perf/trace/beauty/fsconfig.sh
  tools/perf/trace/beauty/fsmount.sh
  $
  $ tools/perf/trace/beauty/fadvise.sh
  static const char *fadvise_advices[] = {
        [0] = "NORMAL",
        [1] = "RANDOM",
        [2] = "SEQUENTIAL",
        [3] = "WILLNEED",
        [4] = "DONTNEED",
        [5] = "NOREUSE",
  };
  $

The tools/perf/check-headers.sh script, part of the tools/ build process, points out changes in the original files.

So its important not to touch the copies in tools/ when doing changes in the original kernel headers, that will be done later, when check-headers.sh inform about the change to the perf tools hackers.

Picking the changes from:

f0e1a0643a59bf1f ("sched_ext: Implement BPF extensible scheduler class")

The inclusion of the SCHED_EXT define doesn't cause any change in behaviour in tools/perf.

This just silences this perf tools build warning:

diff -u tools/perf/trace/beauty/include/uapi/sound/asound.h include/uapi/sound/asound.h

---
 tools/perf/trace/beauty/include/uapi/linux/sched.h | 1 +
 1 file changed, 1 insertion(+)
tools/perf/trace/beauty/include/uapi/linux/sched.h +1 -0
index 3bac0a8ceab26ee7..359a14cc76a4038a 100644
@@ -118,6 +118,7 @@ struct clone_args {
 /* SCHED_ISO: reserved but not implemented yet */
 #define SCHED_IDLE		5
 #define SCHED_DEADLINE		6
+#define SCHED_EXT		7
 
 /* Can be ORed in to make sure the process is reverted back to SCHED_NORMAL on fork */
 #define SCHED_RESET_ON_FORK     0x40000000
Signature · 1 line
2.46.0