History log of /linux-master/tools/perf/trace/beauty/pkey_alloc_access_rights.sh
Revision Date Author Comments
# 818448e9 18-Nov-2022 Tiezhu Yang <yangtiezhu@loongson.cn>

perf tools: Use "grep -E" instead of "egrep"

The latest version of grep claims the egrep is now obsolete so the build
now contains warnings that look like:

egrep: warning: egrep is obsolescent; using grep -E

fix this up by moving the related file to use "grep -E" instead.

sed -i "s/egrep/grep -E/g" `grep egrep -rwl tools/perf`

Here are the steps to install the latest grep:

wget http://ftp.gnu.org/gnu/grep/grep-3.8.tar.gz
tar xf grep-3.8.tar.gz
cd grep-3.8 && ./configure && make
sudo make install
export PATH=/usr/local/bin:$PATH

Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
Acked-by: Ian Rogers <irogers@google.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lore.kernel.org/lkml/1668762999-9297-1-git-send-email-yangtiezhu@loongson.cn
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>


# 794f594e 24-Oct-2018 Arnaldo Carvalho de Melo <acme@redhat.com>

perf beauty: Switch from GPL v2.0 to LGPL v2.1

The intention is to have this as a library, since it is not perf
specific at all.

I did the switch for the files where I'm the only contributor, with the
exception of a few lines changed by Jiri Olsa.

Acked-by: Jiri Olsa <jolsa@kernel.org>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-a04q6chdyjknm1hr305ulx8h@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>


# 61b229ce 25-Jul-2018 Arnaldo Carvalho de Melo <acme@redhat.com>

perf trace beauty: Default header_dir to cwd to work without parms

Useful when checking the effects of header synchs for the files it uses
as a input to generate string tables, in retrospect this is how it
should've been done from day 1, not requiring the header_dir to be set
on the Makefile, will change everything later, so that the only parm,
common to all generators will be $(srctree) and $(beauty_outdir).

So, to see what it generates, just call it without any parameters:

$ tools/perf/trace/beauty/vhost_virtio_ioctl.sh
static const char *vhost_virtio_ioctl_cmds[] = {
[0x00] = "SET_FEATURES",
[0x01] = "SET_OWNER",
[0x02] = "RESET_OWNER",
[0x03] = "SET_MEM_TABLE",
[0x04] = "SET_LOG_BASE",
[0x07] = "SET_LOG_FD",
[0x10] = "SET_VRING_NUM",
[0x11] = "SET_VRING_ADDR",
[0x12] = "SET_VRING_BASE",
[0x13] = "SET_VRING_ENDIAN",
[0x14] = "GET_VRING_ENDIAN",
[0x20] = "SET_VRING_KICK",
[0x21] = "SET_VRING_CALL",
[0x22] = "SET_VRING_ERR",
[0x23] = "SET_VRING_BUSYLOOP_TIMEOUT",
[0x24] = "GET_VRING_BUSYLOOP_TIMEOUT",
[0x30] = "NET_SET_BACKEND",
[0x40] = "SCSI_SET_ENDPOINT",
[0x41] = "SCSI_CLEAR_ENDPOINT",
[0x42] = "SCSI_GET_ABI_VERSION",
[0x43] = "SCSI_SET_EVENTS_MISSED",
[0x44] = "SCSI_GET_EVENTS_MISSED",
[0x60] = "VSOCK_SET_GUEST_CID",
[0x61] = "VSOCK_SET_RUNNING",
};
static const char *vhost_virtio_ioctl_read_cmds[] = {
[0x00] = "GET_FEATURES",
[0x12] = "GET_VRING_BASE",
};
$

Or:

$ tools/perf/trace/beauty/sndrv_pcm_ioctl.sh
static const char *sndrv_pcm_ioctl_cmds[] = {
[0x00] = "PVERSION",
[0x01] = "INFO",
[0x02] = "TSTAMP",
[0x03] = "TTSTAMP",
[0x04] = "USER_PVERSION",
[0x10] = "HW_REFINE",
[0x11] = "HW_PARAMS",
[0x12] = "HW_FREE",
[0x13] = "SW_PARAMS",
[0x20] = "STATUS",
[0x21] = "DELAY",
[0x22] = "HWSYNC",
[0x23] = "SYNC_PTR",
[0x24] = "STATUS_EXT",
[0x32] = "CHANNEL_INFO",
[0x40] = "PREPARE",
[0x41] = "RESET",
[0x42] = "START",
[0x43] = "DROP",
[0x44] = "DRAIN",
[0x45] = "PAUSE",
[0x46] = "REWIND",
[0x47] = "RESUME",
[0x48] = "XRUN",
[0x49] = "FORWARD",
[0x50] = "WRITEI_FRAMES",
[0x51] = "READI_FRAMES",
[0x52] = "WRITEN_FRAMES",
[0x53] = "READN_FRAMES",
[0x60] = "LINK",
[0x61] = "UNLINK",
};
$

Etc.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: https://lkml.kernel.org/n/tip-90am4vm8hh1osms894dp2otr@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>


# 83bc9c37 28-Aug-2017 Arnaldo Carvalho de Melo <acme@redhat.com>

perf trace beauty: Beautify pkey_{alloc,free,mprotect} arguments

Reuse 'mprotect' beautifiers for 'pkey_mprotect'.

System wide tracing pkey_alloc, pkey_free and pkey_mprotect calls, with
backtraces:

# perf trace -e pkey_alloc,pkey_mprotect,pkey_free --max-stack=5
0.000 ( 0.011 ms): pkey/7818 pkey_alloc(init_val: DISABLE_ACCESS|DISABLE_WRITE) = -1 EINVAL Invalid argument
syscall (/usr/lib64/libc-2.25.so)
pkey_alloc (/home/acme/c/pkey)
0.022 ( 0.003 ms): pkey/7818 pkey_mprotect(start: 0x7f28c3890000, len: 4096, prot: READ|WRITE, pkey: -1) = 0
syscall (/usr/lib64/libc-2.25.so)
pkey_mprotect (/home/acme/c/pkey)
0.030 ( 0.002 ms): pkey/7818 pkey_free(pkey: -1 ) = -1 EINVAL Invalid argument
syscall (/usr/lib64/libc-2.25.so)
pkey_free (/home/acme/c/pkey)

The tools/include/uapi/asm-generic/mman-common.h file is used to find
the access rights defines for the pkey_alloc syscall second argument.

Since we have the detector of changes for the tools/include header files
versus its kernel origin (include/uapi/asm-generic/mman-common.h), we'll
get whatever new flag appears for that argument automatically.

This method should be used in other cases where it is easy to generate
those flags tables because the header has properly namespaced defines
like PKEY_DISABLE_ACCESS and PKEY_DISABLE_WRITE.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-3xq5312qlks7wtfzv2sk3nct@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>