All of lore.kernel.org
 help / color / mirror / Atom feed
* [igt-dev] [PATCH i-g-t 1/3] lib: Add hooks for enabling ftrace
@ 2019-04-02  2:44 Ashutosh Dixit
  2019-04-02  2:44 ` [igt-dev] [PATCH i-g-t 2/3] lib: Add more debugfs and ftrace helpers Ashutosh Dixit
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Ashutosh Dixit @ 2019-04-02  2:44 UTC (permalink / raw)
  To: igt-dev

From: Chris Wilson <chris@chris-wilson.co.uk>

If the kernel has tracing support builtin, we can enable around
troublesome tests to obtain greater detail from the kernel that may
prove invaluable in debugging the problem.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 lib/Makefile.sources |   2 +
 lib/igt_core.c       |  28 ++----
 lib/igt_ftrace.c     | 204 +++++++++++++++++++++++++++++++++++++++++++
 lib/igt_ftrace.h     |  46 ++++++++++
 lib/meson.build      |   1 +
 5 files changed, 258 insertions(+), 23 deletions(-)
 create mode 100644 lib/igt_ftrace.c
 create mode 100644 lib/igt_ftrace.h

diff --git a/lib/Makefile.sources b/lib/Makefile.sources
index e00347f9..e45f1a19 100644
--- a/lib/Makefile.sources
+++ b/lib/Makefile.sources
@@ -26,6 +26,8 @@ lib_source_list =	 	\
 	igt_color_encoding.c	\
 	igt_color_encoding.h	\
 	igt_edid_template.h	\
+	igt_ftrace.c		\
+	igt_ftrace.h		\
 	igt_gpu_power.c		\
 	igt_gpu_power.h		\
 	igt_gt.c		\
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 6eb4798e..3e69cf66 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -62,6 +62,7 @@
 #include "intel_io.h"
 #include "igt_debugfs.h"
 #include "igt_dummyload.h"
+#include "igt_ftrace.h"
 #include "version.h"
 #include "config.h"
 
@@ -490,31 +491,11 @@ void __igt_fixture_end(void)
 	siglongjmp(igt_subtest_jmpbuf, 1);
 }
 
-/*
- * If the test takes out the machine, in addition to the usual dmesg
- * spam, the kernel may also emit a "death rattle" -- extra debug
- * information that is overkill for normal successful tests, but
- * vital for post-mortem analysis.
- */
-static void ftrace_dump_on_oops(bool enable)
-{
-	int fd;
-
-	fd = open("/proc/sys/kernel/ftrace_dump_on_oops", O_WRONLY);
-	if (fd < 0)
-		return;
-
-	/*
-	 * If we fail, we do not get the death rattle we wish, but we
-	 * still want to run the tests anyway.
-	 */
-	igt_ignore_warn(write(fd, enable ? "1\n" : "0\n", 2));
-	close(fd);
-}
-
 bool igt_exit_called;
 static void common_exit_handler(int sig)
 {
+	igt_ftrace_close();
+
 	if (!igt_only_list_subtests()) {
 		bind_fbcon(true);
 	}
@@ -812,7 +793,8 @@ out:
 
 		sync();
 		oom_adjust_for_doom();
-		ftrace_dump_on_oops(true);
+
+		igt_ftrace_open();
 	}
 
 	/* install exit handler, to ensure we clean up */
diff --git a/lib/igt_ftrace.c b/lib/igt_ftrace.c
new file mode 100644
index 00000000..43f396d6
--- /dev/null
+++ b/lib/igt_ftrace.c
@@ -0,0 +1,204 @@
+/*
+ * Copyright © 2019 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#include <errno.h>
+#include <fcntl.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "igt.h"
+#include "igt_ftrace.h"
+#include "igt_debugfs.h"
+#include "igt_sysfs.h"
+
+#define BIT(x) (1ul << (x))
+
+/* Only a single tracer in the kernel, so we can use a singleton */
+struct igt_ftrace {
+	int dir;
+
+	unsigned long flags;
+#define PID_SET BIT(0)
+#define INCLUDE_SET BIT(1)
+#define EXCLUDE_SET BIT(2)
+
+} igt_ftrace = { -1 };
+
+/*
+ * If the test takes out the machine, in addition to the usual dmesg
+ * spam, the kernel may also emit a "death rattle" -- extra debug
+ * information that is overkill for normal successful tests, but
+ * vital for post-mortem analysis.
+ */
+static void ftrace_dump_on_oops(bool enable)
+{
+	int fd;
+
+	fd = open("/proc/sys/kernel/ftrace_dump_on_oops", O_WRONLY);
+	if (fd < 0)
+		return;
+
+	/*
+	 * If we fail, we do not get the death rattle we wish, but we
+	 * still want to run the tests anyway.
+	 */
+	igt_ignore_warn(write(fd, enable ? "1\n" : "0\n", 2));
+	close(fd);
+}
+
+int igt_ftrace_open(void)
+{
+	int dir;
+	int err;
+
+	dir = open(igt_debugfs_mount(), O_RDONLY);
+	if (dir < 0)
+		return -errno;
+
+	igt_ftrace.dir = openat(dir, "tracing", O_RDONLY);
+	close(dir);
+	if (igt_ftrace.dir < 0)
+		return -errno;
+
+	err = igt_ftrace_disable();
+	if (err)
+		goto ft_close;
+
+	ftrace_dump_on_oops(true);
+	return 0;
+
+ft_close:
+	close(igt_ftrace.dir);
+	igt_ftrace.dir = -1;
+	return err;
+}
+
+int __igt_ftrace_enable(const char *mode,
+			const struct igt_ftrace_options *opts)
+{
+	int err;
+
+	if (igt_ftrace.dir < 0)
+		return -ENODEV;
+
+	if (!mode)
+		return -EINVAL;
+
+	err = igt_sysfs_set(igt_ftrace.dir, "current_tracer", mode);
+	if (err < 0)
+		return err;
+
+	if (opts && opts->pid) {
+		err = igt_sysfs_printf(igt_ftrace.dir,
+				       "set_ftrace_pid", "%d",
+				       opts->pid);
+		if (err < 0)
+			goto disable;
+
+		igt_ftrace.flags |= PID_SET;
+	}
+
+	if (opts && opts->include) {
+		err = igt_sysfs_set(igt_ftrace.dir,
+				    "set_ftrace_filter",
+				    opts->include);
+		if (err < 0)
+			goto disable;
+
+		igt_ftrace.flags |= INCLUDE_SET;
+	}
+
+	if (opts && opts->exclude) {
+		err = igt_sysfs_set(igt_ftrace.dir,
+				    "set_ftrace_notrace",
+				    opts->exclude);
+		if (err < 0)
+			goto disable;
+
+		igt_ftrace.flags |= EXCLUDE_SET;
+	}
+
+	err = igt_sysfs_set(igt_ftrace.dir, "tracer_on", "1");
+	if (err < 0)
+		return err;
+
+	return 0;
+
+disable:
+	igt_ftrace_disable();
+	return err;
+}
+
+int igt_ftrace_disable(void)
+{
+	int err;
+
+	if (igt_ftrace.dir < 0)
+		return -ENODEV;
+
+	err = igt_sysfs_set(igt_ftrace.dir, "tracer_on", "0");
+	if (err < 0)
+		return err;
+
+	if (igt_ftrace.flags & PID_SET) {
+		igt_sysfs_set(igt_ftrace.dir, "set_ftrace_pid", "");
+		igt_ftrace.flags &= ~PID_SET;
+	}
+
+	if (igt_ftrace.flags & INCLUDE_SET) {
+		igt_sysfs_set(igt_ftrace.dir, "set_ftrace_filter", "");
+		igt_ftrace.flags &= ~INCLUDE_SET;
+	}
+
+	if (igt_ftrace.flags & EXCLUDE_SET) {
+		igt_sysfs_set(igt_ftrace.dir, "set_ftrace_notrace", "");
+		igt_ftrace.flags &= ~EXCLUDE_SET;
+	}
+
+	return 0;
+}
+
+void igt_ftrace_dump(const char *header)
+{
+	char *txt;
+
+	if (igt_ftrace.dir < 0)
+		return;
+
+	txt = igt_sysfs_get(igt_ftrace.dir, "trace");
+	if (!txt)
+		return;
+
+	igt_info("%s:\n%s", header, txt);
+	free(txt);
+}
+
+void igt_ftrace_close(void)
+{
+	if (igt_ftrace.dir < 0)
+		return;
+
+	close(igt_ftrace.dir);
+	igt_ftrace.dir = -1;
+}
diff --git a/lib/igt_ftrace.h b/lib/igt_ftrace.h
new file mode 100644
index 00000000..9aceeca9
--- /dev/null
+++ b/lib/igt_ftrace.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright © 2019 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+ * IN THE SOFTWARE.
+ *
+ */
+
+#ifndef IGT_FTRACE_H
+#define IGT_FTRACE_H
+
+int igt_ftrace_open(void);
+
+struct igt_ftrace_options {
+	int pid;
+	const char *include;
+	const char *exclude;
+};
+
+int __igt_ftrace_enable(const char *mode,
+			const struct igt_ftrace_options *opts);
+#define igt_ftrace_enable() __igt_ftrace_enable("function_graph", NULL)
+
+int igt_ftrace_disable(void);
+
+void igt_ftrace_dump(const char *header);
+
+void igt_ftrace_close(void);
+
+#endif /* IGT_FTRACE_H */
diff --git a/lib/meson.build b/lib/meson.build
index 89de06e6..99438235 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -9,6 +9,7 @@ lib_sources = [
 	'igt_debugfs.c',
 	'igt_device.c',
 	'igt_aux.c',
+	'igt_ftrace.c',
 	'igt_gpu_power.c',
 	'igt_gt.c',
 	'igt_gvt.c',
-- 
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [igt-dev] [PATCH i-g-t 2/3] lib: Add more debugfs and ftrace helpers
  2019-04-02  2:44 [igt-dev] [PATCH i-g-t 1/3] lib: Add hooks for enabling ftrace Ashutosh Dixit
@ 2019-04-02  2:44 ` Ashutosh Dixit
  2019-04-09  8:21   ` Chris Wilson
  2019-04-02  2:44 ` [igt-dev] [PATCH i-g-t 3/3] lib: Enable extra kernel logs for audio debug Ashutosh Dixit
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Ashutosh Dixit @ 2019-04-02  2:44 UTC (permalink / raw)
  To: igt-dev

Add functions to:
* enable/disable dynamic debug using <debugfs>/dynamic_debug/control
* set ftrace events for the nop tracer
* clear the ftrace buffer

Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 lib/igt_debugfs.c | 24 ++++++++++++++++++++++++
 lib/igt_debugfs.h |  1 +
 lib/igt_ftrace.c  | 39 ++++++++++++++++++++++++++++++++++++---
 lib/igt_ftrace.h  |  4 ++++
 4 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index dd229c09..cf08a0a3 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -367,6 +367,30 @@ bool igt_debugfs_search(int device, const char *filename, const char *substring)
 	return matched;
 }
 
+/* Echo array of strings into <debugfs>/dynamic_debug/control */
+int igt_set_dynamic_debug(const char **str, int nstr)
+{
+	int debugfs, dyn, err, i;
+
+	debugfs = open(igt_debugfs_mount(), O_RDONLY);
+	if (debugfs < 0)
+		return -errno;
+
+	dyn = openat(debugfs, "dynamic_debug", O_RDONLY);
+	close(debugfs);
+	if (dyn < 0)
+		return -errno;
+
+	for (i = 0; i < nstr; i++) {
+		err = igt_sysfs_set(dyn, "control", str[i]);
+		if (err < 0)
+			return -errno;
+	}
+
+	close(dyn);
+	return 0;
+}
+
 /*
  * Pipe CRC
  */
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index f8e57a6b..74bfae5b 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -41,6 +41,7 @@ int igt_debugfs_open(int fd, const char *filename, int mode);
 void __igt_debugfs_read(int fd, const char *filename, char *buf, int size);
 int igt_debugfs_simple_read(int dir, const char *filename, char *buf, int size);
 bool igt_debugfs_search(int fd, const char *filename, const char *substring);
+int igt_set_dynamic_debug(const char **str, int nstr);
 
 /**
  * igt_debugfs_read:
diff --git a/lib/igt_ftrace.c b/lib/igt_ftrace.c
index 43f396d6..1f02e1da 100644
--- a/lib/igt_ftrace.c
+++ b/lib/igt_ftrace.c
@@ -139,7 +139,7 @@ int __igt_ftrace_enable(const char *mode,
 		igt_ftrace.flags |= EXCLUDE_SET;
 	}
 
-	err = igt_sysfs_set(igt_ftrace.dir, "tracer_on", "1");
+	err = igt_sysfs_set(igt_ftrace.dir, "tracing_on", "1");
 	if (err < 0)
 		return err;
 
@@ -157,7 +157,7 @@ int igt_ftrace_disable(void)
 	if (igt_ftrace.dir < 0)
 		return -ENODEV;
 
-	err = igt_sysfs_set(igt_ftrace.dir, "tracer_on", "0");
+	err = igt_sysfs_set(igt_ftrace.dir, "tracing_on", "0");
 	if (err < 0)
 		return err;
 
@@ -179,6 +179,24 @@ int igt_ftrace_disable(void)
 	return 0;
 }
 
+/* Implement 'echo 0/1 > <debugfs>/tracing/str[i]' */
+int igt_ftrace_set_events(const char **str, int nstr, bool enable)
+{
+	int i, ret, err = 0;
+
+	if (igt_ftrace.dir < 0)
+		return -ENODEV;
+
+	for (i = 0; i < nstr; i++) {
+		ret = igt_sysfs_set(igt_ftrace.dir, str[i],
+				    enable ? "1\n" : "0\n");
+		if (ret)
+			err = ret;
+	}
+
+	return err;
+}
+
 void igt_ftrace_dump(const char *header)
 {
 	char *txt;
@@ -190,10 +208,25 @@ void igt_ftrace_dump(const char *header)
 	if (!txt)
 		return;
 
-	igt_info("%s:\n%s", header, txt);
+	igt_info("%s:\n%s\n", header, txt);
 	free(txt);
 }
 
