From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Weinehall Subject: Hibernation test Date: Wed, 11 Feb 2015 16:46:02 +0200 Message-ID: <54DB6B2A.3040503@intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050007080506000005070107" Return-path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 366D06E300 for ; Wed, 11 Feb 2015 06:46:43 -0800 (PST) List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: "intel-gf >> Intel Graphics Development" List-Id: intel-gfx@lists.freedesktop.org This is a multi-part message in MIME format. --------------050007080506000005070107 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format="flowed" Content-Transfer-Encoding: base64 aW50ZWwtZ3B1LXRvb2xzIGN1cnJlbnRseSBoYXMgYSBidW5jaCBvZiB0ZXN0cyBmb3Igc3VzcGVu ZCwKYnV0IGN1cnJlbnRseSBub25lICh0aGF0IEkgY291bGQgZmluZCkgZm9yIGhpYmVybmF0ZS4K CkF0dGFjaGVkIGlzIGEgcnVkaW1lbnRhcnkgcGF0Y2ggdG8gYWRkIHNhaWQgdGVzdC4gIEl0IGRv ZXMgc28KYnkgcmVwdXJwb3NpbmcgdGhlIGRydl9zdXNwZW5kIGRyaXZlciB0byBoYW5kbGUgYm90 aCBzdXNwZW5kCmFuZCBoaWJlcm5hdGUsIHNpbmNlIHRoZSBkaWZmZXJlbmNlIGlzIG1pbmlzY3Vs ZS4KCkkgZGVjaWRlZCB0byBzcGxpdCB0aGUgc3VzcGVuZC9hdXRvcmVzdW1lIGZ1bmN0aW9ucyBp bgppZ3RfYXV4LmMgdGhvdWdoLCB0byBiZSBhYmxlIHRvIGxlYXZlIHRoZSBpZ3Rfc3lzdGVtX3Vz cGVuZF9hdXRvcmVzdW1lKCkKZnVuY3Rpb24gdW5jaGFuZ2VkICh0aGUgb3RoZXI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GlzdHJpYnV0 aW9uCmJ5IG90aGVycyBpcyBzdHJpY3RseSBwcm9oaWJpdGVkLiBJZiB5b3UgYXJlIG5vdCB0aGUg aW50ZW5kZWQKcmVjaXBpZW50LCBwbGVhc2UgY29udGFjdCB0aGUgc2VuZGVyIGFuZCBkZWxldGUg YWxsIGNvcGllcy4K --------------050007080506000005070107 Content-Type: text/x-patch; name="igt-hib.patch" Content-Disposition: attachment; filename="igt-hib.patch" Content-Transfer-Encoding: quoted-printable diff --git a/lib/igt_aux.c b/lib/igt_aux.c index aefa0863e9e9..c39ccd86db63 100644 --- a/lib/igt_aux.c +++ b/lib/igt_aux.c @@ -1,5 +1,5 @@ /* - * Copyright =C2=A9 2007, 2011, 2013, 2014 Intel Corporation + * Copyright =C2=A9 2007, 2011, 2013, 2014, 2015 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining= a * copy of this software and associated documentation files (the "Softwa= re"), @@ -411,7 +411,7 @@ void igt_cleanup_aperture_trashers(void) * igt_system_suspend_autoresume: * * Execute a system suspend-to-mem cycle and automatically wake up again= using - * the firmwares resume timer. + * the firmware's resume timer. * * This is very handy for implementing any kind of suspend/resume test. */ @@ -430,6 +430,34 @@ void igt_system_suspend_autoresume(void) } =20 /** + * igt_system_hibernate_autoresume: + * + * Execute a system suspend-to-disk cycle and automatically wake up agai= n using + * the firmware's resume timer. + * + * This is very handy for implementing any kind of hibernate/resume test= . + */ +void igt_system_hibernate_autoresume(void) +{ + int ret; + + /* FIXME: I'm guessing simulation behaves the same way as with + * suspend/resume, but it might be prudent to make sure + */ + /* FIXME: Simulation doesn't like suspend/resume, and not even a lighte= r + * approach using /sys/power/pm_test to just test our driver's callback= s + * seems to fare better. We need to investigate what's going on. */ + igt_skip_on_simulation(); + + /* The timeout might need to be adjusted if hibernation takes too long + * or if we have to wait excessively long before resume + */ + ret =3D system("rtcwake -s 90 -m disk"); + igt_assert_f(ret =3D=3D 0, "This failure means that something is wrong = with the rtcwake tool " + "or how your distro is set up. This is not a i915.ko or i-g-t bug= ."); +} + +/** * igt_drop_root: * * Drop root privileges and make sure it actually worked. Useful for tes= ts diff --git a/lib/igt_aux.h b/lib/igt_aux.h index 798a5b45fcb9..636ab3dc06fc 100644 --- a/lib/igt_aux.h +++ b/lib/igt_aux.h @@ -1,5 +1,5 @@ /* - * Copyright =C2=A9 2014 Intel Corporation + * Copyright =C2=A9 2014, 2015 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining= a * copy of this software and associated documentation files (the "Softwa= re"), @@ -58,8 +58,9 @@ void igt_init_aperture_trashers(drm_intel_bufmgr *bufmg= r); void igt_trash_aperture(void); void igt_cleanup_aperture_trashers(void); =20 -/* suspend and auto-resume system */ +/* suspend/hibernate and auto-resume system */ void igt_system_suspend_autoresume(void); +void igt_system_hibernate_autoresume(void); =20 /* dropping priviledges */ void igt_drop_root(void); diff --git a/tests/drv_suspend.c b/tests/drv_suspend.c index 80f6a2254b75..8165cef9b333 100644 --- a/tests/drv_suspend.c +++ b/tests/drv_suspend.c @@ -1,5 +1,5 @@ /* - * Copyright =C2=A9 2013 Intel Corporation + * Copyright =C2=A9 2013, 2015 Intel Corporation * * Permission is hereby granted, free of charge, to any person obtaining= a * copy of this software and associated documentation files (the "Softwa= re"), @@ -22,6 +22,7 @@ * * Authors: * Daniel Vetter + * David Weinehall * */ =20 @@ -45,7 +46,7 @@ #define OBJECT_SIZE (16*1024*1024) =20 static void -test_fence_restore(int fd, bool tiled2untiled) +test_fence_restore(int fd, bool tiled2untiled, bool hibernate) { uint32_t handle1, handle2, handle_tiled; uint32_t *ptr1, *ptr2, *ptr_tiled; @@ -80,7 +81,10 @@ test_fence_restore(int fd, bool tiled2untiled) else gem_set_tiling(fd, handle_tiled, I915_TILING_X, 2048); =20 - igt_system_suspend_autoresume(); + if (hibernate) + igt_system_hibernate_autoresume(); + else + igt_system_suspend_autoresume(); =20 igt_info("checking the first canary object\n"); for (i =3D 0; i < OBJECT_SIZE/sizeof(uint32_t); i++) @@ -100,7 +104,7 @@ test_fence_restore(int fd, bool tiled2untiled) } =20 static void -test_debugfs_reader(void) +test_debugfs_reader(bool hibernate) { struct igt_helper_process reader =3D {}; reader.use_SIGKILL =3D true; @@ -117,7 +121,10 @@ test_debugfs_reader(void) =20 sleep(1); =20 - igt_system_suspend_autoresume(); + if (hibernate) + igt_system_hibernate_autoresume(); + else + igt_system_suspend_autoresume(); =20 sleep(1); =20 @@ -125,7 +132,7 @@ test_debugfs_reader(void) } =20 static void -test_sysfs_reader(void) +test_sysfs_reader(bool hibernate) { struct igt_helper_process reader =3D {}; reader.use_SIGKILL =3D true; @@ -142,7 +149,10 @@ test_sysfs_reader(void) =20 sleep(1); =20 - igt_system_suspend_autoresume(); + if (hibernate) + igt_system_hibernate_autoresume(); + else + igt_system_suspend_autoresume(); =20 sleep(1); =20 @@ -150,13 +160,18 @@ test_sysfs_reader(void) } =20 static void -test_forcewake(void) +test_forcewake(bool hibernate) { int fw_fd; =20 fw_fd =3D igt_open_forcewake_handle(); igt_assert(fw_fd >=3D 0); - igt_system_suspend_autoresume(); + + if (hibernate) + igt_system_hibernate_autoresume(); + else + igt_system_suspend_autoresume(); + close (fw_fd); } =20 @@ -169,20 +184,35 @@ igt_main igt_fixture fd =3D drm_open_any(); =20 - igt_subtest("fence-restore-tiled2untiled") - test_fence_restore(fd, true); + igt_subtest("fence-restore-tiled2untiled-suspend") + test_fence_restore(fd, true, false); + + igt_subtest("fence-restore-untiled-suspend") + test_fence_restore(fd, false, false); + + igt_subtest("debugfs-reader-suspend") + test_debugfs_reader(false); + + igt_subtest("sysfs-reader-suspend") + test_sysfs_reader(false); + + igt_subtest("forcewake-suspend") + test_forcewake(false); + + igt_subtest("fence-restore-tiled2untiled-hibernate") + test_fence_restore(fd, true, true); =20 - igt_subtest("fence-restore-untiled") - test_fence_restore(fd, false); + igt_subtest("fence-restore-untiled-hibernate") + test_fence_restore(fd, false, true); =20 - igt_subtest("debugfs-reader") - test_debugfs_reader(); + igt_subtest("debugfs-reader-hibernate") + test_debugfs_reader(true); =20 - igt_subtest("sysfs-reader") - test_sysfs_reader(); + igt_subtest("sysfs-reader-hibernate") + test_sysfs_reader(true); =20 - igt_subtest("forcewake") - test_forcewake(); + igt_subtest("forcewake-hibernate") + test_forcewake(true); =20 igt_fixture close(fd); --------------050007080506000005070107 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0 cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9pbnRlbC1nZngK --------------050007080506000005070107--