From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lionel Landwerlin Subject: Re: [PATCH 8/8] drm/i915: Expose RPCS (SSEU) configuration to userspace Date: Fri, 4 May 2018 17:25:00 +0100 Message-ID: <7eb4c4b0-95b0-ab78-3b44-a3a134623559@intel.com> References: <20180425114521.7524-1-lionel.g.landwerlin@intel.com> <20180425114521.7524-9-lionel.g.landwerlin@intel.com> <9f4e64f5-b962-44c6-b1e1-70bddacfd872@linux.intel.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1375784572==" Return-path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id A85126E8FC for ; Fri, 4 May 2018 16:25:02 +0000 (UTC) In-Reply-To: <9f4e64f5-b962-44c6-b1e1-70bddacfd872@linux.intel.com> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" To: Tvrtko Ursulin , intel-gfx@lists.freedesktop.org, "Rogozhkin, Dmitry V" List-Id: intel-gfx@lists.freedesktop.org This is a multi-part message in MIME format. --===============1375784572== Content-Type: multipart/alternative; boundary="------------74A627F1CBF792F32CDED200" Content-Language: en-US This is a multi-part message in MIME format. --------------74A627F1CBF792F32CDED200 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit On 03/05/18 18:18, Tvrtko Ursulin wrote: >>   +int intel_lr_context_set_sseu(struct i915_gem_context *ctx, >> +                  struct intel_engine_cs *engine, >> +                  struct i915_gem_context_sseu *sseu) >> +{ >> +    struct drm_i915_private *dev_priv = ctx->i915; >> +    struct intel_context *ce; >> +    enum intel_engine_id id; >> +    int ret; >> + >> +    lockdep_assert_held(&dev_priv->drm.struct_mutex); >> + >> +    if (memcmp(sseu, &ctx->engine[engine->id].sseu, sizeof(*sseu)) >> == 0) >> +        return 0; >> + >> +    /* >> +     * We can only program this on render ring. >> +     */ >> +    ce = &ctx->engine[RCS]; >> + >> +    if (ce->pin_count) { /* Assume that the context is active! */ >> +        ret = i915_gem_switch_to_kernel_context(dev_priv); >> +        if (ret) >> +            return ret; >> + >> +        ret = i915_gem_wait_for_idle(dev_priv, >> +                         I915_WAIT_INTERRUPTIBLE | >> +                         I915_WAIT_LOCKED); > > Could we consider the alternative of only allowing this to be > configured on context create? That way we would not need to idle the > GPU every time userspace decides to fiddle with it. It is unprivileged > so quite an easy way for random app to ruin GPU performance for everyone. > > Regards, > > Tvrtko I'm pretty sure Dmitry wants dynamic configurations. Dmitry? --------------74A627F1CBF792F32CDED200 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 8bit
On 03/05/18 18:18, Tvrtko Ursulin wrote:
  +int intel_lr_context_set_sseu(struct i915_gem_context *ctx,
+                  struct intel_engine_cs *engine,
+                  struct i915_gem_context_sseu *sseu)
+{
+    struct drm_i915_private *dev_priv = ctx->i915;
+    struct intel_context *ce;
+    enum intel_engine_id id;
+    int ret;
+
+    lockdep_assert_held(&dev_priv->drm.struct_mutex);
+
+    if (memcmp(sseu, &ctx->engine[engine->id].sseu, sizeof(*sseu)) == 0)
+        return 0;
+
+    /*
+     * We can only program this on render ring.
+     */
+    ce = &ctx->engine[RCS];
+
+    if (ce->pin_count) { /* Assume that the context is active! */
+        ret = i915_gem_switch_to_kernel_context(dev_priv);
+        if (ret)
+            return ret;
+
+        ret = i915_gem_wait_for_idle(dev_priv,
+                         I915_WAIT_INTERRUPTIBLE |
+                         I915_WAIT_LOCKED);

Could we consider the alternative of only allowing this to be configured on context create? That way we would not need to idle the GPU every time userspace decides to fiddle with it. It is unprivileged so quite an easy way for random app to ruin GPU performance for everyone.

Regards,

Tvrtko


I'm pretty sure Dmitry wants dynamic configurations.

Dmitry?
--------------74A627F1CBF792F32CDED200-- --===============1375784572== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KSW50ZWwtZ2Z4 IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJlZWRlc2t0b3Aub3JnCmh0dHBzOi8vbGlz dHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwtZ2Z4Cg== --===============1375784572==--