Re: [igt-dev] [PATCH i-g-t] lib/pm: Fail gracefully if CONFIG_PM is not built into the kernel

Chris Wilson
2018-09-06T09:02:55Z

Quoting Tvrtko Ursulin (2018-09-06 09:51:00)
>
> On 05/09/2018 16:13, Chris Wilson wrote:
> > Quoting Tvrtko Ursulin (2018-09-05 16:01:04)
> >>
> >> On 05/09/2018 10:07, Chris Wilson wrote:
> >>> We report the failure from igt_setup_runtime_pm() so that the caller can
> >>> decide how they may proceed, so replace the hard assert with the error
> >>> propagation.
> >>>
> >>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> >>> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> >>> Cc: Imre Deak <imre.deak@intel.com>
> >>> ---
> >>> lib/igt_pm.c | 15 ++++++++++-----
> >>> 1 file changed, 10 insertions(+), 5 deletions(-)
> >>>
> >>> diff --git a/lib/igt_pm.c b/lib/igt_pm.c
> >>> index 615463a08..49027238b 100644
> >>> --- a/lib/igt_pm.c
> >>> +++ b/lib/igt_pm.c
> >>> @@ -511,12 +511,16 @@ bool igt_setup_runtime_pm(void)
> >>>
> >>> igt_pm_enable_audio_runtime_pm();
> >>>
> >>> - /* Our implementation uses autosuspend. Try to set it to 0ms so the test
> >>> - * suite goes faster and we have a higher probability of triggering race
> >>> - * conditions. */
> >>> + /*
> >>> + * Our implementation uses autosuspend. Try to set it to 0ms so the
> >>> + * test suite goes faster and we have a higher probability of
> >>> + * triggering race conditions.
> >>> + */
> >>> fd = open(POWER_DIR "/autosuspend_delay_ms", O_RDWR);
> >>> - igt_assert_f(fd >= 0,
> >>> - "Can't open " POWER_DIR "/autosuspend_delay_ms\n");
> >>> + if (fd < 0) {
> >>> + igt_pm_audio_restore_runtime_pm();
> >>> + return false;
> >>
> >> Worth robustifying with an igt_assert_eq(errno, ENOENT) ?
> >
> > You are just dying to debug all the transient ENOMEM and EMFILE aren't
> > you! :)
>
> Out of memory or file descriptors during test start really? We are in
> terrible state then..

Definitely don't want to run the test under those conditions, right. And
I certainly don't want a misleading failure report as to why an
unrelated test failed. Having the skip highlighted is enough without
causing a freakout. And as always if it is reproducible, it can jolly
well get its own test.
-Chris