Skip to contentSkip to conversation

drm/i915: Add module param to test the load detect code

PATCH In review Daniel Vetter 6 participants 10 messages Mar 3, 2015 – Mar 27, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Add module param to test the load detect code

This is useful for writing igts to make sure we don't break this, without being forced to own a one of these dinosaurs.

---
 drivers/gpu/drm/i915/i915_drv.h    | 1 +
 drivers/gpu/drm/i915/i915_params.c | 8 +++++++-
 drivers/gpu/drm/i915/intel_crt.c   | 6 ++++--
 3 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index e07a1cb5db67..878b16ed61b3 100644
@@ -2429,6 +2429,7 @@ struct i915_params {
 	bool enable_hangcheck;
 	bool fastboot;
 	bool prefault_disable;
+	bool load_detect_test;
 	bool reset;
 	bool disable_display;
 	bool disable_vtd_wa;
drivers/gpu/drm/i915/i915_params.c +7 -1
index 44f2262a5553..9f7f9a644c45 100644
@@ -44,6 +44,7 @@ struct i915_params i915 __read_mostly = {
 	.enable_ips = 1,
 	.fastboot = 0,
 	.prefault_disable = 0,
+	.load_detect_test = 0,
 	.reset = true,
 	.invert_brightness = 0,
 	.disable_display = 0,
@@ -144,11 +145,16 @@ module_param_named(fastboot, i915.fastboot, bool, 0600);
 MODULE_PARM_DESC(fastboot,
 	"Try to skip unnecessary mode sets at boot time (default: false)");
 
-module_param_named(prefault_disable, i915.prefault_disable, bool, 0600);
+module_param_named_unsafe(prefault_disable, i915.prefault_disable, bool, 0600);
 MODULE_PARM_DESC(prefault_disable,
 	"Disable page prefaulting for pread/pwrite/reloc (default:false). "
 	"For developers only.");
 
+module_param_named_unsafe(load_detect_test, i915.load_detect_test, bool, 0600);
+MODULE_PARM_DESC(load_detect_test,
+	"Force-enable the VGA load detect code for testing (default:false). "
+	"For developers only.");
+
 module_param_named(invert_brightness, i915.invert_brightness, int, 0600);
 MODULE_PARM_DESC(invert_brightness,
 	"Invert backlight brightness "
drivers/gpu/drm/i915/intel_crt.c +4 -2
index e66e17af0a56..b3421ac0be57 100644
@@ -690,7 +690,7 @@ intel_crt_detect(struct drm_connector *connector, bool force)
 	 * broken monitor (without edid) to work behind a broken kvm (that fails
 	 * to have the right resistors for HP detection) needs to fix this up.
 	 * For now just bail out. */
-	if (I915_HAS_HOTPLUG(dev)) {
+	if (I915_HAS_HOTPLUG(dev) && !i915.load_detect_test) {
 		status = connector_status_disconnected;
 		goto out;
 	}
@@ -706,8 +706,10 @@ intel_crt_detect(struct drm_connector *connector, bool force)
 	if (intel_get_load_detect_pipe(connector, NULL, &tmp, &ctx)) {
 		if (intel_crt_detect_ddc(connector))
 			status = connector_status_connected;
-		else
+		else if (INTEL_INFO(dev)->gen < 4)
 			status = intel_crt_load_detect(crt);
+		else
+			status = connector_status_unknown;
 		intel_release_load_detect_pipe(connector, &tmp);
 	} else
 		status = connector_status_unknown;
Signature · 6 lines
2.1.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Daniel Vetter

This is useful for writing igts to make sure we don't break this, without being forced to own a one of these dinosaurs.

---
 drivers/gpu/drm/i915/i915_drv.h    | 1 +
 drivers/gpu/drm/i915/i915_params.c | 8 +++++++-
 drivers/gpu/drm/i915/intel_crt.c   | 6 ++++--
 3 files changed, 12 insertions(+), 3 deletions(-)

See below for comments.

I think there's probably even more room for testing like this. E.g. the tiled swapping test could be done this way rather than trying to force swapping. Some of the races we try to induce could probably also be done this way with code in the kernel to trigger the case we're worried about...

Quoted 48 lines
drivers/gpu/drm/i915/i915_drv.h +1 -0
index e07a1cb5db67..878b16ed61b3 100644
@@ -2429,6 +2429,7 @@ struct i915_params {
 	bool enable_hangcheck;
 	bool fastboot;
 	bool prefault_disable;
+	bool load_detect_test;
 	bool reset;
 	bool disable_display;
 	bool disable_vtd_wa;
drivers/gpu/drm/i915/i915_params.c +7 -1
index 44f2262a5553..9f7f9a644c45 100644
@@ -44,6 +44,7 @@ struct i915_params i915 __read_mostly = {
 	.enable_ips = 1,
 	.fastboot = 0,
 	.prefault_disable = 0,
+	.load_detect_test = 0,
 	.reset = true,
 	.invert_brightness = 0,
 	.disable_display = 0,
@@ -144,11 +145,16 @@ module_param_named(fastboot, i915.fastboot, bool, 0600);
 MODULE_PARM_DESC(fastboot,
 	"Try to skip unnecessary mode sets at boot time (default: false)");
 
-module_param_named(prefault_disable, i915.prefault_disable, bool, 0600);
+module_param_named_unsafe(prefault_disable, i915.prefault_disable, bool, 0600);
 MODULE_PARM_DESC(prefault_disable,
 	"Disable page prefaulting for pread/pwrite/reloc (default:false). "
 	"For developers only.");
 
+module_param_named_unsafe(load_detect_test, i915.load_detect_test, bool, 0600);
+MODULE_PARM_DESC(load_detect_test,
+	"Force-enable the VGA load detect code for testing (default:false). "
+	"For developers only.");
+
 module_param_named(invert_brightness, i915.invert_brightness, int, 0600);
 MODULE_PARM_DESC(invert_brightness,
 	"Invert backlight brightness "
drivers/gpu/drm/i915/intel_crt.c +0 -0
index e66e17af0a56..b3421ac0be57 100644

drivers/gpu/drm/i915/intel_crt.c intel_crt_detect(struct drm_connector *connector, bool force) · line 696

Quoted 8 lines
drivers/gpu/drm/i915/intel_crt.c +1 -1
@@ -690,7 +690,7 @@ intel_crt_detect(struct drm_connector *connector, bool force)
 	 * broken monitor (without edid) to work behind a broken kvm (that fails
 	 * to have the right resistors for HP detection) needs to fix this up.
 	 * For now just bail out. */
-	if (I915_HAS_HOTPLUG(dev)) {
+	if (I915_HAS_HOTPLUG(dev) && !i915.load_detect_test) {
 		status = connector_status_disconnected;
 		goto out;
 	}

Looks fine up to here.

drivers/gpu/drm/i915/intel_crt.c intel_crt_detect(struct drm_connector *connector, bool force) · line 712

Quoted 9 lines
drivers/gpu/drm/i915/intel_crt.c +3 -1
@@ -706,8 +706,10 @@ intel_crt_detect(struct drm_connector *connector, bool force)
 	if (intel_get_load_detect_pipe(connector, NULL, &tmp, &ctx)) {
 		if (intel_crt_detect_ddc(connector))
 			status = connector_status_connected;
-		else
+		else if (INTEL_INFO(dev)->gen < 4)
 			status = intel_crt_load_detect(crt);
+		else
+			status = connector_status_unknown;

This is a subtle change though... Previously we'd try a ddc read followed by a load detect if that failed. With this, we'll only fallb ack to load detect on pre-gen4. Are you just trying to avoid using the load detect code with the load_detect_test flag set, preferring only DDC in that case?

Otherwise,

Thanks,
Jesse
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#2 lore raw
Quoted 13 lines · Jesse Barnes
Quoted 11 lines · Daniel Vetter

This is useful for writing igts to make sure we don't break this, without being forced to own a one of these dinosaurs.

---
 drivers/gpu/drm/i915/i915_drv.h    | 1 +
 drivers/gpu/drm/i915/i915_params.c | 8 +++++++-
 drivers/gpu/drm/i915/intel_crt.c   | 6 ++++--
 3 files changed, 12 insertions(+), 3 deletions(-)
Quoted 7 lines

See below for comments.

I think there's probably even more room for testing like this. E.g. the tiled swapping test could be done this way rather than trying to force swapping. Some of the races we try to induce could probably also be done this way with code in the kernel to trigger the case we're worried about...

I am not wholly convinced. The primary purpose of the test suite is prevent bugs of tomorrow, not to chase bugs of yesterday. If we focus too much on bugs we have fixed, I worry we won't serendipitously detect bugs early. Yes, bugs cluster and a mistake once made is likely to be made again (so regression testing is vital) but I think we cross a line if igt only exercises code written for conformance testing.

Yes to fault injection and the like. No to special conformance paths.

My 2p,
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#3 lore raw
Quoted 22 lines · Chris Wilson
Quoted 13 lines · Jesse Barnes
Quoted 11 lines · Daniel Vetter

This is useful for writing igts to make sure we don't break this, without being forced to own a one of these dinosaurs.

---
 drivers/gpu/drm/i915/i915_drv.h    | 1 +
 drivers/gpu/drm/i915/i915_params.c | 8 +++++++-
 drivers/gpu/drm/i915/intel_crt.c   | 6 ++++--
 3 files changed, 12 insertions(+), 3 deletions(-)
Quoted 7 lines

See below for comments.

I think there's probably even more room for testing like this. E.g. the tiled swapping test could be done this way rather than trying to force swapping. Some of the races we try to induce could probably also be done this way with code in the kernel to trigger the case we're worried about...

Quoted 6 lines

I am not wholly convinced. The primary purpose of the test suite is prevent bugs of tomorrow, not to chase bugs of yesterday. If we focus too much on bugs we have fixed, I worry we won't serendipitously detect bugs early. Yes, bugs cluster and a mistake once made is likely to be made again (so regression testing is vital) but I think we cross a line if igt only exercises code written for conformance testing.

Also swapping tests are a solved problem really, we've had an "mlock most of mem" todo since years and Thomas Wood is implementing it. Well it's committed for gem_tiled_swapping already

commit 42b02c284ed24871528df8f1b3eaad7fe1554fd9

Author: Thomas Wood <[email protected]>
Date:   Mon Dec 8 11:12:51 2014 +0000

lib: add a function to lock memory into RAM

what's missing is rolling this out for other tests.

Now I love igt bashing as much as the next person, but maybe check occasionally whether your rant-du-jour is still relevant ... -Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#4 lore raw
Quoted 38 lines · Daniel Vetter
Quoted 22 lines · Chris Wilson
Quoted 13 lines · Jesse Barnes
Quoted 11 lines · Daniel Vetter

This is useful for writing igts to make sure we don't break this, without being forced to own a one of these dinosaurs.

---
 drivers/gpu/drm/i915/i915_drv.h    | 1 +
 drivers/gpu/drm/i915/i915_params.c | 8 +++++++-
 drivers/gpu/drm/i915/intel_crt.c   | 6 ++++--
 3 files changed, 12 insertions(+), 3 deletions(-)
Quoted 7 lines

See below for comments.

I think there's probably even more room for testing like this. E.g. the tiled swapping test could be done this way rather than trying to force swapping. Some of the races we try to induce could probably also be done this way with code in the kernel to trigger the case we're worried about...

Quoted 6 lines

I am not wholly convinced. The primary purpose of the test suite is prevent bugs of tomorrow, not to chase bugs of yesterday. If we focus too much on bugs we have fixed, I worry we won't serendipitously detect bugs early. Yes, bugs cluster and a mistake once made is likely to be made again (so regression testing is vital) but I think we cross a line if igt only exercises code written for conformance testing.

Also swapping tests are a solved problem really, we've had an "mlock most of mem" todo since years and Thomas Wood is implementing it. Well it's committed for gem_tiled_swapping already

commit 42b02c284ed24871528df8f1b3eaad7fe1554fd9

Author: Thomas Wood <[email protected]>
Date:   Mon Dec 8 11:12:51 2014 +0000
Quoted 6 lines

lib: add a function to lock memory into RAM

what's missing is rolling this out for other tests.

Now I love igt bashing as much as the next person, but maybe check occasionally whether your rant-du-jour is still relevant ...

My "rant du jour" still is. mlock() is a good solution for some things, but for the simple task of testing kernel swap out code, just running that code is the most straightforward thing to do, rather than trying to contort into it from userspace.

Jesse

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
Quoted 4 lines · Jesse Barnes

My "rant du jour" still is. mlock() is a good solution for some things, but for the simple task of testing kernel swap out code, just running that code is the most straightforward thing to do, rather than trying to contort into it from userspace.

Once upon a time, there was a minor request for MADV_POPULATE and MADV_INVALIDATE (basically wrappers around get_pages() and put_pages()) which would give you the fuzzy feeling of testing those paths without actually testing the shrinker. But no use cases.
-Chris

Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#6 lore raw
Quoted 10 lines · Chris Wilson
Quoted 4 lines · Jesse Barnes

My "rant du jour" still is. mlock() is a good solution for some things, but for the simple task of testing kernel swap out code, just running that code is the most straightforward thing to do, rather than trying to contort into it from userspace.

Once upon a time, there was a minor request for MADV_POPULATE and MADV_INVALIDATE (basically wrappers around get_pages() and put_pages()) which would give you the fuzzy feeling of testing those paths without actually testing the shrinker. But no use cases.

Yeah, that sounds cool, but otoh adding stable ABI just for debug is a little scary...

Jesse

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#7 lore raw
In reply to Jesse Barnes
Quoted 43 lines · Jesse Barnes
Quoted 42 lines · Daniel Vetter
Quoted 22 lines · Chris Wilson
Quoted 13 lines · Jesse Barnes
Quoted 11 lines · Daniel Vetter

This is useful for writing igts to make sure we don't break this, without being forced to own a one of these dinosaurs.

---
 drivers/gpu/drm/i915/i915_drv.h    | 1 +
 drivers/gpu/drm/i915/i915_params.c | 8 +++++++-
 drivers/gpu/drm/i915/intel_crt.c   | 6 ++++--
 3 files changed, 12 insertions(+), 3 deletions(-)
Quoted 7 lines

See below for comments.

I think there's probably even more room for testing like this. E.g. the tiled swapping test could be done this way rather than trying to force swapping. Some of the races we try to induce could probably also be done this way with code in the kernel to trigger the case we're worried about...

Quoted 6 lines

I am not wholly convinced. The primary purpose of the test suite is prevent bugs of tomorrow, not to chase bugs of yesterday. If we focus too much on bugs we have fixed, I worry we won't serendipitously detect bugs early. Yes, bugs cluster and a mistake once made is likely to be made again (so regression testing is vital) but I think we cross a line if igt only exercises code written for conformance testing.

Also swapping tests are a solved problem really, we've had an "mlock most of mem" todo since years and Thomas Wood is implementing it. Well it's committed for gem_tiled_swapping already

commit 42b02c284ed24871528df8f1b3eaad7fe1554fd9

Author: Thomas Wood <[email protected]>
Date:   Mon Dec 8 11:12:51 2014 +0000

lib: add a function to lock memory into RAM

what's missing is rolling this out for other tests.

Quoted 7 lines
Quoted 2 lines

Now I love igt bashing as much as the next person, but maybe check occasionally whether your rant-du-jour is still relevant ...

My "rant du jour" still is. mlock() is a good solution for some things, but for the simple task of testing kernel swap out code, just running that code is the most straightforward thing to do, rather than trying to contort into it from userspace.

swap-out/in isn't really simple. We could extract the bit 17 swizzling logic into a separate bit with everything else mock-ups, but that's just testing our sw implementation against our sw model. Not that useful imo, and like Chris I'm not convinced of the value of lots of such special-case code.

On top of that bit17 swizzling is but a facet of swap-in/out support. Active tracking, page dirtying and all that also need to work correctly. I don't see how you can test that in a simple fashion.
-Daniel

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Tested-by on v1 1/1
#8 lore raw
In reply to Daniel Vetter

Task id: 5880 -------------------------------------Summary-------------------------------------
Platform Delta drm-intel-nightly Series Applied
PNV -2 278/278 276/278

ILK                                  308/308              308/308
SNB                                  284/284              284/284
IVB                                  380/380              380/380
BYT                                  294/294              294/294
HSW                                  387/387              387/387
BDW                 -1              316/316              315/316
-------------------------------------Detailed-------------------------------------
Platform  Test                                drm-intel-nightly          Series Applied
 PNV  igt_gem_userptr_blits_coherency-sync      NO_RESULT(1)CRASH(8)NRUN(1)PASS(8)      CRASH(1)PASS(1)
 PNV  igt_gem_userptr_blits_coherency-unsync      FAIL(1)NO_RESULT(1)CRASH(6)PASS(7)      CRASH(1)PASS(1)
*BDW  igt_gem_gtt_hog      PASS(19)      DMESG_WARN(1)PASS(1)

Note: You need to pay more attention to line start with '*'
_______________________________________________
Intel-gfx mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reviewed-by on v1 1/1
#9 lore raw
In reply to Daniel Vetter
Quoted 69 lines · Daniel Vetter

This is useful for writing igts to make sure we don't break this, without being forced to own a one of these dinosaurs.

---
 drivers/gpu/drm/i915/i915_drv.h    | 1 +
 drivers/gpu/drm/i915/i915_params.c | 8 +++++++-
 drivers/gpu/drm/i915/intel_crt.c   | 6 ++++--
 3 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +1 -0
index e07a1cb5db67..878b16ed61b3 100644
@@ -2429,6 +2429,7 @@ struct i915_params {
 	bool enable_hangcheck;
 	bool fastboot;
 	bool prefault_disable;
+	bool load_detect_test;
 	bool reset;
 	bool disable_display;
 	bool disable_vtd_wa;
drivers/gpu/drm/i915/i915_params.c +7 -1
index 44f2262a5553..9f7f9a644c45 100644
@@ -44,6 +44,7 @@ struct i915_params i915 __read_mostly = {
 	.enable_ips = 1,
 	.fastboot = 0,
 	.prefault_disable = 0,
+	.load_detect_test = 0,
 	.reset = true,
 	.invert_brightness = 0,
 	.disable_display = 0,
@@ -144,11 +145,16 @@ module_param_named(fastboot, i915.fastboot, bool, 0600);
 MODULE_PARM_DESC(fastboot,
 	"Try to skip unnecessary mode sets at boot time (default: false)");
 
-module_param_named(prefault_disable, i915.prefault_disable, bool, 0600);
+module_param_named_unsafe(prefault_disable, i915.prefault_disable, bool, 0600);
 MODULE_PARM_DESC(prefault_disable,
 	"Disable page prefaulting for pread/pwrite/reloc (default:false). "
 	"For developers only.");
 
+module_param_named_unsafe(load_detect_test, i915.load_detect_test, bool, 0600);
+MODULE_PARM_DESC(load_detect_test,
+	"Force-enable the VGA load detect code for testing (default:false). "
+	"For developers only.");
+
 module_param_named(invert_brightness, i915.invert_brightness, int, 0600);
 MODULE_PARM_DESC(invert_brightness,
 	"Invert backlight brightness "
drivers/gpu/drm/i915/intel_crt.c +1 -1
index e66e17af0a56..b3421ac0be57 100644
@@ -690,7 +690,7 @@ intel_crt_detect(struct drm_connector *connector, bool force)
 	 * broken monitor (without edid) to work behind a broken kvm (that fails
 	 * to have the right resistors for HP detection) needs to fix this up.
 	 * For now just bail out. */
-	if (I915_HAS_HOTPLUG(dev)) {
+	if (I915_HAS_HOTPLUG(dev) && !i915.load_detect_test) {
 		status = connector_status_disconnected;
 		goto out;
 	}
@@ -706,8 +706,10 @@ intel_crt_detect(struct drm_connector *connector, bool force)
 	if (intel_get_load_detect_pipe(connector, NULL, &tmp, &ctx)) {

drivers/gpu/drm/i915/intel_crt.c intel_crt_detect(struct drm_connector *connector, bool force) · line 715

Quoted 10 lines
drivers/gpu/drm/i915/intel_crt.c +3 -1
 		if (intel_crt_detect_ddc(connector))
 			status = connector_status_connected;
-		else
+		else if (INTEL_INFO(dev)->gen < 4)
 			status = intel_crt_load_detect(crt);
+		else
+			status = connector_status_unknown;
 		intel_release_load_detect_pipe(connector, &tmp);
 	} else
 		status = connector_status_unknown;

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx