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: Disable mmio debugging during user access
Date: Thu, 07 Sep 2017 16:22:21 +0300 [thread overview]
Message-ID: <87mv663ape.fsf@gaia.fi.intel.com> (raw)
In-Reply-To: <20170907093657.1763-1-chris@chris-wilson.co.uk>
Chris Wilson <chris@chris-wilson.co.uk> writes:
> If the user bypasses i915 and accesses mmio directly, that easily
> confuses our automatic mmio debugging (any error we then detect is
> likely to be as a result of the user). Since we expect userspace to open
> debugfs/i915_forcewake_user if i915.ko is loaded and they want mmio
> access, that makes the opportune time to disable our debugging for
> duration of the bypass.
>
> References: https://bugs.freedesktop.org/show_bug.cgi?id=102543
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> ---
> drivers/gpu/drm/i915/i915_debugfs.c | 32 ++++++++++++++++++++++++++++++--
> drivers/gpu/drm/i915/intel_uncore.h | 7 +++++++
> 2 files changed, 37 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 48572b157222..d63b3c5c2f83 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -4679,7 +4679,21 @@ static int i915_forcewake_open(struct inode *inode, struct file *file)
> return 0;
>
> intel_runtime_pm_get(dev_priv);
> - intel_uncore_forcewake_get(dev_priv, FORCEWAKE_ALL);
> +
> + spin_lock_irq(&dev_priv->uncore.lock);
> + if (!dev_priv->uncore.user_forcewake.count++) {
> + intel_uncore_forcewake_get__locked(dev_priv, FORCEWAKE_ALL);
> +
> + /* Save and disable mmio debugging for the user bypass */
> + dev_priv->uncore.user_forcewake.saved_mmio_check =
> + dev_priv->uncore.unclaimed_mmio_check;
> + dev_priv->uncore.user_forcewake.saved_mmio_debug =
> + i915.mmio_debug;
> +
> + dev_priv->uncore.unclaimed_mmio_check = 0;
> + i915.mmio_debug = 0;
> + }
> + spin_unlock_irq(&dev_priv->uncore.lock);
Just pondering if this should be in intel_uncore.c as a
user_mmio_bypass_on/off(). But not insisting.
Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
>
> return 0;
> }
> @@ -4691,7 +4705,21 @@ static int i915_forcewake_release(struct inode *inode, struct file *file)
> if (INTEL_GEN(dev_priv) < 6)
> return 0;
>
> - intel_uncore_forcewake_put(dev_priv, FORCEWAKE_ALL);
> + spin_lock_irq(&dev_priv->uncore.lock);
> + if (!--dev_priv->uncore.user_forcewake.count) {
> + if (intel_uncore_unclaimed_mmio(dev_priv))
> + dev_info(dev_priv->drm.dev,
> + "Unclaimed mmio occurred during user acess\n");
> +
> + dev_priv->uncore.unclaimed_mmio_check =
> + dev_priv->uncore.user_forcewake.saved_mmio_check;
> + i915.mmio_debug =
> + dev_priv->uncore.user_forcewake.saved_mmio_debug;
> +
> + intel_uncore_forcewake_put__locked(dev_priv, FORCEWAKE_ALL);
> + }
> + spin_unlock_irq(&dev_priv->uncore.lock);
> +
> intel_runtime_pm_put(dev_priv);
>
> return 0;
> diff --git a/drivers/gpu/drm/i915/intel_uncore.h b/drivers/gpu/drm/i915/intel_uncore.h
> index 5f90278da461..1acf24c6e9ce 100644
> --- a/drivers/gpu/drm/i915/intel_uncore.h
> +++ b/drivers/gpu/drm/i915/intel_uncore.h
> @@ -102,6 +102,13 @@ struct intel_uncore {
> i915_reg_t reg_ack;
> } fw_domain[FW_DOMAIN_ID_COUNT];
>
> + struct {
> + unsigned int count;
> +
> + int saved_mmio_check;
> + int saved_mmio_debug;
> + } user_forcewake;
> +
> int unclaimed_mmio_check;
> };
>
> --
> 2.14.1
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
next prev parent reply other threads:[~2017-09-07 13:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-07 9:36 [PATCH] drm/i915: Disable mmio debugging during user access Chris Wilson
2017-09-07 10:44 ` ✓ Fi.CI.BAT: success for " Patchwork
2017-09-07 13:22 ` Mika Kuoppala [this message]
2017-09-07 13:31 ` [PATCH] " Chris Wilson
2017-09-07 13:24 ` ✓ Fi.CI.IGT: success for " Patchwork
2017-09-07 13:44 ` [PATCH v2] " Chris Wilson
2017-09-07 15:55 ` Michal Wajdeczko
2017-09-07 16:09 ` Chris Wilson
2017-09-07 14:03 ` ✓ Fi.CI.BAT: success for drm/i915: Disable mmio debugging during user access (rev2) Patchwork
2017-09-07 16:52 ` ✓ Fi.CI.IGT: " Patchwork
2017-09-07 17:01 ` Chris Wilson
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=87mv663ape.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.