public inbox for intel-gfx@lists.freedesktop.org
 help / color / mirror / Atom feed
* [PATCH igt] igt: Add a test to precheck status of kernel taints
@ 2017-08-11 12:46 Chris Wilson
  2017-08-11 13:15 ` ✓ Fi.CI.BAT: success for " Patchwork
  2017-08-11 13:15 ` [PATCH igt] " Jani Nikula
  0 siblings, 2 replies; 5+ messages in thread
From: Chris Wilson @ 2017-08-11 12:46 UTC (permalink / raw)
  To: intel-gfx

Many times an error may occur before the start of igt, leaving the
system in a less-than-optimal debugging state (e.g. an oops turning off
lockdep). Flag such occasions by checking /proc/sys/kernel/tainted.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 tests/Makefile.sources |  1 +
 tests/kernel_taint.c   | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 75 insertions(+)
 create mode 100644 tests/kernel_taint.c

diff --git a/tests/Makefile.sources b/tests/Makefile.sources
index 3352aad4..4dc89517 100644
--- a/tests/Makefile.sources
+++ b/tests/Makefile.sources
@@ -168,6 +168,7 @@ TESTS_progs = \
 	gen3_render_tiledy_blits \
 	gen7_forcewake_mt \
 	gvt_basic \
+	kernel_taint \
 	kms_3d \
 	kms_addfb_basic \
 	kms_atomic \
diff --git a/tests/kernel_taint.c b/tests/kernel_taint.c
new file mode 100644
index 00000000..7fd1f07a
--- /dev/null
+++ b/tests/kernel_taint.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2017 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 <unistd.h>
+#include <fcntl.h>
+
+#include "igt.h"
+#include "igt_sysfs.h"
+
+#define BIT(x) (1ul << (x))
+
+igt_simple_main
+{
+	unsigned long taint;
+	unsigned int errors = 0;
+	int dir;
+
+	dir = open("/proc/sys/kernel", O_RDONLY);
+	igt_require_f(dir != -1, "No /proc/sys/kernel found");
+	igt_require(igt_sysfs_scanf(dir, "tainted", "%lu", &taint) == 1);
+	close(dir);
+
+#define CHECK(bit, message, flags) do { \
+	if (taint & BIT(bit)) { \
+		if (flags & (WARN | ERROR)) { \
+			igt_warn("\t%08lx - " message "\n", BIT(bit)); \
+			errors += !!(flags & ERROR); \
+		} else { \
+			igt_info("\t%08lx - " message "\n", BIT(bit)); \
+		} \
+	} \
+} while (0)
+#define WARN BIT(0)
+#define ERROR BIT(1)
+
+	igt_info("Kernel taint: %08lx\n", taint);
+	CHECK(0, "Non-GPL module loaded", 0);
+	CHECK(1, "Forced module load", 0);
+	CHECK(2, "Unsafe SMP processor", 0);
+	CHECK(3, "Forced module unload", 0);
+	CHECK(4, "Machine Check Exception", WARN);
+	CHECK(5, "Bad page detected", ERROR);
+	CHECK(6, "Tained by user request", WARN);
+	CHECK(7, "System is on fire", ERROR);
+	CHECK(8, "ACPI DSDT has been overriden by user", 0);
+	CHECK(9, "OOPS", ERROR);
+	CHECK(10, "Staging driver loaded; are you mad?", 0);
+	CHECK(11, "Severe firmware bug workaround active", WARN);
+	CHECK(12, "Out-of-tree module loaded", 0);
+	CHECK(13, "Unsigned module loaded", 0);
+	CHECK(14, "Soft-lockup detected", WARN);
+	CHECK(15, "Kernel has been live patched", 0);
+	igt_assert_eq(errors, 0);
+}
-- 
2.13.3

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* ✓ Fi.CI.BAT: success for igt: Add a test to precheck status of kernel taints
  2017-08-11 12:46 [PATCH igt] igt: Add a test to precheck status of kernel taints Chris Wilson
@ 2017-08-11 13:15 ` Patchwork
  2017-08-11 13:15 ` [PATCH igt] " Jani Nikula
  1 sibling, 0 replies; 5+ messages in thread
From: Patchwork @ 2017-08-11 13:15 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: igt: Add a test to precheck status of kernel taints
URL   : https://patchwork.freedesktop.org/series/28683/
State : success

== Summary ==

IGT patchset tested on top of latest successful build
1385b31d9371fae02af2fd8adb0d9ea86a5bb0f2 tests/igt_command_line: Ignore subtest list for kms_ccs

