lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-27cf5706a04e53f6844c71be1cbbf1df665f5d19@git.kernel.org>
Date:   Thu, 9 Feb 2017 23:44:01 -0800
From:   tip-bot for Ravi Bangoria <tipbot@...or.com>
To:     linux-tip-commits@...r.kernel.org
Cc:     linux-kernel@...r.kernel.org, maddy@...ux.vnet.ibm.com,
        ravi.bangoria@...ux.vnet.ibm.com, mingo@...nel.org,
        tglx@...utronix.de, mhiramat@...nel.org, acme@...hat.com,
        peterz@...radead.org, alexis.berlemont@...il.com,
        mpe@...erman.id.au, alexander.shishkin@...ux.intel.com,
        hpa@...or.com, naveen.n.rao@...ux.vnet.ibm.com, mingo@...hat.com
Subject: [tip:perf/core] perf sdt: Show proper hint when event not yet in
 place via 'perf probe'

Commit-ID:  27cf5706a04e53f6844c71be1cbbf1df665f5d19
Gitweb:     http://git.kernel.org/tip/27cf5706a04e53f6844c71be1cbbf1df665f5d19
Author:     Ravi Bangoria <ravi.bangoria@...ux.vnet.ibm.com>
AuthorDate: Fri, 3 Feb 2017 15:56:42 +0530
Committer:  Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Wed, 8 Feb 2017 09:28:54 -0300

perf sdt: Show proper hint when event not yet in place via 'perf probe'

All events from 'perf list', except SDT events, can be directly recorded
with 'perf record'. But, the flow is little different for SDT events.

Probe points for SDT event needs to be created using 'perf probe' before
recording it using 'perf record'.

Perf shows misleading hint when a user tries to record SDT event without
first creating a probe point. Show proper hint there.

Before patch:

  $ perf record -a -e sdt_glib:idle__add
    event syntax error: 'sdt_glib:idle__add'
                         \___ unknown tracepoint

    Error: File /sys/kernel/debug/tracing/events/sdt_glib/idle__add not found.
    Hint:  Perhaps this kernel misses some CONFIG_ setting to enable this feature?.
    ...

After patch:

  $ perf record -a -e sdt_glib:idle__add
    event syntax error: 'sdt_glib:idle__add'
                         \___ unknown tracepoint

    Error: File /sys/kernel/debug/tracing/events/sdt_glib/idle__add not found.
    Hint:  SDT event cannot be directly recorded on.
           Please first use 'perf probe sdt_glib:idle__add' before recording it.
    ...

  $ perf probe sdt_glib:idle__add
    Added new event:
      sdt_glib:idle__add   (on %idle__add in /usr/lib64/libglib-2.0.so.0.5000.2)

    You can now use it in all perf tools, such as:

        perf record -e sdt_glib:idle__add -aR sleep 1

  $ perf record -a -e sdt_glib:idle__add
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.175 MB perf.data ]

Suggested-and-Acked-by: Ingo Molnar <mingo@...hat.com>
Signed-off-by: Ravi Bangoria <ravi.bangoria@...ux.vnet.ibm.com>
Tested-by: Arnaldo Carvalho de Melo <acme@...hat.com>
Acked-by: Masami Hiramatsu <mhiramat@...nel.org>
Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
Cc: Alexis Berlemont <alexis.berlemont@...il.com>
Cc: Madhavan Srinivasan <maddy@...ux.vnet.ibm.com>
Cc: Michael Ellerman <mpe@...erman.id.au>
Cc: Naveen N. Rao <naveen.n.rao@...ux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Link: http://lkml.kernel.org/r/20170203102642.17258-1-ravi.bangoria@linux.vnet.ibm.com
[ s/Please use/Please first use/ and break the Hint line in two ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
 tools/lib/api/fs/tracing_path.c | 32 ++++++++++++++++++--------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index 251b7c3..3e606b9 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -86,9 +86,13 @@ void put_tracing_file(char *file)
 	free(file);
 }
 
-static int strerror_open(int err, char *buf, size_t size, const char *filename)
+int tracing_path__strerror_open_tp(int err, char *buf, size_t size,
+				   const char *sys, const char *name)
 {
 	char sbuf[128];
+	char filename[PATH_MAX];
+
+	snprintf(filename, PATH_MAX, "%s/%s", sys, name ?: "*");
 
 	switch (err) {
 	case ENOENT:
@@ -99,10 +103,19 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
 		 * - jirka
 		 */
 		if (debugfs__configured() || tracefs__configured()) {
-			snprintf(buf, size,
-				 "Error:\tFile %s/%s not found.\n"
-				 "Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n",
-				 tracing_events_path, filename);
+			/* sdt markers */
+			if (!strncmp(filename, "sdt_", 4)) {
+				snprintf(buf, size,
+					"Error:\tFile %s/%s not found.\n"
+					"Hint:\tSDT event cannot be directly recorded on.\n"
+					"\tPlease first use 'perf probe %s:%s' before recording it.\n",
+					tracing_events_path, filename, sys, name);
+			} else {
+				snprintf(buf, size,
+					 "Error:\tFile %s/%s not found.\n"
+					 "Hint:\tPerhaps this kernel misses some CONFIG_ setting to enable this feature?.\n",
+					 tracing_events_path, filename);
+			}
 			break;
 		}
 		snprintf(buf, size, "%s",
@@ -125,12 +138,3 @@ static int strerror_open(int err, char *buf, size_t size, const char *filename)
 
 	return 0;
 }
-
-int tracing_path__strerror_open_tp(int err, char *buf, size_t size, const char *sys, const char *name)
-{
-	char path[PATH_MAX];
-
-	snprintf(path, PATH_MAX, "%s/%s", sys, name ?: "*");
-
-	return strerror_open(err, buf, size, path);
-}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