linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: "Clark Williams" <williams@redhat.com>,
	linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
	"Arnaldo Carvalho de Melo" <acme@redhat.com>,
	"Adrian Hunter" <adrian.hunter@intel.com>,
	"Jiri Olsa" <jolsa@kernel.org>,
	"Luis Cláudio Gonçalves" <lclaudio@redhat.com>,
	"Namhyung Kim" <namhyung@kernel.org>,
	"Wang Nan" <wangnan0@huawei.com>
Subject: [PATCH 12/29] perf beauty ioctl: Add generator for USBDEVFS_ ioctl commands
Date: Thu,  3 Jan 2019 09:45:52 -0300	[thread overview]
Message-ID: <20190103124609.29672-13-acme@kernel.org> (raw)
In-Reply-To: <20190103124609.29672-1-acme@kernel.org>

From: Arnaldo Carvalho de Melo <acme@redhat.com>

Will be associated with fds with the right device major.

  $ tools/perf/trace/beauty/usbdevfs_ioctl.sh
  static const char *usbdevfs_ioctl_cmds[] = {
	[0] = "CONTROL",
	[10] = "SUBMITURB",
	[11] = "DISCARDURB",
	[12] = "REAPURB",
	[13] = "REAPURBNDELAY",
	[14] = "DISCSIGNAL",
	[15] = "CLAIMINTERFACE",
	[16] = "RELEASEINTERFACE",
	[17] = "CONNECTINFO",
	[18] = "IOCTL",
	[19] = "HUB_PORTINFO",
	[20] = "RESET",
	[21] = "CLEAR_HALT",
	[22] = "DISCONNECT",
	[23] = "CONNECT",
	[24] = "CLAIM_PORT",
	[25] = "RELEASE_PORT",
	[26] = "GET_CAPABILITIES",
	[27] = "DISCONNECT_CLAIM",
	[28] = "ALLOC_STREAMS",
	[29] = "FREE_STREAMS",
	[2] = "BULK",
	[30] = "DROP_PRIVILEGES",
	[31] = "GET_SPEED",
	[3] = "RESETEP",
	[4] = "SETINTERFACE",
	[5] = "SETCONFIGURATION",
	[8] = "GETDRIVER",
  };

  #if 0
  static const char *usbdevfs_ioctl_32_cmds[] = {
	[0] = "CONTROL32",
	[10] = "SUBMITURB32",
	[12] = "REAPURB32",
	[13] = "REAPURBNDELAY32",
	[14] = "DISCSIGNAL32",
	[18] = "IOCTL32",
	[2] = "BULK32",
  };
  #endif
  $

Leaving the '32' variants commented, later we can try to support those
as well, from some other hint (maybe something about the thread issuing
the ioctls) and from the _IOC_SIZE(cmd).

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Luis Cláudio Gonçalves <lclaudio@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-neq1lrji5k4ku0rktn7ytnri@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/trace/beauty/usbdevfs_ioctl.sh | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100755 tools/perf/trace/beauty/usbdevfs_ioctl.sh

diff --git a/tools/perf/trace/beauty/usbdevfs_ioctl.sh b/tools/perf/trace/beauty/usbdevfs_ioctl.sh
new file mode 100755
index 000000000000..930b80f422e8
--- /dev/null
+++ b/tools/perf/trace/beauty/usbdevfs_ioctl.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+# SPDX-License-Identifier: LGPL-2.1
+
+[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
+
+printf "static const char *usbdevfs_ioctl_cmds[] = {\n"
+regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
+egrep $regex ${header_dir}/usbdevice_fs.h | egrep -v 'USBDEVFS_\w+32[[:space:]]' | \
+	sed -r "s/$regex/\2 \1/g"	| \
+	sort | xargs printf "\t[%s] = \"%s\",\n"
+printf "};\n\n"
+printf "#if 0\n"
+printf "static const char *usbdevfs_ioctl_32_cmds[] = {\n"
+regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
+egrep $regex ${header_dir}/usbdevice_fs.h | egrep 'USBDEVFS_\w+32[[:space:]]' | \
+	sed -r "s/$regex/\2 \1/g"	| \
+	sort | xargs printf "\t[%s] = \"%s\",\n"
+printf "};\n"
+printf "#endif\n"
-- 
2.19.2


  parent reply	other threads:[~2019-01-03 12:47 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03 12:45 [GIT PULL 00/29] perf/core improvements and fixes Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 01/29] perf trace: Check if the raw_syscalls:sys_{enter,exit} are setup before setting tp filter Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 02/29] perf beauty mmap: PROT_WRITE should come before PROT_EXEC Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 03/29] perf build: Don't unconditionally link the libbfd feature test to -liberty and -lz Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 04/29] perf trace: Do not hardcode the size of the tracepoint common_ fields Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 05/29] perf trace: Use correct SECCOMP prefix spelling, "SECOMP_*" -> "SECCOMP_*" Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 06/29] perf python: Do not force closing original perf descriptor in evlist.get_pollfd() Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 07/29] perf script: Fix LBR skid dump problems in brstackinsn Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 08/29] perf trace: Rename thread_thread->paths to thread_trace->files Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 09/29] perf trace: Move the files table resizing to outside set_pathname() Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 10/29] perf trace: Store the major number for a file when storing its pathname Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 11/29] tools headers uapi: Grab a copy of usbdevice_fs.h Arnaldo Carvalho de Melo
2019-01-03 12:45 ` Arnaldo Carvalho de Melo [this message]
2019-01-03 12:45 ` [PATCH 13/29] perf trace: Wire up ioctl's USBDEBFS_ cmd table generator Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 14/29] perf trace beauty: Export function to get the files for a thread Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 15/29] perf trace beauty ioctl: Beautify USBDEVFS_ commands Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 16/29] perf c2c: Change the default coalesce setup Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 17/29] perf c2c: Increase the HITM ratio limit for displayed cachelines Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 18/29] tools power x86_energy_perf_policy: Override CFLAGS assignments and add LDFLAGS to build command Arnaldo Carvalho de Melo
2019-01-03 12:45 ` [PATCH 19/29] tools thermal tmon: Allow overriding CFLAGS assignments Arnaldo Carvalho de Melo
2019-01-03 12:46 ` [PATCH 20/29] tools power turbostat: Override CFLAGS assignments and add LDFLAGS to build command Arnaldo Carvalho de Melo
2019-01-03 12:46 ` [PATCH 21/29] tools gpio: Allow overriding CFLAGS Arnaldo Carvalho de Melo
2019-01-03 12:46 ` [PATCH 22/29] perf thread-stack: Simplify some code in thread_stack__process() Arnaldo Carvalho de Melo
2019-01-03 12:46 ` [PATCH 23/29] perf thread-stack: Tidy thread_stack__bottom() usage Arnaldo Carvalho de Melo
2019-01-03 12:46 ` [PATCH 24/29] perf thread-stack: Avoid direct reference to the thread's stack Arnaldo Carvalho de Melo
2019-01-03 12:46 ` [PATCH 25/29] perf thread-stack: Allow for a thread stack array Arnaldo Carvalho de Melo
2019-01-03 12:46 ` [PATCH 26/29] perf thread-stack: Factor out thread_stack__init() Arnaldo Carvalho de Melo
2019-01-03 12:46 ` [PATCH 27/29] perf thread-stack: Allocate an array of thread stacks Arnaldo Carvalho de Melo
2019-01-03 12:46 ` [PATCH 28/29] perf thread-stack: Fix thread stack processing for the idle task Arnaldo Carvalho de Melo
2019-01-03 12:46 ` [PATCH 29/29] perf session: Add comment for perf_session__register_idle_thread() Arnaldo Carvalho de Melo
2019-01-03 13:07 ` [GIT PULL 00/29] perf/core improvements and fixes Ingo Molnar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190103124609.29672-13-acme@kernel.org \
    --to=acme@kernel.org \
    --cc=acme@redhat.com \
    --cc=adrian.hunter@intel.com \
    --cc=jolsa@kernel.org \
    --cc=lclaudio@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=wangnan0@huawei.com \
    --cc=williams@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).