with latest DRM-Tip kernel build CI_DRM_2948
fbb8288699ef drm-tip: 2017y-08m-11d-09h-03m-47s UTC integration manifest

Test kms_cursor_legacy:
        Subgroup basic-busy-flip-before-cursor-atomic:
                pass       -> FAIL       (fi-snb-2600) fdo#100215

fdo#100215 https://bugs.freedesktop.org/show_bug.cgi?id=100215

fi-bdw-5557u     total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:445s
fi-bdw-gvtdvm    total:279  pass:265  dwarn:0   dfail:0   fail:0   skip:14  time:435s
fi-blb-e6850     total:279  pass:224  dwarn:1   dfail:0   fail:0   skip:54  time:367s
fi-bsw-n3050     total:279  pass:243  dwarn:0   dfail:0   fail:0   skip:36  time:557s
fi-bxt-j4205     total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:510s
fi-byt-j1900     total:279  pass:254  dwarn:1   dfail:0   fail:0   skip:24  time:517s
fi-byt-n2820     total:279  pass:250  dwarn:1   dfail:0   fail:0   skip:28  time:507s
fi-glk-2a        total:279  pass:260  dwarn:0   dfail:0   fail:0   skip:19  time:606s
fi-hsw-4770      total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:442s
fi-hsw-4770r     total:279  pass:263  dwarn:0   dfail:0   fail:0   skip:16  time:414s
fi-ilk-650       total:279  pass:229  dwarn:0   dfail:0   fail:0   skip:50  time:422s
fi-ivb-3520m     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:508s
fi-ivb-3770      total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:483s
fi-kbl-7500u     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:468s
fi-kbl-7560u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:582s
fi-kbl-r         total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:591s
fi-pnv-d510      total:279  pass:223  dwarn:1   dfail:0   fail:0   skip:55  time:529s
fi-skl-6260u     total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:466s
fi-skl-6700k     total:279  pass:261  dwarn:0   dfail:0   fail:0   skip:18  time:482s
fi-skl-6770hq    total:279  pass:269  dwarn:0   dfail:0   fail:0   skip:10  time:490s
fi-skl-gvtdvm    total:279  pass:266  dwarn:0   dfail:0   fail:0   skip:13  time:441s
fi-skl-x1585l    total:279  pass:268  dwarn:0   dfail:0   fail:0   skip:11  time:476s
fi-snb-2520m     total:279  pass:251  dwarn:0   dfail:0   fail:0   skip:28  time:554s
fi-snb-2600      total:279  pass:249  dwarn:0   dfail:0   fail:1   skip:29  time:406s

== Logs ==

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

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