+/* Implement the equivalent of 'echo > <debugfs>/tracing/trace' */
+int igt_ftrace_clear(void)
+{
+	int fd;
+
+	if (igt_ftrace.dir < 0)
+		return -ENODEV;
+
+	fd = openat(igt_ftrace.dir, "trace", O_WRONLY | O_TRUNC);
+	if (fd < 0)
+		return -errno;
+	close(fd);
+	return 0;
+}
+
 void igt_ftrace_close(void)
 {
 	if (igt_ftrace.dir < 0)
diff --git a/lib/igt_ftrace.h b/lib/igt_ftrace.h
index 9aceeca9..6f4225ee 100644
--- a/lib/igt_ftrace.h
+++ b/lib/igt_ftrace.h
@@ -39,8 +39,12 @@ int __igt_ftrace_enable(const char *mode,
 
 int igt_ftrace_disable(void);
 
+int igt_ftrace_set_events(const char **str, int nstr, bool enable);
+
 void igt_ftrace_dump(const char *header);
 
+int igt_ftrace_clear(void);
+
 void igt_ftrace_close(void);
 
 #endif /* IGT_FTRACE_H */
-- 
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [igt-dev] [PATCH i-g-t 3/3] lib: Enable extra kernel logs for audio debug
  2019-04-02  2:44 [igt-dev] [PATCH i-g-t 1/3] lib: Add hooks for enabling ftrace Ashutosh Dixit
  2019-04-02  2:44 ` [igt-dev] [PATCH i-g-t 2/3] lib: Add more debugfs and ftrace helpers Ashutosh Dixit
@ 2019-04-02  2:44 ` Ashutosh Dixit
  2019-04-02  6:39   ` Jani Nikula
  2019-04-09  2:40   ` Ashutosh Dixit
  2019-04-02  8:57 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib: Add hooks for enabling ftrace Patchwork
  2019-04-02 13:04 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  3 siblings, 2 replies; 10+ messages in thread
From: Ashutosh Dixit @ 2019-04-02  2:44 UTC (permalink / raw)
  To: igt-dev

For debug of audio issues in power management and driver reload tests,
additional kernel logs may be useful, both in dmesg as well as
ftrace. Add the infrastructure to generate these logs and enable these
logs for selected tests.

At present igt_runner and other CI infrastructure does not capture the
ftrace buffer. Therefore, to avoid changes to igt_runner and the CI
infrastructure the ftrace buffer is dumped to stdout at the end of
each test.

v4: remove system() calls, dump audio kernel logs from igt_fixture
v2, v3: versions to fix CI

Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 lib/igt_audio.c               | 40 +++++++++++++++++++++++++++++++++++
 lib/igt_audio.h               |  2 ++
 tests/i915/i915_module_load.c |  8 +++++++
 tests/i915/i915_pm_rpm.c      |  8 ++++++-
 tests/i915/i915_suspend.c     |  8 +++++--
 5 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/lib/igt_audio.c b/lib/igt_audio.c
index a0592d53..8a7841be 100644
--- a/lib/igt_audio.c
+++ b/lib/igt_audio.c
@@ -31,6 +31,8 @@
 
 #include "igt_audio.h"
 #include "igt_core.h"
+#include "igt_debugfs.h"
+#include "igt_ftrace.h"
 
 #define FREQS_MAX	8
 
@@ -323,3 +325,41 @@ bool audio_signal_detect(struct audio_signal *signal, int channels,
 
 	return true;
 }
+
+static const char *audio_dmesg_en[] = {
+	"file sound/* +p",
+};
+
+static const char *audio_dmesg_dis[] = {
+	"file sound/* -p",
+};
+
+static const char *audio_ftr[] = {
+	"events/sst/enable",
+	"events/intel-sst/enable",
+	"events/asoc/enable",
+	"events/i2c/enable",
+	"events/hda/enable",
+	"events/hda_controller/enable",
+	"events/hda_intel/enable",
+};
+
+void igt_enable_audio_klog(void)
+{
+	igt_set_dynamic_debug(audio_dmesg_en,
+			      sizeof(audio_dmesg_en)/sizeof(char*));
+	igt_ftrace_set_events(audio_ftr,
+			      sizeof(audio_ftr)/sizeof(char*), true);
+	__igt_ftrace_enable("nop", NULL);
+}
+
+void igt_disable_audio_klog(void)
+{
+	igt_ftrace_disable();
+	igt_ftrace_set_events(audio_ftr,
+			      sizeof(audio_ftr)/sizeof(char*), false);
+	igt_ftrace_dump("Ftrace output");
+	igt_ftrace_clear();
+	igt_set_dynamic_debug(audio_dmesg_dis,
+			      sizeof(audio_dmesg_dis)/sizeof(char*));
+}
diff --git a/lib/igt_audio.h b/lib/igt_audio.h
index b3b658a4..dab5ab5a 100644
--- a/lib/igt_audio.h
+++ b/lib/igt_audio.h
@@ -40,5 +40,7 @@ void audio_signal_clean(struct audio_signal *signal);
 void audio_signal_fill(struct audio_signal *signal, short *buffer, int frames);
 bool audio_signal_detect(struct audio_signal *signal, int channels,
 			 int sampling_rate, short *buffer, int frames);
+void igt_enable_audio_klog(void);
+void igt_disable_audio_klog(void);
 
 #endif
diff --git a/tests/i915/i915_module_load.c b/tests/i915/i915_module_load.c
index 7fe83520..0d569a55 100644
--- a/tests/i915/i915_module_load.c
+++ b/tests/i915/i915_module_load.c
@@ -326,6 +326,10 @@ hda_dynamic_debug(bool enable)
 
 igt_main
 {
+	igt_fixture {
+		igt_enable_audio_klog();
+	}
+
 	igt_subtest("reload") {
 		int load_error;
 
@@ -365,5 +369,9 @@ igt_main
 		/* inject_fault() leaves the module unloaded */
 	}
 
+	igt_fixture {
+		igt_disable_audio_klog();
+	}
+
 	/* Subtests should unload the module themselves if they use modparams */
 }
diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
index 03de609c..126d68ac 100644
--- a/tests/i915/i915_pm_rpm.c
+++ b/tests/i915/i915_pm_rpm.c
@@ -1975,8 +1975,10 @@ int main(int argc, char *argv[])
 	/* Skip instead of failing in case the machine is not prepared to reach
 	 * PC8+. We don't want bug reports from cases where the machine is just
 	 * not properly configured. */
-	igt_fixture
+	igt_fixture {
+		igt_enable_audio_klog();
 		igt_require(setup_environment());
+	}
 
 	if (stay)
 		igt_subtest("stay")
@@ -2118,5 +2120,9 @@ int main(int argc, char *argv[])
 		igt_i915_driver_unload();
 	}
 
+	igt_fixture {
+		igt_disable_audio_klog();
+	}
+
 	igt_exit();
 }
diff --git a/tests/i915/i915_suspend.c b/tests/i915/i915_suspend.c
index 17c68cc1..527e974e 100644
--- a/tests/i915/i915_suspend.c
+++ b/tests/i915/i915_suspend.c
@@ -207,8 +207,10 @@ igt_main
 {
 	igt_skip_on_simulation();
 
-	igt_fixture
+	igt_fixture {
 		fd = drm_open_driver(DRIVER_INTEL);
+		igt_enable_audio_klog();
+	}
 
 	igt_subtest("fence-restore-tiled2untiled")
 		test_fence_restore(fd, true, false);
@@ -243,6 +245,8 @@ igt_main
 	igt_subtest("forcewake-hibernate")
 		test_forcewake(fd, true);
 
-	igt_fixture
+	igt_fixture {
+		igt_disable_audio_klog();
 		close(fd);
+	}
 }
-- 
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 3/3] lib: Enable extra kernel logs for audio debug
  2019-04-02  2:44 ` [igt-dev] [PATCH i-g-t 3/3] lib: Enable extra kernel logs for audio debug Ashutosh Dixit
@ 2019-04-02  6:39   ` Jani Nikula
  2019-04-09  2:40   ` Ashutosh Dixit
  1 sibling, 0 replies; 10+ messages in thread
From: Jani Nikula @ 2019-04-02  6:39 UTC (permalink / raw)
  To: Ashutosh Dixit, igt-dev

On Mon, 01 Apr 2019, Ashutosh Dixit <ashutosh.dixit@intel.com> wrote:
> For debug of audio issues in power management and driver reload tests,
> additional kernel logs may be useful, both in dmesg as well as
> ftrace. Add the infrastructure to generate these logs and enable these
> logs for selected tests.
>
> At present igt_runner and other CI infrastructure does not capture the
> ftrace buffer. Therefore, to avoid changes to igt_runner and the CI
> infrastructure the ftrace buffer is dumped to stdout at the end of
> each test.
>
> v4: remove system() calls, dump audio kernel logs from igt_fixture
> v2, v3: versions to fix CI
>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
> ---
>  lib/igt_audio.c               | 40 +++++++++++++++++++++++++++++++++++
>  lib/igt_audio.h               |  2 ++
>  tests/i915/i915_module_load.c |  8 +++++++
>  tests/i915/i915_pm_rpm.c      |  8 ++++++-
>  tests/i915/i915_suspend.c     |  8 +++++--
>  5 files changed, 63 insertions(+), 3 deletions(-)
>
> diff --git a/lib/igt_audio.c b/lib/igt_audio.c
> index a0592d53..8a7841be 100644
> --- a/lib/igt_audio.c
> +++ b/lib/igt_audio.c
> @@ -31,6 +31,8 @@
>  
>  #include "igt_audio.h"
>  #include "igt_core.h"
> +#include "igt_debugfs.h"
> +#include "igt_ftrace.h"
>  
>  #define FREQS_MAX	8
>  
> @@ -323,3 +325,41 @@ bool audio_signal_detect(struct audio_signal *signal, int channels,
>  
>  	return true;
>  }
> +
> +static const char *audio_dmesg_en[] = {
> +	"file sound/* +p",
> +};
> +
> +static const char *audio_dmesg_dis[] = {
> +	"file sound/* -p",
> +};
> +
> +static const char *audio_ftr[] = {
> +	"events/sst/enable",
> +	"events/intel-sst/enable",
> +	"events/asoc/enable",
> +	"events/i2c/enable",
> +	"events/hda/enable",
> +	"events/hda_controller/enable",
> +	"events/hda_intel/enable",
> +};
> +
> +void igt_enable_audio_klog(void)
> +{
> +	igt_set_dynamic_debug(audio_dmesg_en,
> +			      sizeof(audio_dmesg_en)/sizeof(char*));

ARRAY_SIZE()

> +	igt_ftrace_set_events(audio_ftr,
> +			      sizeof(audio_ftr)/sizeof(char*), true);
> +	__igt_ftrace_enable("nop", NULL);
> +}
> +
> +void igt_disable_audio_klog(void)
> +{
> +	igt_ftrace_disable();
> +	igt_ftrace_set_events(audio_ftr,
> +			      sizeof(audio_ftr)/sizeof(char*), false);
> +	igt_ftrace_dump("Ftrace output");
> +	igt_ftrace_clear();
> +	igt_set_dynamic_debug(audio_dmesg_dis,
> +			      sizeof(audio_dmesg_dis)/sizeof(char*));
> +}

I still think ftrace and dynamic debug should be separate. It's
surprising that "enable klog" enables tracing.

BR,
Jani.



> diff --git a/lib/igt_audio.h b/lib/igt_audio.h
> index b3b658a4..dab5ab5a 100644
> --- a/lib/igt_audio.h
> +++ b/lib/igt_audio.h
> @@ -40,5 +40,7 @@ void audio_signal_clean(struct audio_signal *signal);
>  void audio_signal_fill(struct audio_signal *signal, short *buffer, int frames);
>  bool audio_signal_detect(struct audio_signal *signal, int channels,
>  			 int sampling_rate, short *buffer, int frames);
> +void igt_enable_audio_klog(void);
> +void igt_disable_audio_klog(void);
>  
>  #endif
> diff --git a/tests/i915/i915_module_load.c b/tests/i915/i915_module_load.c
> index 7fe83520..0d569a55 100644
> --- a/tests/i915/i915_module_load.c
> +++ b/tests/i915/i915_module_load.c
> @@ -326,6 +326,10 @@ hda_dynamic_debug(bool enable)
>  
>  igt_main
>  {
> +	igt_fixture {
> +		igt_enable_audio_klog();
> +	}
> +
>  	igt_subtest("reload") {
>  		int load_error;
>  
> @@ -365,5 +369,9 @@ igt_main
>  		/* inject_fault() leaves the module unloaded */
>  	}
>  
> +	igt_fixture {
> +		igt_disable_audio_klog();
> +	}
> +
>  	/* Subtests should unload the module themselves if they use modparams */
>  }
> diff --git a/tests/i915/i915_pm_rpm.c b/tests/i915/i915_pm_rpm.c
> index 03de609c..126d68ac 100644
> --- a/tests/i915/i915_pm_rpm.c
> +++ b/tests/i915/i915_pm_rpm.c
> @@ -1975,8 +1975,10 @@ int main(int argc, char *argv[])
>  	/* Skip instead of failing in case the machine is not prepared to reach
>  	 * PC8+. We don't want bug reports from cases where the machine is just
>  	 * not properly configured. */
> -	igt_fixture
> +	igt_fixture {
> +		igt_enable_audio_klog();
>  		igt_require(setup_environment());
> +	}
>  
>  	if (stay)
>  		igt_subtest("stay")
> @@ -2118,5 +2120,9 @@ int main(int argc, char *argv[])
>  		igt_i915_driver_unload();
>  	}
>  
> +	igt_fixture {
> +		igt_disable_audio_klog();
> +	}
> +
>  	igt_exit();
>  }
> diff --git a/tests/i915/i915_suspend.c b/tests/i915/i915_suspend.c
> index 17c68cc1..527e974e 100644
> --- a/tests/i915/i915_suspend.c
> +++ b/tests/i915/i915_suspend.c
> @@ -207,8 +207,10 @@ igt_main
>  {
>  	igt_skip_on_simulation();
>  
> -	igt_fixture
> +	igt_fixture {
>  		fd = drm_open_driver(DRIVER_INTEL);
> +		igt_enable_audio_klog();
> +	}
>  
>  	igt_subtest("fence-restore-tiled2untiled")
>  		test_fence_restore(fd, true, false);
> @@ -243,6 +245,8 @@ igt_main
>  	igt_subtest("forcewake-hibernate")
>  		test_forcewake(fd, true);
>  
> -	igt_fixture
> +	igt_fixture {
> +		igt_disable_audio_klog();
>  		close(fd);
> +	}
>  }

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib: Add hooks for enabling ftrace
  2019-04-02  2:44 [igt-dev] [PATCH i-g-t 1/3] lib: Add hooks for enabling ftrace Ashutosh Dixit
  2019-04-02  2:44 ` [igt-dev] [PATCH i-g-t 2/3] lib: Add more debugfs and ftrace helpers Ashutosh Dixit
  2019-04-02  2:44 ` [igt-dev] [PATCH i-g-t 3/3] lib: Enable extra kernel logs for audio debug Ashutosh Dixit
@ 2019-04-02  8:57 ` Patchwork
  2019-04-02 13:04 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
  3 siblings, 0 replies; 10+ messages in thread
From: Patchwork @ 2019-04-02  8:57 UTC (permalink / raw)
  To: Ashutosh Dixit; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,1/3] lib: Add hooks for enabling ftrace
URL   : https://patchwork.freedesktop.org/series/58859/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5853 -> IGTPW_2756
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/58859/revisions/1/mbox/

Known issues
------------

  Here are the changes found in IGTPW_2756 that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@amdgpu/amd_basic@cs-compute:
    - fi-kbl-8809g:       NOTRUN -> FAIL [fdo#108094]

  * igt@amdgpu/amd_cs_nop@fork-gfx0:
    - fi-icl-u2:          NOTRUN -> SKIP [fdo#109315] +17

  * igt@amdgpu/amd_cs_nop@sync-fork-compute0:
    - fi-icl-u3:          NOTRUN -> SKIP [fdo#109315] +17

  * igt@gem_exec_basic@gtt-bsd1:
    - fi-icl-u3:          NOTRUN -> SKIP [fdo#109276] +7

  * igt@gem_exec_basic@readonly-bsd1:
    - fi-icl-u2:          NOTRUN -> SKIP [fdo#109276] +7

  * igt@gem_exec_parse@basic-allowed:
    - fi-icl-u2:          NOTRUN -> SKIP [fdo#109289] +1

  * igt@gem_exec_parse@basic-rejected:
    - fi-icl-u3:          NOTRUN -> SKIP [fdo#109289] +1

  * igt@i915_selftest@live_contexts:
    - fi-icl-u3:          NOTRUN -> DMESG-FAIL [fdo#108569]
    - fi-icl-u2:          NOTRUN -> DMESG-FAIL [fdo#108569]
    - fi-bdw-gvtdvm:      PASS -> DMESG-FAIL [fdo#110235 ]

  * igt@i915_selftest@live_execlists:
    - fi-apl-guc:         PASS -> INCOMPLETE [fdo#103927] / [fdo#109720]

  * igt@kms_busy@basic-flip-c:
    - fi-blb-e6850:       NOTRUN -> SKIP [fdo#109271] / [fdo#109278]

  * igt@kms_chamelium@dp-edid-read:
    - fi-icl-u2:          NOTRUN -> SKIP [fdo#109316] +2

  * igt@kms_chamelium@hdmi-edid-read:
    - fi-hsw-peppy:       NOTRUN -> SKIP [fdo#109271] +46
    - fi-icl-u3:          NOTRUN -> SKIP [fdo#109284] +8

  * igt@kms_chamelium@vga-hpd-fast:
    - fi-icl-u2:          NOTRUN -> SKIP [fdo#109309] +1

  * igt@kms_force_connector_basic@prune-stale-modes:
    - fi-icl-u2:          NOTRUN -> SKIP [fdo#109285] +3
    - fi-icl-u3:          NOTRUN -> SKIP [fdo#109285] +3

  * igt@kms_frontbuffer_tracking@basic:
    - fi-icl-u3:          NOTRUN -> FAIL [fdo#103167]
    - fi-hsw-peppy:       NOTRUN -> DMESG-FAIL [fdo#102614] / [fdo#107814]
    - fi-icl-u2:          NOTRUN -> FAIL [fdo#103167]

  * igt@kms_pipe_crc_basic@hang-read-crc-pipe-c:
    - fi-blb-e6850:       NOTRUN -> SKIP [fdo#109271] +48

  * igt@runner@aborted:
    - fi-apl-guc:         NOTRUN -> FAIL [fdo#108622] / [fdo#109720]

  
#### Possible fixes ####

  * igt@amdgpu/amd_basic@userptr:
    - fi-kbl-8809g:       DMESG-WARN [fdo#108965] -> PASS

  * igt@gem_exec_suspend@basic-s4-devices:
    - fi-blb-e6850:       INCOMPLETE [fdo#107718] -> PASS

  * igt@kms_pipe_crc_basic@read-crc-pipe-a-frame-sequence:
    - fi-byt-clapper:     FAIL [fdo#103191] / [fdo#107362] -> PASS

  
  [fdo#102614]: https://bugs.freedesktop.org/show_bug.cgi?id=102614
  [fdo#103167]: https://bugs.freedesktop.org/show_bug.cgi?id=103167
  [fdo#103191]: https://bugs.freedesktop.org/show_bug.cgi?id=103191
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#107362]: https://bugs.freedesktop.org/show_bug.cgi?id=107362
  [fdo#107718]: https://bugs.freedesktop.org/show_bug.cgi?id=107718
  [fdo#107814]: https://bugs.freedesktop.org/show_bug.cgi?id=107814
  [fdo#108094]: https://bugs.freedesktop.org/show_bug.cgi?id=108094
  [fdo#108569]: https://bugs.freedesktop.org/show_bug.cgi?id=108569
  [fdo#108622]: https://bugs.freedesktop.org/show_bug.cgi?id=108622
  [fdo#108965]: https://bugs.freedesktop.org/show_bug.cgi?id=108965
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109276]: https://bugs.freedesktop.org/show_bug.cgi?id=109276
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#109284]: https://bugs.freedesktop.org/show_bug.cgi?id=109284
  [fdo#109285]: https://bugs.freedesktop.org/show_bug.cgi?id=109285
  [fdo#109289]: https://bugs.freedesktop.org/show_bug.cgi?id=109289
  [fdo#109309]: https://bugs.freedesktop.org/show_bug.cgi?id=109309
  [fdo#109315]: https://bugs.freedesktop.org/show_bug.cgi?id=109315
  [fdo#109316]: https://bugs.freedesktop.org/show_bug.cgi?id=109316
  [fdo#109720]: https://bugs.freedesktop.org/show_bug.cgi?id=109720
  [fdo#110235 ]: https://bugs.freedesktop.org/show_bug.cgi?id=110235 


Participating hosts (48 -> 44)
------------------------------

  Additional (3): fi-hsw-peppy fi-icl-u2 fi-icl-u3 
  Missing    (7): fi-kbl-soraka fi-ilk-m540 fi-hsw-4200u fi-byt-squawks fi-bsw-cyan fi-ctg-p8600 fi-bdw-samus 


Build changes
-------------

    * IGT: IGT_4918 -> IGTPW_2756

  CI_DRM_5853: ec8a565441cb4b3edb41b085a26b892c22128585 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2756: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2756/
  IGT_4918: 1695d3fe15855259e6ed43b81a1142e7c572a001 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2756/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [igt-dev] ✓ Fi.CI.IGT: success for series starting with [i-g-t,1/3] lib: Add hooks for enabling ftrace
  2019-04-02  2:44 [igt-dev] [PATCH i-g-t 1/3] lib: Add hooks for enabling ftrace Ashutosh Dixit
                   ` (2 preceding siblings ...)
  2019-04-02  8:57 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib: Add hooks for enabling ftrace Patchwork
@ 2019-04-02 13:04 ` Patchwork
  3 siblings, 0 replies; 10+ messages in thread
From: Patchwork @ 2019-04-02 13:04 UTC (permalink / raw)
  To: Ashutosh Dixit; +Cc: igt-dev

== Series Details ==

Series: series starting with [i-g-t,1/3] lib: Add hooks for enabling ftrace
URL   : https://patchwork.freedesktop.org/series/58859/
State : success

== Summary ==

CI Bug Log - changes from CI_DRM_5853_full -> IGTPW_2756_full
====================================================

Summary
-------

  **SUCCESS**

  No regressions found.

  External URL: https://patchwork.freedesktop.org/api/1.0/series/58859/revisions/1/mbox/

Known issues
------------

  Here are the changes found in IGTPW_2756_full that come from known issues:

### IGT changes ###

#### Issues hit ####

  * igt@gem_eio@unwedge-stress:
    - shard-glk:          NOTRUN -> FAIL [fdo#105957]

  * igt@kms_atomic_transition@3x-modeset-transitions-nonblocking:
    - shard-kbl:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +3

  * igt@kms_busy@basic-flip-e:
    - shard-glk:          NOTRUN -> SKIP [fdo#109271] / [fdo#109278] +4

  * igt@kms_busy@extended-modeset-hang-newfb-render-a:
    - shard-kbl:          PASS -> DMESG-WARN [fdo#110222] +1

  * igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-a:
    - shard-snb:          PASS -> DMESG-WARN [fdo#110222]

  * igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-c:
    - shard-hsw:          PASS -> DMESG-WARN [fdo#110222] +1

  * igt@kms_busy@extended-pageflip-modeset-hang-oldfb-render-b:
    - shard-apl:          PASS -> DMESG-WARN [fdo#110222]

  * igt@kms_color@pipe-a-ctm-max:
    - shard-glk:          NOTRUN -> FAIL [fdo#108147]

  * igt@kms_cursor_crc@cursor-256x85-onscreen:
    - shard-glk:          PASS -> FAIL [fdo#103232]

  * igt@kms_cursor_crc@cursor-256x85-sliding:
    - shard-glk:          NOTRUN -> FAIL [fdo#103232]

  * igt@kms_cursor_crc@cursor-64x64-sliding:
    - shard-apl:          PASS -> FAIL [fdo#103232]

  * igt@kms_cursor_legacy@2x-long-cursor-vs-flip-legacy:
    - shard-hsw:          PASS -> FAIL [fdo#105767]

  * igt@kms_cursor_legacy@2x-long-flip-vs-cursor-legacy:
    - shard-apl:          NOTRUN -> SKIP [fdo#109271] +4

  * igt@kms_flip@flip-vs-suspend:
    - shard-hsw:          PASS -> INCOMPLETE [fdo#103540]

  * igt@kms_flip@flip-vs-suspend-interruptible:
    - shard-apl:          PASS -> DMESG-WARN [fdo#108566]

  * igt@kms_frontbuffer_tracking@fbcpsr-suspend:
    - shard-glk:          NOTRUN -> SKIP [fdo#109271] +28

  * igt@kms_frontbuffer_tracking@psr-farfromfence:
    - shard-kbl:          NOTRUN -> SKIP [fdo#109271] +26

  * igt@kms_plane_scaling@pipe-a-scaler-with-clipping-clamping:
    - shard-glk:          PASS -> SKIP [fdo#109271] / [fdo#109278]

  * igt@kms_vblank@pipe-b-ts-continuation-dpms-rpm:
    - shard-apl:          PASS -> FAIL [fdo#104894] +1
    - shard-kbl:          PASS -> FAIL [fdo#104894]

  
#### Possible fixes ####

  * igt@kms_atomic_transition@plane-all-modeset-transition-fencing:
    - shard-apl:          INCOMPLETE [fdo#103927] -> PASS
    - shard-kbl:          INCOMPLETE [fdo#103665] -> PASS +1

  * igt@kms_busy@extended-modeset-hang-newfb-render-b:
    - shard-hsw:          DMESG-WARN [fdo#110222] -> PASS

  * igt@kms_busy@extended-modeset-hang-newfb-with-reset-render-c:
    - shard-kbl:          DMESG-WARN [fdo#110222] -> PASS

  * igt@kms_cursor_crc@cursor-128x128-suspend:
    - shard-glk:          FAIL [fdo#103232] -> PASS +1

  * igt@kms_cursor_crc@cursor-64x64-dpms:
    - shard-kbl:          FAIL [fdo#103232] -> PASS
    - shard-apl:          FAIL [fdo#103232] -> PASS

  * igt@kms_plane_scaling@pipe-b-scaler-with-rotation:
    - shard-glk:          SKIP [fdo#109271] / [fdo#109278] -> PASS

  * igt@kms_vblank@pipe-a-ts-continuation-dpms-rpm:
    - shard-kbl:          FAIL [fdo#104894] -> PASS +1

  * igt@kms_vblank@pipe-c-ts-continuation-suspend:
    - shard-apl:          FAIL [fdo#104894] -> PASS

  
  [fdo#103232]: https://bugs.freedesktop.org/show_bug.cgi?id=103232
  [fdo#103540]: https://bugs.freedesktop.org/show_bug.cgi?id=103540
  [fdo#103665]: https://bugs.freedesktop.org/show_bug.cgi?id=103665
  [fdo#103927]: https://bugs.freedesktop.org/show_bug.cgi?id=103927
  [fdo#104894]: https://bugs.freedesktop.org/show_bug.cgi?id=104894
  [fdo#105767]: https://bugs.freedesktop.org/show_bug.cgi?id=105767
  [fdo#105957]: https://bugs.freedesktop.org/show_bug.cgi?id=105957
  [fdo#108147]: https://bugs.freedesktop.org/show_bug.cgi?id=108147
  [fdo#108566]: https://bugs.freedesktop.org/show_bug.cgi?id=108566
  [fdo#109271]: https://bugs.freedesktop.org/show_bug.cgi?id=109271
  [fdo#109278]: https://bugs.freedesktop.org/show_bug.cgi?id=109278
  [fdo#110222]: https://bugs.freedesktop.org/show_bug.cgi?id=110222


Participating hosts (10 -> 5)
------------------------------

  Missing    (5): shard-skl pig-hsw-4770r pig-glk-j5005 shard-iclb pig-skl-6260u 


Build changes
-------------

    * IGT: IGT_4918 -> IGTPW_2756
    * Piglit: piglit_4509 -> None

  CI_DRM_5853: ec8a565441cb4b3edb41b085a26b892c22128585 @ git://anongit.freedesktop.org/gfx-ci/linux
  IGTPW_2756: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2756/
  IGT_4918: 1695d3fe15855259e6ed43b81a1142e7c572a001 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
  piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/IGTPW_2756/
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 3/3] lib: Enable extra kernel logs for audio debug
  2019-04-02  2:44 ` [igt-dev] [PATCH i-g-t 3/3] lib: Enable extra kernel logs for audio debug Ashutosh Dixit
  2019-04-02  6:39   ` Jani Nikula
@ 2019-04-09  2:40   ` Ashutosh Dixit
  1 sibling, 0 replies; 10+ messages in thread
From: Ashutosh Dixit @ 2019-04-09  2:40 UTC (permalink / raw)
  To: igt-dev; +Cc: Lakshminarayana Vudum

On Mon, 01 Apr 2019 19:44:21 -0700, Ashutosh Dixit wrote:
>
> For debug of audio issues in power management and driver reload tests,
> additional kernel logs may be useful, both in dmesg as well as
> ftrace. Add the infrastructure to generate these logs and enable these
> logs for selected tests.
>
> At present igt_runner and other CI infrastructure does not capture the
> ftrace buffer. Therefore, to avoid changes to igt_runner and the CI
> infrastructure the ftrace buffer is dumped to stdout at the end of
> each test.
>
> v4: remove system() calls, dump audio kernel logs from igt_fixture
> v2, v3: versions to fix CI
>
> Cc: Jani Nikula <jani.nikula@linux.intel.com>
> Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>

Are there any further review comments on these 3 patches?  If not,
can they get a Reviewed-by? Thanks.
--
Ashutosh
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/3] lib: Add more debugfs and ftrace helpers
  2019-04-02  2:44 ` [igt-dev] [PATCH i-g-t 2/3] lib: Add more debugfs and ftrace helpers Ashutosh Dixit
@ 2019-04-09  8:21   ` Chris Wilson
  2019-04-11  4:41     ` Ashutosh Dixit
  0 siblings, 1 reply; 10+ messages in thread
From: Chris Wilson @ 2019-04-09  8:21 UTC (permalink / raw)
  To: Ashutosh Dixit, igt-dev

Quoting Ashutosh Dixit (2019-04-02 03:44:20)
> +/* Implement 'echo 0/1 > <debugfs>/tracing/str[i]' */
> +int igt_ftrace_set_events(const char **str, int nstr, bool enable)
> +{
> +       int i, ret, err = 0;
> +
> +       if (igt_ftrace.dir < 0)
> +               return -ENODEV;
> +
> +       for (i = 0; i < nstr; i++) {
> +               ret = igt_sysfs_set(igt_ftrace.dir, str[i],
> +                                   enable ? "1\n" : "0\n");
> +               if (ret)
> +                       err = ret;
> +       }

Why didn't you extend the set of options passed to enable? Do we want to
be adjusting these as the test runs, or should it be setup once for the
test?
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [igt-dev] [PATCH i-g-t 2/3] lib: Add more debugfs and ftrace helpers
  2019-04-09  8:21   ` Chris Wilson
@ 2019-04-11  4:41     ` Ashutosh Dixit
  0 siblings, 0 replies; 10+ messages in thread
From: Ashutosh Dixit @ 2019-04-11  4:41 UTC (permalink / raw)
  To: Chris Wilson; +Cc: igt-dev, Lakshminarayana Vudum

On Tue, 09 Apr 2019 01:21:03 -0700, Chris Wilson wrote:
>
> Quoting Ashutosh Dixit (2019-04-02 03:44:20)
> > +/* Implement 'echo 0/1 > <debugfs>/tracing/str[i]' */
> > +int igt_ftrace_set_events(const char **str, int nstr, bool enable)
> > +{
> > +       int i, ret, err = 0;
> > +
> > +       if (igt_ftrace.dir < 0)
> > +               return -ENODEV;
> > +
> > +       for (i = 0; i < nstr; i++) {
> > +               ret = igt_sysfs_set(igt_ftrace.dir, str[i],
> > +                                   enable ? "1\n" : "0\n");
> > +               if (ret)
> > +                       err = ret;
> > +       }
>
> Why didn't you extend the set of options passed to enable?

Hi Chris, which particular options are you referring to? (This function is
enabling ftrace events according to the method in Section 2.2,
Documentation/trace/events.rst. Please see Patch 3/3 for how this function
is used). Some options are enabled in __igt_ftrace_enable() in Patch 1/3
(your patch).

> Do we want to be adjusting these as the test runs, or should it be setup
> once for the test?

Again please see Patch 3/3, the options are set up in igt_fixture once for
the test. Thanks.
--
Ashutosh
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [igt-dev] [PATCH i-g-t 2/3] lib: Add more debugfs and ftrace helpers
  2019-04-03  0:45 [igt-dev] [PATCH i-g-t 1/3] " Ashutosh Dixit
@ 2019-04-03  0:45 ` Ashutosh Dixit
  0 siblings, 0 replies; 10+ messages in thread
From: Ashutosh Dixit @ 2019-04-03  0:45 UTC (permalink / raw)
  To: igt-dev

Add functions to:
* enable/disable dynamic debug using <debugfs>/dynamic_debug/control
* set ftrace events for the nop tracer
* clear the ftrace buffer

Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 lib/igt_debugfs.c | 24 ++++++++++++++++++++++++
 lib/igt_debugfs.h |  1 +
 lib/igt_ftrace.c  | 39 ++++++++++++++++++++++++++++++++++++---
 lib/igt_ftrace.h  |  4 ++++
 4 files changed, 65 insertions(+), 3 deletions(-)

diff --git a/lib/igt_debugfs.c b/lib/igt_debugfs.c
index dd229c09..cf08a0a3 100644
--- a/lib/igt_debugfs.c
+++ b/lib/igt_debugfs.c
@@ -367,6 +367,30 @@ bool igt_debugfs_search(int device, const char *filename, const char *substring)
 	return matched;
 }
 
+/* Echo array of strings into <debugfs>/dynamic_debug/control */
+int igt_set_dynamic_debug(const char **str, int nstr)
+{
+	int debugfs, dyn, err, i;
+
+	debugfs = open(igt_debugfs_mount(), O_RDONLY);
+	if (debugfs < 0)
+		return -errno;
+
+	dyn = openat(debugfs, "dynamic_debug", O_RDONLY);
+	close(debugfs);
+	if (dyn < 0)
+		return -errno;
+
+	for (i = 0; i < nstr; i++) {
+		err = igt_sysfs_set(dyn, "control", str[i]);
+		if (err < 0)
+			return -errno;
+	}
+
+	close(dyn);
+	return 0;
+}
+
 /*
  * Pipe CRC
  */
diff --git a/lib/igt_debugfs.h b/lib/igt_debugfs.h
index f8e57a6b..74bfae5b 100644
--- a/lib/igt_debugfs.h
+++ b/lib/igt_debugfs.h
@@ -41,6 +41,7 @@ int igt_debugfs_open(int fd, const char *filename, int mode);
 void __igt_debugfs_read(int fd, const char *filename, char *buf, int size);
 int igt_debugfs_simple_read(int dir, const char *filename, char *buf, int size);
 bool igt_debugfs_search(int fd, const char *filename, const char *substring);
+int igt_set_dynamic_debug(const char **str, int nstr);
 
 /**
  * igt_debugfs_read:
diff --git a/lib/igt_ftrace.c b/lib/igt_ftrace.c
index 43f396d6..1f02e1da 100644
--- a/lib/igt_ftrace.c
+++ b/lib/igt_ftrace.c
@@ -139,7 +139,7 @@ int __igt_ftrace_enable(const char *mode,
 		igt_ftrace.flags |= EXCLUDE_SET;
 	}
 
-	err = igt_sysfs_set(igt_ftrace.dir, "tracer_on", "1");
+	err = igt_sysfs_set(igt_ftrace.dir, "tracing_on", "1");
 	if (err < 0)
 		return err;
 
@@ -157,7 +157,7 @@ int igt_ftrace_disable(void)
 	if (igt_ftrace.dir < 0)
 		return -ENODEV;
 
-	err = igt_sysfs_set(igt_ftrace.dir, "tracer_on", "0");
+	err = igt_sysfs_set(igt_ftrace.dir, "tracing_on", "0");
 	if (err < 0)
 		return err;
 
@@ -179,6 +179,24 @@ int igt_ftrace_disable(void)
 	return 0;
 }
 
+/* Implement 'echo 0/1 > <debugfs>/tracing/str[i]' */
+int igt_ftrace_set_events(const char **str, int nstr, bool enable)
+{
+	int i, ret, err = 0;
+
+	if (igt_ftrace.dir < 0)
+		return -ENODEV;
+
+	for (i = 0; i < nstr; i++) {
+		ret = igt_sysfs_set(igt_ftrace.dir, str[i],
+				    enable ? "1\n" : "0\n");
+		if (ret)
+			err = ret;
+	}
+
+	return err;
+}
+
 void igt_ftrace_dump(const char *header)
 {
 	char *txt;
@@ -190,10 +208,25 @@ void igt_ftrace_dump(const char *header)
 	if (!txt)
 		return;
 
-	igt_info("%s:\n%s", header, txt);
+	igt_info("%s:\n%s\n", header, txt);
 	free(txt);
 }
 
+/* Implement the equivalent of 'echo > <debugfs>/tracing/trace' */
+int igt_ftrace_clear(void)
+{
+	int fd;
+
+	if (igt_ftrace.dir < 0)
+		return -ENODEV;
+
+	fd = openat(igt_ftrace.dir, "trace", O_WRONLY | O_TRUNC);
+	if (fd < 0)
+		return -errno;
+	close(fd);
+	return 0;
+}
+
 void igt_ftrace_close(void)
 {
 	if (igt_ftrace.dir < 0)
diff --git a/lib/igt_ftrace.h b/lib/igt_ftrace.h
index 9aceeca9..6f4225ee 100644
--- a/lib/igt_ftrace.h
+++ b/lib/igt_ftrace.h
@@ -39,8 +39,12 @@ int __igt_ftrace_enable(const char *mode,
 
 int igt_ftrace_disable(void);
 
+int igt_ftrace_set_events(const char **str, int nstr, bool enable);
+
 void igt_ftrace_dump(const char *header);
 
+int igt_ftrace_clear(void);
+
 void igt_ftrace_close(void);
 
 #endif /* IGT_FTRACE_H */
-- 
2.21.0

_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-04-11  4:41 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-02  2:44 [igt-dev] [PATCH i-g-t 1/3] lib: Add hooks for enabling ftrace Ashutosh Dixit
2019-04-02  2:44 ` [igt-dev] [PATCH i-g-t 2/3] lib: Add more debugfs and ftrace helpers Ashutosh Dixit
2019-04-09  8:21   ` Chris Wilson
2019-04-11  4:41     ` Ashutosh Dixit
2019-04-02  2:44 ` [igt-dev] [PATCH i-g-t 3/3] lib: Enable extra kernel logs for audio debug Ashutosh Dixit
2019-04-02  6:39   ` Jani Nikula
2019-04-09  2:40   ` Ashutosh Dixit
2019-04-02  8:57 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/3] lib: Add hooks for enabling ftrace Patchwork
2019-04-02 13:04 ` [igt-dev] ✓ Fi.CI.IGT: " Patchwork
2019-04-03  0:45 [igt-dev] [PATCH i-g-t 1/3] " Ashutosh Dixit
2019-04-03  0:45 ` [igt-dev] [PATCH i-g-t 2/3] lib: Add more debugfs and ftrace helpers Ashutosh Dixit

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.