[Intel-gfx] [PATCH 16/19] drm/i915: Fix l3 parity buffer offset

Ben Widawsky ben at bwidawsk.net
Wed Sep 11 19:07:39 CEST 2013


On Wed, Sep 11, 2013 at 02:45:28PM +0300, Ville Syrjälä wrote:
> On Tue, Sep 10, 2013 at 07:36:45PM -0300, Rodrigo Vivi wrote:
> > From: Ben Widawsky <benjamin.widawsky at intel.com>
> > 
> > The buf pointer used during l3_write is just char *, therefore it does
> > not require the silly /4.
> > 
> > Signed-off-by: Ben Widawsky <ben at bwidawsk.net>
> > Signed-off-by: Rodrigo Vivi <rodrigo.vivi at gmail.com>
> > ---
> >  drivers/gpu/drm/i915/i915_sysfs.c | 4 +---
> >  1 file changed, 1 insertion(+), 3 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
> > index 05195c0..70de7a9 100644
> > --- a/drivers/gpu/drm/i915/i915_sysfs.c
> > +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> > @@ -184,9 +184,7 @@ i915_l3_write(struct file *filp, struct kobject *kobj,
> >  	if (temp)
> >  		dev_priv->l3_parity.remap_info = temp;
> >  
> > -	memcpy(dev_priv->l3_parity.remap_info + (offset/4),
> > -	       buf + (offset/4),
> > -	       count);
> > +	memcpy(dev_priv->l3_parity.remap_info + (offset/4), buf, count);
> 
> The commit message doesn't really reflect the fact that you completely
> remove the offset from 'buf', which is actually the correct thing to do,
> but the commit message should match the patch.

I don't know, it seems pretty clear to me. Shall I just copy and paste
what you wrote here?

> 
> Also i915_l3_read() should get the same fix.

Should it?

> 
> And while on the subject, I don't understand why we're playing weird
> tricks with the remap_info memory allocation. Ie. why don't we simply
> do this?

It was mostly to be able to differentiate NULL vs. 0's. The former being
no remaps ever, the latter being a cleared remapping. That's why temp is
used.

> 
>  ...
>  if (!dev_priv->l3_parity.remap_info) {
>  	dev_priv->l3_parity.remap_info = kzalloc(GEN7_L3LOG_SIZE,
>  	                                         GFP_KERNEL);
> 
>  	if (!dev_priv->l3_parity.remap_info) {
>  		mutex_unlock(&drm_dev->struct_mutex);
>  		return -ENOMEM;
>  	}
>  }
>  ...
> 
> >  
> >  	i915_gem_l3_remap(drm_dev);
> >  
> > -- 
> > 1.8.1.4
> > 
> > _______________________________________________
> > Intel-gfx mailing list
> > Intel-gfx at lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/intel-gfx
> 
> -- 
> Ville Syrjälä
> Intel OTC

-- 
Ben Widawsky, Intel Open Source Technology Center



More information about the Intel-gfx mailing list