All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Remove struct_mutex locking from i915_gem_context_setparam
@ 2017-10-22 12:18 Chris Wilson
  2017-10-22 12:38 ` ✗ Fi.CI.BAT: failure for " Patchwork
  2017-10-22 13:35 ` ✗ Fi.CI.IGT: warning " Patchwork
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Wilson @ 2017-10-22 12:18 UTC (permalink / raw)
  To: intel-gfx

Currently all setparam operations on the context can be done unlocked;
races with concurrent operations using those params are an issue for
userspace (concurrently trying to change parameters and execution with
them is undefined as to which parameters should be used). Later we may
need to change state that requires the struct_mutex, but for now we are
just changing values local to the context.

The impact is tiny since setparam is an infrequent runtime operation;
the context is expected to be configured just after creation and then
rarely changed. Just within igt where we do try many operations in
parallel while poking the context do we observe any effect.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_gem_context.c    | 20 +++++++-------------
 drivers/gpu/drm/i915/i915_gem_context.h    | 17 ++++++++++++++++-
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  2 +-
 3 files changed, 24 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem_context.c b/drivers/gpu/drm/i915/i915_gem_context.c
index 5bf96a258509..92b08a06318c 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -1054,7 +1054,7 @@ int i915_gem_context_getparam_ioctl(struct drm_device *dev, void *data,
 		ret = -EINVAL;
 		break;
 	case I915_CONTEXT_PARAM_NO_ZEROMAP:
-		args->value = ctx->flags & CONTEXT_NO_ZEROMAP;
+		args->value = i915_gem_context_no_zeromap(ctx);
 		break;
 	case I915_CONTEXT_PARAM_GTT_SIZE:
 		if (ctx->ppgtt)
@@ -1088,27 +1088,23 @@ int i915_gem_context_setparam_ioctl(struct drm_device *dev, void *data,
 	struct drm_i915_file_private *file_priv = file->driver_priv;
 	struct drm_i915_gem_context_param *args = data;
 	struct i915_gem_context *ctx;
-	int ret;
+	int ret = 0;
 
 	ctx = i915_gem_context_lookup(file_priv, args->ctx_id);
 	if (!ctx)
 		return -ENOENT;
 
-	ret = i915_mutex_lock_interruptible(dev);
-	if (ret)
-		goto out;
-
 	switch (args->param) {
 	case I915_CONTEXT_PARAM_BAN_PERIOD:
 		ret = -EINVAL;
 		break;
 	case I915_CONTEXT_PARAM_NO_ZEROMAP:
-		if (args->size) {
+		if (args->size)
 			ret = -EINVAL;
-		} else {
-			ctx->flags &= ~CONTEXT_NO_ZEROMAP;
-			ctx->flags |= args->value ? CONTEXT_NO_ZEROMAP : 0;
-		}
+		else if (args->value)
+			i915_gem_context_set_no_zeromap(ctx);
+		else
+			i915_gem_context_clear_no_zeromap(ctx);
 		break;
 	case I915_CONTEXT_PARAM_NO_ERROR_CAPTURE:
 		if (args->size)
@@ -1152,9 +1148,7 @@ int i915_gem_context_setparam_ioctl(struct drm_device *dev, void *data,
 		ret = -EINVAL;
 		break;
 	}
-	mutex_unlock(&dev->struct_mutex);
 
-out:
 	i915_gem_context_put(ctx);
 	return ret;
 }
diff --git a/drivers/gpu/drm/i915/i915_gem_context.h b/drivers/gpu/drm/i915/i915_gem_context.h
index 44688e22a5c2..100ba700c565 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.h
+++ b/drivers/gpu/drm/i915/i915_gem_context.h
@@ -109,7 +109,7 @@ struct i915_gem_context {
 	 * @flags: small set of booleans
 	 */
 	unsigned long flags;
-#define CONTEXT_NO_ZEROMAP		BIT(0)
+#define CONTEXT_NO_ZEROMAP		0
 #define CONTEXT_NO_ERROR_CAPTURE	1
 #define CONTEXT_CLOSED			2
 #define CONTEXT_BANNABLE		3
@@ -205,6 +205,21 @@ static inline void i915_gem_context_set_closed(struct i915_gem_context *ctx)
 	__set_bit(CONTEXT_CLOSED, &ctx->flags);
 }
 
+static inline bool i915_gem_context_no_zeromap(const struct i915_gem_context *ctx)
+{
+	return test_bit(CONTEXT_NO_ZEROMAP, &ctx->flags);
+}
+
+static inline void i915_gem_context_set_no_zeromap(struct i915_gem_context *ctx)
+{
+	__set_bit(CONTEXT_NO_ZEROMAP, &ctx->flags);
+}
+
+static inline void i915_gem_context_clear_no_zeromap(struct i915_gem_context *ctx)
+{
+	__clear_bit(CONTEXT_NO_ZEROMAP, &ctx->flags);
+}
+
 static inline bool i915_gem_context_no_error_capture(const struct i915_gem_context *ctx)
 {
 	return test_bit(CONTEXT_NO_ERROR_CAPTURE, &ctx->flags);
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 3d7190764f10..a111a2f9d688 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -671,7 +671,7 @@ static int eb_select_context(struct i915_execbuffer *eb)
 	eb->vm = ctx->ppgtt ? &ctx->ppgtt->base : &eb->i915->ggtt.base;
 
 	eb->context_flags = 0;
-	if (ctx->flags & CONTEXT_NO_ZEROMAP)
+	if (i915_gem_context_no_zeromap(ctx))
 		eb->context_flags |= __EXEC_OBJECT_NEEDS_BIAS;
 
 	return 0;
-- 
2.15.0.rc1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* ✗ Fi.CI.BAT: failure for drm/i915: Remove struct_mutex locking from i915_gem_context_setparam
  2017-10-22 12:18 [PATCH] drm/i915: Remove struct_mutex locking from i915_gem_context_setparam Chris Wilson
@ 2017-10-22 12:38 ` Patchwork
  2017-10-22 13:35 ` ✗ Fi.CI.IGT: warning " Patchwork
  1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2017-10-22 12:38 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Remove struct_mutex locking from i915_gem_context_setparam
URL   : https://patchwork.freedesktop.org/series/32418/
State : failure

== Summary ==

Series 32418v1 drm/i915: Remove struct_mutex locking from i915_gem_context_setparam
https://patchwork.freedesktop.org/api/1.0/series/32418/revisions/1/mbox/

Test gem_exec_reloc:
        Subgroup basic-write-read-active:
                fail       -> PASS       (fi-gdg-551) fdo#102582
Test kms_busy:
        Subgroup basic-flip-a:
                fail       -> PASS       (fi-gdg-551) fdo#102654
Test kms_cursor_legacy:
        Subgroup basic-flip-before-cursor-varying-size:
                pass       -> INCOMPLETE (fi-skl-6260u)
Test kms_pipe_crc_basic:
        Subgroup hang-read-crc-pipe-b:
                incomplete -> PASS       (fi-skl-6700hq)
        Subgroup read-crc-pipe-c-frame-sequence:
                skip       -> PASS       (fi-hsw-4770r)

fdo#102582 https://bugs.freedesktop.org/show_bug.cgi?id=102582
fdo#102654 https://bugs.freedesktop.org/show_bug.cgi?id=102654

fi-bdw-5557u     total:289  pass:268  dwarn:0   dfail:0   fail:0   skip:21  time:442s
fi-bdw-gvtdvm    total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:449s
fi-blb-e6850     total:289  pass:223  dwarn:1   dfail:0   fail:0   skip:65  time:373s
fi-bsw-n3050     total:289  pass:243  dwarn:0   dfail:0   fail:0   skip:46  time:517s
fi-bwr-2160      total:289  pass:183  dwarn:0   dfail:0   fail:0   skip:106 time:265s
fi-bxt-dsi       total:289  pass:259  dwarn:0   dfail:0   fail:0   skip:30  time:497s
fi-bxt-j4205     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:490s
fi-byt-j1900     total:289  pass:253  dwarn:1   dfail:0   fail:0   skip:35  time:489s
fi-byt-n2820     total:289  pass:249  dwarn:1   dfail:0   fail:0   skip:39  time:479s
fi-cfl-s         total:289  pass:253  dwarn:4   dfail:0   fail:0   skip:32  time:554s
fi-elk-e7500     total:289  pass:229  dwarn:0   dfail:0   fail:0   skip:60  time:416s
fi-gdg-551       total:289  pass:178  dwarn:1   dfail:0   fail:1   skip:109 time:250s
fi-glk-1         total:289  pass:261  dwarn:0   dfail:0   fail:0   skip:28  time:580s
fi-hsw-4770      total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:447s
fi-hsw-4770r     total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:428s
fi-ilk-650       total:289  pass:228  dwarn:0   dfail:0   fail:0   skip:61  time:432s
fi-ivb-3520m     total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:495s
fi-ivb-3770      total:289  pass:260  dwarn:0   dfail:0   fail:0   skip:29  time:455s
fi-kbl-7500u     total:289  pass:264  dwarn:1   dfail:0   fail:0   skip:24  time:490s
fi-kbl-7560u     total:289  pass:270  dwarn:0   dfail:0   fail:0   skip:19  time:572s
fi-kbl-7567u     total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:479s
fi-kbl-r         total:289  pass:262  dwarn:0   dfail:0   fail:0   skip:27  time:568s
fi-pnv-d510      total:289  pass:222  dwarn:1   dfail:0   fail:0   skip:66  time:552s
fi-skl-6260u     total:216  pass:203  dwarn:0   dfail:0   fail:0   skip:12 
fi-skl-6700hq    total:289  pass:263  dwarn:0   dfail:0   fail:0   skip:26  time:648s
fi-skl-6700k     total:289  pass:265  dwarn:0   dfail:0   fail:0   skip:24  time:519s
fi-skl-6770hq    total:289  pass:269  dwarn:0   dfail:0   fail:0   skip:20  time:483s
fi-skl-gvtdvm    total:289  pass:266  dwarn:0   dfail:0   fail:0   skip:23  time:456s
fi-snb-2520m     total:289  pass:250  dwarn:0   dfail:0   fail:0   skip:39  time:565s
fi-snb-2600      total:289  pass:249  dwarn:0   dfail:0   fail:0   skip:40  time:415s

9dd506b9e3b79799503694e9c1bb5aba0d7d72eb drm-tip: 2017y-10m-21d-14h-49m-03s UTC integration manifest
a3f63c3adede drm/i915: Remove struct_mutex locking from i915_gem_context_setparam

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6137/
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

* ✗ Fi.CI.IGT: warning for drm/i915: Remove struct_mutex locking from i915_gem_context_setparam
  2017-10-22 12:18 [PATCH] drm/i915: Remove struct_mutex locking from i915_gem_context_setparam Chris Wilson
  2017-10-22 12:38 ` ✗ Fi.CI.BAT: failure for " Patchwork
@ 2017-10-22 13:35 ` Patchwork
  1 sibling, 0 replies; 3+ messages in thread
From: Patchwork @ 2017-10-22 13:35 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

== Series Details ==

Series: drm/i915: Remove struct_mutex locking from i915_gem_context_setparam
URL   : https://patchwork.freedesktop.org/series/32418/
State : warning

== Summary ==

Test kms_setmode:
        Subgroup basic:
                fail       -> PASS       (shard-hsw) fdo#99912
Test kms_flip:
        Subgroup plain-flip-ts-check:
                fail       -> PASS       (shard-hsw) fdo#100368
Test kms_busy:
        Subgroup extended-modeset-hang-newfb-with-reset-render-A:
                dmesg-warn -> PASS       (shard-hsw)
        Subgroup extended-modeset-hang-newfb-with-reset-render-B:
                pass       -> DMESG-WARN (shard-hsw) fdo#103038
Test kms_cursor_crc:
        Subgroup cursor-256x256-suspend:
                pass       -> SKIP       (shard-hsw)

fdo#99912 https://bugs.freedesktop.org/show_bug.cgi?id=99912
fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#103038 https://bugs.freedesktop.org/show_bug.cgi?id=103038

shard-hsw        total:2540 pass:1429 dwarn:1   dfail:0   fail:8   skip:1102 time:9126s

== Logs ==

For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_6137/shards.html
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-22 13:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-22 12:18 [PATCH] drm/i915: Remove struct_mutex locking from i915_gem_context_setparam Chris Wilson
2017-10-22 12:38 ` ✗ Fi.CI.BAT: failure for " Patchwork
2017-10-22 13:35 ` ✗ Fi.CI.IGT: warning " Patchwork

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.