* Re: [PATCH igt] igt: Add a test to precheck status of kernel taints
  2017-08-11 12:46 [PATCH igt] igt: Add a test to precheck status of kernel taints Chris Wilson
  2017-08-11 13:15 ` ✓ Fi.CI.BAT: success for " Patchwork
@ 2017-08-11 13:15 ` Jani Nikula
  2017-08-11 13:17   ` Chris Wilson
  1 sibling, 1 reply; 5+ messages in thread
From: Jani Nikula @ 2017-08-11 13:15 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On Fri, 11 Aug 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Many times an error may occur before the start of igt, leaving the
> system in a less-than-optimal debugging state (e.g. an oops turning off
> lockdep). Flag such occasions by checking /proc/sys/kernel/tainted.

Hmm, which flag is set for unsafe module params?

BR,
Jani.


>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> ---
>  tests/Makefile.sources |  1 +
>  tests/kernel_taint.c   | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 75 insertions(+)
>  create mode 100644 tests/kernel_taint.c
>
> diff --git a/tests/Makefile.sources b/tests/Makefile.sources
> index 3352aad4..4dc89517 100644
> --- a/tests/Makefile.sources
> +++ b/tests/Makefile.sources
> @@ -168,6 +168,7 @@ TESTS_progs = \
>  	gen3_render_tiledy_blits \
>  	gen7_forcewake_mt \
>  	gvt_basic \
> +	kernel_taint \
>  	kms_3d \
>  	kms_addfb_basic \
>  	kms_atomic \
> diff --git a/tests/kernel_taint.c b/tests/kernel_taint.c
> new file mode 100644
> index 00000000..7fd1f07a
> --- /dev/null
> +++ b/tests/kernel_taint.c
> @@ -0,0 +1,74 @@
> +/*
> + * Copyright 2017 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 <unistd.h>
> +#include <fcntl.h>
> +
> +#include "igt.h"
> +#include "igt_sysfs.h"
> +
> +#define BIT(x) (1ul << (x))
> +
> +igt_simple_main
> +{
> +	unsigned long taint;
> +	unsigned int errors = 0;
> +	int dir;
> +
> +	dir = open("/proc/sys/kernel", O_RDONLY);
> +	igt_require_f(dir != -1, "No /proc/sys/kernel found");
> +	igt_require(igt_sysfs_scanf(dir, "tainted", "%lu", &taint) == 1);
> +	close(dir);
> +
> +#define CHECK(bit, message, flags) do { \
> +	if (taint & BIT(bit)) { \
> +		if (flags & (WARN | ERROR)) { \
> +			igt_warn("\t%08lx - " message "\n", BIT(bit)); \
> +			errors += !!(flags & ERROR); \
> +		} else { \
> +			igt_info("\t%08lx - " message "\n", BIT(bit)); \
> +		} \
> +	} \
> +} while (0)
> +#define WARN BIT(0)
> +#define ERROR BIT(1)
> +
> +	igt_info("Kernel taint: %08lx\n", taint);
> +	CHECK(0, "Non-GPL module loaded", 0);
> +	CHECK(1, "Forced module load", 0);
> +	CHECK(2, "Unsafe SMP processor", 0);
> +	CHECK(3, "Forced module unload", 0);
> +	CHECK(4, "Machine Check Exception", WARN);
> +	CHECK(5, "Bad page detected", ERROR);
> +	CHECK(6, "Tained by user request", WARN);
> +	CHECK(7, "System is on fire", ERROR);
> +	CHECK(8, "ACPI DSDT has been overriden by user", 0);
> +	CHECK(9, "OOPS", ERROR);
> +	CHECK(10, "Staging driver loaded; are you mad?", 0);
> +	CHECK(11, "Severe firmware bug workaround active", WARN);
> +	CHECK(12, "Out-of-tree module loaded", 0);
> +	CHECK(13, "Unsigned module loaded", 0);
> +	CHECK(14, "Soft-lockup detected", WARN);
> +	CHECK(15, "Kernel has been live patched", 0);
> +	igt_assert_eq(errors, 0);
> +}

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH igt] igt: Add a test to precheck status of kernel taints
  2017-08-11 13:15 ` [PATCH igt] " Jani Nikula
@ 2017-08-11 13:17   ` Chris Wilson
  2017-08-11 14:33     ` Jani Nikula
  0 siblings, 1 reply; 5+ messages in thread
From: Chris Wilson @ 2017-08-11 13:17 UTC (permalink / raw)
  To: Jani Nikula, intel-gfx

Quoting Jani Nikula (2017-08-11 14:15:50)
> On Fri, 11 Aug 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> > Many times an error may occur before the start of igt, leaving the
> > system in a less-than-optimal debugging state (e.g. an oops turning off
> > lockdep). Flag such occasions by checking /proc/sys/kernel/tainted.
> 
> Hmm, which flag is set for unsafe module params?

That is

	CHECK(6, "Tainted by user request", WARN);

I left it as WARN because imo we shouldn't be using those to drive
tests.
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [PATCH igt] igt: Add a test to precheck status of kernel taints
  2017-08-11 13:17   ` Chris Wilson
@ 2017-08-11 14:33     ` Jani Nikula
  0 siblings, 0 replies; 5+ messages in thread
From: Jani Nikula @ 2017-08-11 14:33 UTC (permalink / raw)
  To: Chris Wilson, intel-gfx

On Fri, 11 Aug 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Quoting Jani Nikula (2017-08-11 14:15:50)
>> On Fri, 11 Aug 2017, Chris Wilson <chris@chris-wilson.co.uk> wrote:
>> > Many times an error may occur before the start of igt, leaving the
>> > system in a less-than-optimal debugging state (e.g. an oops turning off
>> > lockdep). Flag such occasions by checking /proc/sys/kernel/tainted.
>> 
>> Hmm, which flag is set for unsafe module params?
>
> That is
>
> 	CHECK(6, "Tainted by user request", WARN);
>
> I left it as WARN because imo we shouldn't be using those to drive
> tests.

Agreed... but i915.alpha_support, i915.inject_load_failure, what else?

BR,
Jani.


-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-08-11 14:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-11 12:46 [PATCH igt] igt: Add a test to precheck status of kernel taints Chris Wilson
2017-08-11 13:15 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-08-11 13:15 ` [PATCH igt] " Jani Nikula
2017-08-11 13:17   ` Chris Wilson
2017-08-11 14:33     ` Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox