All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Differentiate between LLC or snooped for the user
@ 2014-08-22 13:41 Chris Wilson
  2014-08-25 12:34 ` Ville Syrjälä
  0 siblings, 1 reply; 3+ messages in thread
From: Chris Wilson @ 2014-08-22 13:41 UTC (permalink / raw)
  To: intel-gfx

Rather than describing an object as either "snooped or LLC", we can do
better as we should know what machine we are running on!

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/i915_debugfs.c   | 4 ++--
 drivers/gpu/drm/i915/i915_drv.h       | 4 +++-
 drivers/gpu/drm/i915/i915_gpu_error.c | 8 +++++---
 drivers/gpu/drm/i915/i915_sysfs.c     | 2 +-
 4 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 19f27d7f1d9b..eb1859f87a88 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -137,7 +137,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
 		   i915_request_seqno(rq),
 		   i915_request_seqno(obj->last_write.request),
 		   i915_request_seqno(obj->last_fence.request),
-		   i915_cache_level_str(obj->cache_level),
+		   i915_cache_level_str(to_i915(obj->base.dev), obj->cache_level),
 		   obj->dirty ? " dirty" : "",
 		   obj->madv == I915_MADV_DONTNEED ? " purgeable" : "");
 	if (obj->base.name)
@@ -1014,7 +1014,7 @@ static ssize_t i915_error_state_read(struct file *file, char __user *userbuf,
 	ssize_t ret_count = 0;
 	int ret;
 
-	ret = i915_error_state_buf_init(&error_str, count, *pos);
+	ret = i915_error_state_buf_init(&error_str, to_i915(error_priv->dev), count, *pos);
 	if (ret)
 		return ret;
 
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1e3179faef7c..1439da02f6f2 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -1162,6 +1162,7 @@ struct i915_gem_mm {
 };
 
 struct drm_i915_error_state_buf {
+	struct drm_i915_private *i915;
 	unsigned bytes;
 	unsigned size;
 	int err;
@@ -2748,6 +2749,7 @@ void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...);
 int i915_error_state_to_str(struct drm_i915_error_state_buf *estr,
 			    const struct i915_error_state_file_priv *error);
 int i915_error_state_buf_init(struct drm_i915_error_state_buf *eb,
+			      struct drm_i915_private *i915,
 			      size_t count, loff_t pos);
 static inline void i915_error_state_buf_release(
 	struct drm_i915_error_state_buf *eb)
@@ -2762,7 +2764,7 @@ void i915_error_state_put(struct i915_error_state_file_priv *error_priv);
 void i915_destroy_error_state(struct drm_device *dev);
 
 void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone);
-const char *i915_cache_level_str(int type);
+const char *i915_cache_level_str(struct drm_i915_private *i915, int type);
 
 /* i915_cmd_parser.c */
 int i915_cmd_parser_get_version(void);
diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
index b3d6e913917d..51e45eaafc2e 100644
--- a/drivers/gpu/drm/i915/i915_gpu_error.c
+++ b/drivers/gpu/drm/i915/i915_gpu_error.c
@@ -208,7 +208,7 @@ static void print_error_buffers(struct drm_i915_error_state_buf *m,
 		err_puts(m, err->userptr ? " userptr" : "");
 		err_puts(m, err->ring != -1 ? " " : "");
 		err_puts(m, ring_str(err->ring));
-		err_puts(m, i915_cache_level_str(err->cache_level));
+		err_puts(m, i915_cache_level_str(m->i915, err->cache_level));
 
 		if (err->name)
 			err_printf(m, " (name: %d)", err->name);
@@ -502,9 +502,11 @@ out:
 }
 
 int i915_error_state_buf_init(struct drm_i915_error_state_buf *ebuf,
+			      struct drm_i915_private *i915,
 			      size_t count, loff_t pos)
 {
 	memset(ebuf, 0, sizeof(*ebuf));
+	ebuf->i915 = i915;
 
 	/* We need to have enough room to store any i915_error_state printf
 	 * so that we can move it to start position.
@@ -1367,11 +1369,11 @@ void i915_destroy_error_state(struct drm_device *dev)
 		kref_put(&error->ref, i915_error_state_free);
 }
 
-const char *i915_cache_level_str(int type)
+const char *i915_cache_level_str(struct drm_i915_private *i915, int type)
 {
 	switch (type) {
 	case I915_CACHE_NONE: return " uncached";
-	case I915_CACHE_LLC: return " snooped or LLC";
+	case I915_CACHE_LLC: return HAS_LLC(i915) ? " LLC" : " snooped";
 	case I915_CACHE_L3_LLC: return " L3+LLC";
 	case I915_CACHE_WT: return " WT";
 	default: return "";
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index ae7fd8fc27f0..503847f18fdd 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -540,7 +540,7 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj,
 
 	memset(&error_priv, 0, sizeof(error_priv));
 
-	ret = i915_error_state_buf_init(&error_str, count, off);
+	ret = i915_error_state_buf_init(&error_str, to_i915(dev), count, off);
 	if (ret)
 		return ret;
 
-- 
2.1.0

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

* Re: [PATCH] drm/i915: Differentiate between LLC or snooped for the user
  2014-08-22 13:41 [PATCH] drm/i915: Differentiate between LLC or snooped for the user Chris Wilson
@ 2014-08-25 12:34 ` Ville Syrjälä
  2014-08-27  5:54   ` Daniel Vetter
  0 siblings, 1 reply; 3+ messages in thread
From: Ville Syrjälä @ 2014-08-25 12:34 UTC (permalink / raw)
  To: Chris Wilson; +Cc: intel-gfx

On Fri, Aug 22, 2014 at 02:41:39PM +0100, Chris Wilson wrote:
> Rather than describing an object as either "snooped or LLC", we can do
> better as we should know what machine we are running on!
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>

Indeed, makes things less confusing.

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/i915/i915_debugfs.c   | 4 ++--
>  drivers/gpu/drm/i915/i915_drv.h       | 4 +++-
>  drivers/gpu/drm/i915/i915_gpu_error.c | 8 +++++---
>  drivers/gpu/drm/i915/i915_sysfs.c     | 2 +-
>  4 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> index 19f27d7f1d9b..eb1859f87a88 100644
> --- a/drivers/gpu/drm/i915/i915_debugfs.c
> +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> @@ -137,7 +137,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
>  		   i915_request_seqno(rq),
>  		   i915_request_seqno(obj->last_write.request),
>  		   i915_request_seqno(obj->last_fence.request),
> -		   i915_cache_level_str(obj->cache_level),
> +		   i915_cache_level_str(to_i915(obj->base.dev), obj->cache_level),
>  		   obj->dirty ? " dirty" : "",
>  		   obj->madv == I915_MADV_DONTNEED ? " purgeable" : "");
>  	if (obj->base.name)
> @@ -1014,7 +1014,7 @@ static ssize_t i915_error_state_read(struct file *file, char __user *userbuf,
>  	ssize_t ret_count = 0;
>  	int ret;
>  
> -	ret = i915_error_state_buf_init(&error_str, count, *pos);
> +	ret = i915_error_state_buf_init(&error_str, to_i915(error_priv->dev), count, *pos);
>  	if (ret)
>  		return ret;
>  
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index 1e3179faef7c..1439da02f6f2 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1162,6 +1162,7 @@ struct i915_gem_mm {
>  };
>  
>  struct drm_i915_error_state_buf {
> +	struct drm_i915_private *i915;
>  	unsigned bytes;
>  	unsigned size;
>  	int err;
> @@ -2748,6 +2749,7 @@ void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...);
>  int i915_error_state_to_str(struct drm_i915_error_state_buf *estr,
>  			    const struct i915_error_state_file_priv *error);
>  int i915_error_state_buf_init(struct drm_i915_error_state_buf *eb,
> +			      struct drm_i915_private *i915,
>  			      size_t count, loff_t pos);
>  static inline void i915_error_state_buf_release(
>  	struct drm_i915_error_state_buf *eb)
> @@ -2762,7 +2764,7 @@ void i915_error_state_put(struct i915_error_state_file_priv *error_priv);
>  void i915_destroy_error_state(struct drm_device *dev);
>  
>  void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone);
> -const char *i915_cache_level_str(int type);
> +const char *i915_cache_level_str(struct drm_i915_private *i915, int type);
>  
>  /* i915_cmd_parser.c */
>  int i915_cmd_parser_get_version(void);
> diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> index b3d6e913917d..51e45eaafc2e 100644
> --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> @@ -208,7 +208,7 @@ static void print_error_buffers(struct drm_i915_error_state_buf *m,
>  		err_puts(m, err->userptr ? " userptr" : "");
>  		err_puts(m, err->ring != -1 ? " " : "");
>  		err_puts(m, ring_str(err->ring));
> -		err_puts(m, i915_cache_level_str(err->cache_level));
> +		err_puts(m, i915_cache_level_str(m->i915, err->cache_level));
>  
>  		if (err->name)
>  			err_printf(m, " (name: %d)", err->name);
> @@ -502,9 +502,11 @@ out:
>  }
>  
>  int i915_error_state_buf_init(struct drm_i915_error_state_buf *ebuf,
> +			      struct drm_i915_private *i915,
>  			      size_t count, loff_t pos)
>  {
>  	memset(ebuf, 0, sizeof(*ebuf));
> +	ebuf->i915 = i915;
>  
>  	/* We need to have enough room to store any i915_error_state printf
>  	 * so that we can move it to start position.
> @@ -1367,11 +1369,11 @@ void i915_destroy_error_state(struct drm_device *dev)
>  		kref_put(&error->ref, i915_error_state_free);
>  }
>  
> -const char *i915_cache_level_str(int type)
> +const char *i915_cache_level_str(struct drm_i915_private *i915, int type)
>  {
>  	switch (type) {
>  	case I915_CACHE_NONE: return " uncached";
> -	case I915_CACHE_LLC: return " snooped or LLC";
> +	case I915_CACHE_LLC: return HAS_LLC(i915) ? " LLC" : " snooped";
>  	case I915_CACHE_L3_LLC: return " L3+LLC";
>  	case I915_CACHE_WT: return " WT";
>  	default: return "";
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
> index ae7fd8fc27f0..503847f18fdd 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -540,7 +540,7 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj,
>  
>  	memset(&error_priv, 0, sizeof(error_priv));
>  
> -	ret = i915_error_state_buf_init(&error_str, count, off);
> +	ret = i915_error_state_buf_init(&error_str, to_i915(dev), count, off);
>  	if (ret)
>  		return ret;
>  
> -- 
> 2.1.0
> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Ville Syrjälä
Intel OTC

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

* Re: [PATCH] drm/i915: Differentiate between LLC or snooped for the user
  2014-08-25 12:34 ` Ville Syrjälä
@ 2014-08-27  5:54   ` Daniel Vetter
  0 siblings, 0 replies; 3+ messages in thread
From: Daniel Vetter @ 2014-08-27  5:54 UTC (permalink / raw)
  To: Ville Syrjälä; +Cc: intel-gfx

On Mon, Aug 25, 2014 at 03:34:20PM +0300, Ville Syrjälä wrote:
> On Fri, Aug 22, 2014 at 02:41:39PM +0100, Chris Wilson wrote:
> > Rather than describing an object as either "snooped or LLC", we can do
> > better as we should know what machine we are running on!
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> 
> Indeed, makes things less confusing.
> 
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

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

> 
> > ---
> >  drivers/gpu/drm/i915/i915_debugfs.c   | 4 ++--
> >  drivers/gpu/drm/i915/i915_drv.h       | 4 +++-
> >  drivers/gpu/drm/i915/i915_gpu_error.c | 8 +++++---
> >  drivers/gpu/drm/i915/i915_sysfs.c     | 2 +-
> >  4 files changed, 11 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
> > index 19f27d7f1d9b..eb1859f87a88 100644
> > --- a/drivers/gpu/drm/i915/i915_debugfs.c
> > +++ b/drivers/gpu/drm/i915/i915_debugfs.c
> > @@ -137,7 +137,7 @@ describe_obj(struct seq_file *m, struct drm_i915_gem_object *obj)
> >  		   i915_request_seqno(rq),
> >  		   i915_request_seqno(obj->last_write.request),
> >  		   i915_request_seqno(obj->last_fence.request),
> > -		   i915_cache_level_str(obj->cache_level),
> > +		   i915_cache_level_str(to_i915(obj->base.dev), obj->cache_level),
> >  		   obj->dirty ? " dirty" : "",
> >  		   obj->madv == I915_MADV_DONTNEED ? " purgeable" : "");
> >  	if (obj->base.name)
> > @@ -1014,7 +1014,7 @@ static ssize_t i915_error_state_read(struct file *file, char __user *userbuf,
> >  	ssize_t ret_count = 0;
> >  	int ret;
> >  
> > -	ret = i915_error_state_buf_init(&error_str, count, *pos);
> > +	ret = i915_error_state_buf_init(&error_str, to_i915(error_priv->dev), count, *pos);
> >  	if (ret)
> >  		return ret;
> >  
> > diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> > index 1e3179faef7c..1439da02f6f2 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.h
> > +++ b/drivers/gpu/drm/i915/i915_drv.h
> > @@ -1162,6 +1162,7 @@ struct i915_gem_mm {
> >  };
> >  
> >  struct drm_i915_error_state_buf {
> > +	struct drm_i915_private *i915;
> >  	unsigned bytes;
> >  	unsigned size;
> >  	int err;
> > @@ -2748,6 +2749,7 @@ void i915_error_printf(struct drm_i915_error_state_buf *e, const char *f, ...);
> >  int i915_error_state_to_str(struct drm_i915_error_state_buf *estr,
> >  			    const struct i915_error_state_file_priv *error);
> >  int i915_error_state_buf_init(struct drm_i915_error_state_buf *eb,
> > +			      struct drm_i915_private *i915,
> >  			      size_t count, loff_t pos);
> >  static inline void i915_error_state_buf_release(
> >  	struct drm_i915_error_state_buf *eb)
> > @@ -2762,7 +2764,7 @@ void i915_error_state_put(struct i915_error_state_file_priv *error_priv);
> >  void i915_destroy_error_state(struct drm_device *dev);
> >  
> >  void i915_get_extra_instdone(struct drm_device *dev, uint32_t *instdone);
> > -const char *i915_cache_level_str(int type);
> > +const char *i915_cache_level_str(struct drm_i915_private *i915, int type);
> >  
> >  /* i915_cmd_parser.c */
> >  int i915_cmd_parser_get_version(void);
> > diff --git a/drivers/gpu/drm/i915/i915_gpu_error.c b/drivers/gpu/drm/i915/i915_gpu_error.c
> > index b3d6e913917d..51e45eaafc2e 100644
> > --- a/drivers/gpu/drm/i915/i915_gpu_error.c
> > +++ b/drivers/gpu/drm/i915/i915_gpu_error.c
> > @@ -208,7 +208,7 @@ static void print_error_buffers(struct drm_i915_error_state_buf *m,
> >  		err_puts(m, err->userptr ? " userptr" : "");
> >  		err_puts(m, err->ring != -1 ? " " : "");
> >  		err_puts(m, ring_str(err->ring));
> > -		err_puts(m, i915_cache_level_str(err->cache_level));
> > +		err_puts(m, i915_cache_level_str(m->i915, err->cache_level));
> >  
> >  		if (err->name)
> >  			err_printf(m, " (name: %d)", err->name);
> > @@ -502,9 +502,11 @@ out:
> >  }
> >  
> >  int i915_error_state_buf_init(struct drm_i915_error_state_buf *ebuf,
> > +			      struct drm_i915_private *i915,
> >  			      size_t count, loff_t pos)
> >  {
> >  	memset(ebuf, 0, sizeof(*ebuf));
> > +	ebuf->i915 = i915;
> >  
> >  	/* We need to have enough room to store any i915_error_state printf
> >  	 * so that we can move it to start position.
> > @@ -1367,11 +1369,11 @@ void i915_destroy_error_state(struct drm_device *dev)
> >  		kref_put(&error->ref, i915_error_state_free);
> >  }
> >  
> > -const char *i915_cache_level_str(int type)
> > +const char *i915_cache_level_str(struct drm_i915_private *i915, int type)
> >  {
> >  	switch (type) {
> >  	case I915_CACHE_NONE: return " uncached";
> > -	case I915_CACHE_LLC: return " snooped or LLC";
> > +	case I915_CACHE_LLC: return HAS_LLC(i915) ? " LLC" : " snooped";
> >  	case I915_CACHE_L3_LLC: return " L3+LLC";
> >  	case I915_CACHE_WT: return " WT";
> >  	default: return "";
> > diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
> > index ae7fd8fc27f0..503847f18fdd 100644
> > --- a/drivers/gpu/drm/i915/i915_sysfs.c
> > +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> > @@ -540,7 +540,7 @@ static ssize_t error_state_read(struct file *filp, struct kobject *kobj,
> >  
> >  	memset(&error_priv, 0, sizeof(error_priv));
> >  
> > -	ret = i915_error_state_buf_init(&error_str, count, off);
> > +	ret = i915_error_state_buf_init(&error_str, to_i915(dev), count, off);
> >  	if (ret)
> >  		return ret;
> >  
> > -- 
> > 2.1.0
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Ville Syrjälä
> Intel OTC
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

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

end of thread, other threads:[~2014-08-27  5:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-22 13:41 [PATCH] drm/i915: Differentiate between LLC or snooped for the user Chris Wilson
2014-08-25 12:34 ` Ville Syrjälä
2014-08-27  5:54   ` Daniel Vetter

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.