Skip to contentSkip to conversation

drm/i915: Make contexts non-snooped on non-LLC platforms

PATCH Superseded [email protected] 3 participants 8 messages Mar 31, 2014 – Apr 4, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/i915: Make contexts non-snooped on non-LLC platforms

From: Ville Syrjälä <[email protected]>

We don't do CPU access to GPU contexts so making the GPU access snoop the CPU caches seems silly, and potentially expensive.

---
 drivers/gpu/drm/i915/i915_gem_context.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_context.c +1 -1
index 6043062..746fb23 100644
@@ -240,7 +240,7 @@ __create_hw_context(struct drm_device *dev,
 		return ERR_PTR(-ENOMEM);
 	}
 
-	if (INTEL_INFO(dev)->gen >= 7) {
+	if (INTEL_INFO(dev)->gen >= 7 && HAS_LLC(dev)) {
 		ret = i915_gem_object_set_cache_level(ctx->obj,
 						      I915_CACHE_L3_LLC);
 		/* Failure shouldn't ever happen this early */
Signature · 6 lines
1.8.3.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#1 lore raw
Quoted 6 lines · On Mon, Mar 31, 2014 at 06:09:49PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

We don't do CPU access to GPU contexts so making the GPU access snoop the CPU caches seems silly, and potentially expensive.

Maybe define a macro to be HAS_L3_CACHE?

The root cause is that our singular enum is not flexible enough to account for all platform variations.

Otherwise, lgtm.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#2 lore raw
Quoted 9 lines · Chris Wilson
Quoted 6 lines · On Mon, Mar 31, 2014 at 06:09:49PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

We don't do CPU access to GPU contexts so making the GPU access snoop the CPU caches seems silly, and potentially expensive.

Maybe define a macro to be HAS_L3_CACHE?

What should I do with such a macro?

Quoted 9 lines

The root cause is that our singular enum is not flexible enough to account for all platform variations.

Otherwise, lgtm.
-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
Signature · 2 lines
Ville Syrjälä
Intel OTC
#3 lore raw
Quoted 4 lines · Ville Syrjälä
Quoted 3 lines · Chris Wilson
Quoted 2 lines · On Mon, Mar 31, 2014 at 06:09:49PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

We don't do CPU access to GPU contexts so making the GPU access snoop the CPU caches seems silly, and potentially expensive.

Maybe define a macro to be HAS_L3_CACHE?

What should I do with such a macro?

I am trying to express what exactly we are testing for here. It is not exactly LLC we care about, but L3 to hide the context switch latency. Even though Ben thinks that's a waste of our limited resources. -Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#4 lore raw
Quoted 10 lines · Chris Wilson
Quoted 9 lines · Ville Syrjälä
Quoted 8 lines · Chris Wilson
Quoted 6 lines · On Mon, Mar 31, 2014 at 06:09:49PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

We don't do CPU access to GPU contexts so making the GPU access snoop the CPU caches seems silly, and potentially expensive.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Maybe define a macro to be HAS_L3_CACHE?

What should I do with such a macro?

I am trying to express what exactly we are testing for here. It is not exactly LLC we care about, but L3 to hide the context switch latency. Even though Ben thinks that's a waste of our limited resources.

VLV has L3 too, but we can't control it via the PTEs.

Signature · 2 lines
Ville Syrjälä
Intel OTC
#5 lore raw

PATCH v2 1/1 drm/i915: Make contexts non-snooped on non-LLC platforms

In reply to [email protected]

From: Ville Syrjälä <[email protected]>

We don't do CPU access to GPU contexts so making the GPU access snoop the CPU caches seems silly, and potentially expensive.

v2: Use !IS_VALLEYVIEW instead of HAS_LLC as this is really
about what the PTEs can represent.
Add a comment clarifying the situation.

---
 drivers/gpu/drm/i915/i915_gem_context.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_context.c +9 -1
index 8827892..30b355a 100644
@@ -240,7 +240,15 @@ __create_hw_context(struct drm_device *dev,
 		return ERR_PTR(-ENOMEM);
 	}
 
-	if (INTEL_INFO(dev)->gen >= 7) {
+	/*
+	 * Try to make the context utilize L3 as well as LLC.
+	 *
+	 * On VLV we don't have L3 controls in the PTEs so we
+	 * shouldn't touch the cache level, especially as that
+	 * would make the object snooped which might have a
+	 * negative performance impact.
+	 */
+	if (INTEL_INFO(dev)->gen >= 7 && !IS_VALLEYVIEW(dev)) {
 		ret = i915_gem_object_set_cache_level(ctx->obj,
 						      I915_CACHE_L3_LLC);
 		/* Failure shouldn't ever happen this early */
Signature · 6 lines
1.8.3.2

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Reviewed-by on v2 1/1
#6 lore raw
Quoted 10 lines · On Fri, Apr 04, 2014 at 04:36:10PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

We don't do CPU access to GPU contexts so making the GPU access snoop the CPU caches seems silly, and potentially expensive.

v2: Use !IS_VALLEYVIEW instead of HAS_LLC as this is really
about what the PTEs can represent.
Add a comment clarifying the situation.

-Chris

Signature · 1 line
Chris Wilson, Intel Open Source Technology Centre
#7 lore raw
Quoted 6 lines · Chris Wilson
Quoted 5 lines · On Fri, Apr 04, 2014 at 04:36:10PM +0300, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

We don't do CPU access to GPU contexts so making the GPU access snoop the CPU caches seems silly, and potentially expensive.

Quoted 6 lines
Quoted 5 lines

v2: Use !IS_VALLEYVIEW instead of HAS_LLC as this is really
about what the PTEs can represent.
Add a comment clarifying the situation.

Queued for -next, thanks for the patch.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch