From: Mika Kuoppala <mika.kuoppala@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/selftests: Reorder error cleanup for whitelist checking
Date: Mon, 08 Jul 2019 19:04:27 +0300 [thread overview]
Message-ID: <87k1cs1pis.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20190708152321.22187-1-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> Reorder the error paths so that we unwind all the locals from any error
> path and so avoid setting off divers alarum in case we find an error in
> case we find an error.
Divers alarum got past me. But for finding an error in case
we find error: It is fitting enough that I am not sure if it is
a mistake.
The error paths are better,
Reviewed-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
>
> References: https://bugs.freedesktop.org/show_bug.cgi?id=111048
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> .../gpu/drm/i915/gt/selftest_workarounds.c | 35 ++++++++++---------
> 1 file changed, 19 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gt/selftest_workarounds.c b/drivers/gpu/drm/i915/gt/selftest_workarounds.c
> index b933d831eeb1..fa01ea7855de 100644
> --- a/drivers/gpu/drm/i915/gt/selftest_workarounds.c
> +++ b/drivers/gpu/drm/i915/gt/selftest_workarounds.c
> @@ -287,7 +287,7 @@ static int check_whitelist_across_reset(struct intel_engine_cs *engine,
> const char *name)
> {
> struct drm_i915_private *i915 = engine->i915;
> - struct i915_gem_context *ctx;
> + struct i915_gem_context *ctx, *tmp;
> struct igt_spinner spin;
> intel_wakeref_t wakeref;
> int err;
> @@ -295,56 +295,59 @@ static int check_whitelist_across_reset(struct intel_engine_cs *engine,
> pr_info("Checking %d whitelisted registers (RING_NONPRIV) [%s]\n",
> engine->whitelist.count, name);
>
> - err = igt_spinner_init(&spin, i915);
> - if (err)
> - return err;
> -
> ctx = kernel_context(i915);
> if (IS_ERR(ctx))
> return PTR_ERR(ctx);
>
> + err = igt_spinner_init(&spin, i915);
> + if (err)
> + goto out_ctx;
> +
> err = check_whitelist(ctx, engine);
> if (err) {
> pr_err("Invalid whitelist *before* %s reset!\n", name);
> - goto out;
> + goto out_spin;
> }
>
> err = switch_to_scratch_context(engine, &spin);
> if (err)
> - goto out;
> + goto out_spin;
>
> with_intel_runtime_pm(&i915->runtime_pm, wakeref)
> err = reset(engine);
>
> igt_spinner_end(&spin);
> - igt_spinner_fini(&spin);
>
> if (err) {
> pr_err("%s reset failed\n", name);
> - goto out;
> + goto out_spin;
> }
>
> err = check_whitelist(ctx, engine);
> if (err) {
> pr_err("Whitelist not preserved in context across %s reset!\n",
> name);
> - goto out;
> + goto out_spin;
> }
>
> + tmp = kernel_context(i915);
> + if (IS_ERR(tmp)) {
> + err = PTR_ERR(tmp);
> + goto out_spin;
> + }
> kernel_context_close(ctx);
> -
> - ctx = kernel_context(i915);
> - if (IS_ERR(ctx))
> - return PTR_ERR(ctx);
> + ctx = tmp;
>
> err = check_whitelist(ctx, engine);
> if (err) {
> pr_err("Invalid whitelist *after* %s reset in fresh context!\n",
> name);
> - goto out;
> + goto out_spin;
> }
>
> -out:
> +out_spin:
> + igt_spinner_fini(&spin);
> +out_ctx:
> kernel_context_close(ctx);
> return err;
> }
> --
> 2.20.1
>
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2019-07-08 16:04 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-08 15:23 [PATCH] drm/i915/selftests: Reorder error cleanup for whitelist checking Chris Wilson
2019-07-08 16:01 ` ✓ Fi.CI.BAT: success for " Patchwork
2019-07-08 16:04 ` Mika Kuoppala [this message]
2019-07-08 17:03 ` ✓ Fi.CI.BAT: success for drm/i915/selftests: Reorder error cleanup for whitelist checking (rev2) Patchwork
2019-07-09 3:57 ` ✓ Fi.CI.IGT: " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k1cs1pis.fsf@gaia.fi.intel.com \
--to=mika.kuoppala@linux.intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox