Skip to contentSkip to conversation

tools headers UAPI: Sync linux/kvm.h with the kernel sources

PATCH In review Arnaldo Carvalho de Melo 3 participants 4 messages Jul 17, 2022 – Jul 19, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools headers UAPI: Sync linux/kvm.h with the kernel sources

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

- Arnaldo

Full explanation:

There used not to be 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.

---

To pick the changes in:

1b870fa5573e260b ("kvm: stats: tell userspace which values are boolean")

That just rebuilds perf, as these patches don't add any new KVM ioctl to be harvested for the the 'perf trace' ioctl syscall argument beautifiers.

This is also by now used by tools/testing/selftests/kvm/, a simple test build succeeded.

This silences this perf build warning:

Warning: Kernel ABI header at 'tools/include/uapi/linux/kvm.h' differs from latest version at 'include/uapi/linux/kvm.h' diff -u tools/include/uapi/linux/kvm.h include/uapi/linux/kvm.h

---
 tools/include/uapi/linux/kvm.h | 1 +
 1 file changed, 1 insertion(+)
tools/include/uapi/linux/kvm.h +1 -0
index 5088bd9f1922851f..811897dadcae259f 100644
@@ -2083,6 +2083,7 @@ struct kvm_stats_header {
 #define KVM_STATS_UNIT_BYTES		(0x1 << KVM_STATS_UNIT_SHIFT)
 #define KVM_STATS_UNIT_SECONDS		(0x2 << KVM_STATS_UNIT_SHIFT)
 #define KVM_STATS_UNIT_CYCLES		(0x3 << KVM_STATS_UNIT_SHIFT)
+#define KVM_STATS_UNIT_BOOLEAN		(0x4 << KVM_STATS_UNIT_SHIFT)
 #define KVM_STATS_UNIT_MAX		KVM_STATS_UNIT_CYCLES
 
 #define KVM_STATS_BASE_SHIFT		8
Signature · 1 line
2.36.1
#1 lore raw
Quoted 1 line · Arnaldo Carvalho de Melo

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

Thanks, I'll add a sync patch myself to the KVM tree. Do you have a script to do that?

Paolo

#2 lore raw

Em Tue, Jul 19, 2022 at 03:15:58PM +0200, Paolo Bonzini escreveu:

Quoted 5 lines · Arnaldo Carvalho de Melo
Quoted 1 line

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

Thanks, I'll add a sync patch myself to the KVM tree. Do you have a script to do that?

we have tools/perf/check-headers.sh that flags differences, then to address it I copy and send a message, yeah, some scripting here would help some.

- Arnaldo

#3 lore raw
Quoted 11 lines · Arnaldo Carvalho de Melo

Em Tue, Jul 19, 2022 at 03:15:58PM +0200, Paolo Bonzini escreveu:

Quoted 5 lines · Arnaldo Carvalho de Melo
Quoted 1 line

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

Thanks, I'll add a sync patch myself to the KVM tree. Do you have a script to do that?

we have tools/perf/check-headers.sh that flags differences, then to address it I copy and send a message, yeah, some scripting here would help some.

In the past I've copied things over and there have been complaints that the commit history isn't copied over. If we script this could we also scrape the commit messages?

Thanks,
Ian