diff options
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/perf/Makefile.perf | 13 | ||||
| -rw-r--r-- | tools/perf/trace/beauty/ioctl.c | 14 | ||||
| -rwxr-xr-x | tools/perf/trace/beauty/vhost_virtio_ioctl.sh | 17 |
3 files changed, 42 insertions, 2 deletions
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf index 6c1be10c6749..606358d67f8a 100644 --- a/tools/perf/Makefile.perf +++ b/tools/perf/Makefile.perf | |||
| @@ -413,6 +413,13 @@ kvm_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/kvm_ioctl.sh | |||
| 413 | $(kvm_ioctl_array): $(kvm_hdr_dir)/kvm.h $(kvm_ioctl_tbl) | 413 | $(kvm_ioctl_array): $(kvm_hdr_dir)/kvm.h $(kvm_ioctl_tbl) |
| 414 | $(Q)$(SHELL) '$(kvm_ioctl_tbl)' $(kvm_hdr_dir) > $@ | 414 | $(Q)$(SHELL) '$(kvm_ioctl_tbl)' $(kvm_hdr_dir) > $@ |
| 415 | 415 | ||
| 416 | vhost_virtio_ioctl_array := $(beauty_ioctl_outdir)/vhost_virtio_ioctl_array.c | ||
| 417 | vhost_virtio_hdr_dir := $(srctree)/tools/include/uapi/linux | ||
| 418 | vhost_virtio_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/vhost_virtio_ioctl.sh | ||
| 419 | |||
| 420 | $(vhost_virtio_ioctl_array): $(vhost_virtio_hdr_dir)/vhost.h $(vhost_virtio_ioctl_tbl) | ||
| 421 | $(Q)$(SHELL) '$(vhost_virtio_ioctl_tbl)' $(vhost_virtio_hdr_dir) > $@ | ||
| 422 | |||
| 416 | all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) | 423 | all: shell_compatibility_test $(ALL_PROGRAMS) $(LANG_BINDINGS) $(OTHER_PROGRAMS) |
| 417 | 424 | ||
| 418 | $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST) | 425 | $(OUTPUT)python/perf.so: $(PYTHON_EXT_SRCS) $(PYTHON_EXT_DEPS) $(LIBTRACEEVENT_DYNAMIC_LIST) |
| @@ -510,7 +517,8 @@ build-dir = $(if $(__build-dir),$(__build-dir),.) | |||
| 510 | prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioctl_array) \ | 517 | prepare: $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)common-cmds.h archheaders $(drm_ioctl_array) \ |
| 511 | $(sndrv_pcm_ioctl_array) \ | 518 | $(sndrv_pcm_ioctl_array) \ |
| 512 | $(sndrv_ctl_ioctl_array) \ | 519 | $(sndrv_ctl_ioctl_array) \ |
| 513 | $(kvm_ioctl_array) | 520 | $(kvm_ioctl_array) \ |
| 521 | $(vhost_virtio_ioctl_array) | ||
| 514 | 522 | ||
| 515 | $(OUTPUT)%.o: %.c prepare FORCE | 523 | $(OUTPUT)%.o: %.c prepare FORCE |
| 516 | $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ | 524 | $(Q)$(MAKE) -f $(srctree)/tools/build/Makefile.build dir=$(build-dir) $@ |
| @@ -779,7 +787,8 @@ clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clea | |||
| 779 | $(OUTPUT)$(drm_ioctl_array) \ | 787 | $(OUTPUT)$(drm_ioctl_array) \ |
| 780 | $(OUTPUT)$(sndrv_ctl_ioctl_array) \ | 788 | $(OUTPUT)$(sndrv_ctl_ioctl_array) \ |
| 781 | $(OUTPUT)$(sndrv_pcm_ioctl_array) \ | 789 | $(OUTPUT)$(sndrv_pcm_ioctl_array) \ |
| 782 | $(OUTPUT)$(kvm_ioctl_array) | 790 | $(OUTPUT)$(kvm_ioctl_array) \ |
| 791 | $(OUTPUT)$(vhost_virtio_ioctl_array) | ||
| 783 | $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean | 792 | $(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean |
| 784 | $(python-clean) | 793 | $(python-clean) |
| 785 | 794 | ||
diff --git a/tools/perf/trace/beauty/ioctl.c b/tools/perf/trace/beauty/ioctl.c index 8633d96ed131..95434b27873d 100644 --- a/tools/perf/trace/beauty/ioctl.c +++ b/tools/perf/trace/beauty/ioctl.c | |||
| @@ -88,6 +88,19 @@ static size_t ioctl__scnprintf_kvm_cmd(int nr, int dir, char *bf, size_t size) | |||
| 88 | return scnprintf(bf, size, "(%#x, %#x, %#x)", 0xAE, nr, dir); | 88 | return scnprintf(bf, size, "(%#x, %#x, %#x)", 0xAE, nr, dir); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | static size_t ioctl__scnprintf_vhost_virtio_cmd(int nr, int dir, char *bf, size_t size) | ||
| 92 | { | ||
| 93 | #include "trace/beauty/generated/ioctl/vhost_virtio_ioctl_array.c" | ||
| 94 | static DEFINE_STRARRAY(vhost_virtio_ioctl_cmds); | ||
| 95 | static DEFINE_STRARRAY(vhost_virtio_ioctl_read_cmds); | ||
| 96 | struct strarray *s = (dir & _IOC_READ) ? &strarray__vhost_virtio_ioctl_read_cmds : &strarray__vhost_virtio_ioctl_cmds; | ||
| 97 | |||
| 98 | if (nr < s->nr_entries && s->entries[nr] != NULL) | ||
| 99 | return scnprintf(bf, size, "VHOST_%s", s->entries[nr]); | ||
| 100 | |||
| 101 | return scnprintf(bf, size, "(%#x, %#x, %#x)", 0xAF, nr, dir); | ||
| 102 | } | ||
| 103 | |||
| 91 | static size_t ioctl__scnprintf_cmd(unsigned long cmd, char *bf, size_t size) | 104 | static size_t ioctl__scnprintf_cmd(unsigned long cmd, char *bf, size_t size) |
| 92 | { | 105 | { |
| 93 | int dir = _IOC_DIR(cmd), | 106 | int dir = _IOC_DIR(cmd), |
| @@ -104,6 +117,7 @@ static size_t ioctl__scnprintf_cmd(unsigned long cmd, char *bf, size_t size) | |||
| 104 | ['U' - 'A']= { .type = 'U', .scnprintf = ioctl__scnprintf_sndrv_ctl_cmd, }, | 117 | ['U' - 'A']= { .type = 'U', .scnprintf = ioctl__scnprintf_sndrv_ctl_cmd, }, |
| 105 | ['d' - 'A'] = { .type = 'd', .scnprintf = ioctl__scnprintf_drm_cmd, }, | 118 | ['d' - 'A'] = { .type = 'd', .scnprintf = ioctl__scnprintf_drm_cmd, }, |
| 106 | [0xAE - 'A'] = { .type = 0xAE, .scnprintf = ioctl__scnprintf_kvm_cmd, }, | 119 | [0xAE - 'A'] = { .type = 0xAE, .scnprintf = ioctl__scnprintf_kvm_cmd, }, |
| 120 | [0xAF - 'A'] = { .type = 0xAF, .scnprintf = ioctl__scnprintf_vhost_virtio_cmd, }, | ||
| 107 | }; | 121 | }; |
| 108 | const int nr_types = ARRAY_SIZE(ioctl_types); | 122 | const int nr_types = ARRAY_SIZE(ioctl_types); |
| 109 | 123 | ||
diff --git a/tools/perf/trace/beauty/vhost_virtio_ioctl.sh b/tools/perf/trace/beauty/vhost_virtio_ioctl.sh new file mode 100755 index 000000000000..76f1de697787 --- /dev/null +++ b/tools/perf/trace/beauty/vhost_virtio_ioctl.sh | |||
| @@ -0,0 +1,17 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | vhost_virtio_header_dir=$1 | ||
| 4 | |||
| 5 | printf "static const char *vhost_virtio_ioctl_cmds[] = {\n" | ||
| 6 | regex='^#[[:space:]]*define[[:space:]]+VHOST_(\w+)[[:space:]]+_IOW?\([[:space:]]*VHOST_VIRTIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*' | ||
| 7 | egrep $regex ${vhost_virtio_header_dir}/vhost.h | \ | ||
| 8 | sed -r "s/$regex/\2 \1/g" | \ | ||
| 9 | sort | xargs printf "\t[%s] = \"%s\",\n" | ||
| 10 | printf "};\n" | ||
| 11 | |||
| 12 | printf "static const char *vhost_virtio_ioctl_read_cmds[] = {\n" | ||
| 13 | regex='^#[[:space:]]*define[[:space:]]+VHOST_(\w+)[[:space:]]+_IOW?R\([[:space:]]*VHOST_VIRTIO[[:space:]]*,[[:space:]]*(0x[[:xdigit:]]+).*' | ||
| 14 | egrep $regex ${vhost_virtio_header_dir}/vhost.h | \ | ||
| 15 | sed -r "s/$regex/\2 \1/g" | \ | ||
| 16 | sort | xargs printf "\t[%s] = \"%s\",\n" | ||
| 17 | printf "};\n" | ||
