diff mbox series

drm/i915/dpt: Make DPT object unshrinkable

Message ID 20240520152410.1098393-1-vidya.srinivas@intel.com (mailing list archive)
State New, archived
Headers show
Series drm/i915/dpt: Make DPT object unshrinkable | expand

Commit Message

Srinivas, Vidya May 20, 2024, 3:24 p.m. UTC
In some scenarios, the DPT object gets shrunk but
the actual framebuffer did not and thus its still
there on the DPT's vm->bound_list. Then it tries to
rewrite the PTEs via a stale CPU mapping. This causes panic.

Credits-to: Ville Syrjala <ville.syrjala@linux.intel.com>
	    Shawn Lee <shawn.c.lee@intel.com>

Signed-off-by: Srinivas, Vidya <vidya.srinivas@intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_object.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Ville Syrjälä May 20, 2024, 4:39 p.m. UTC | #1
On Mon, May 20, 2024 at 08:54:10PM +0530, Srinivas, Vidya wrote:
> In some scenarios, the DPT object gets shrunk but
> the actual framebuffer did not and thus its still
> there on the DPT's vm->bound_list. Then it tries to
> rewrite the PTEs via a stale CPU mapping. This causes panic.
> 
> Credits-to: Ville Syrjala <ville.syrjala@linux.intel.com>
> 	    Shawn Lee <shawn.c.lee@intel.com>
> 
> Signed-off-by: Srinivas, Vidya <vidya.srinivas@intel.com>

The format should be "first_name last_name <email>"

We also probably want
Cc: stable@vger.kernel.org
Fixes: 0dc987b699ce ("drm/i915/display: Add smem fallback allocation for dpt")

Although the patch won't actually build unless we also have 
commit 779cb5ba64ec ("drm/i915/dpt: Treat the DPT BO as a framebuffer")
but that hast the same fixes tag, so should be fine even if
someone backports things that far back.

> ---
>  drivers/gpu/drm/i915/gem/i915_gem_object.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.h b/drivers/gpu/drm/i915/gem/i915_gem_object.h
> index 3560a062d287..e6b485fc54d4 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_object.h
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h
> @@ -284,7 +284,8 @@ bool i915_gem_object_has_iomem(const struct drm_i915_gem_object *obj);
>  static inline bool
>  i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj)
>  {

Maybe toss something like this here:
/* TODO: make DPT shrinkable when it has no bound vmas */

DPTs aren't necessarily so small that shrinking them wouldn't
have any benefits. But actually implementing that would require
some actual work, so not suitable for a quick fix.

I can add all that stuff when applying the patch, no need to
resend for this.

> -	return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE);
> +	return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE) &&
> +		!obj->is_dpt;
>  }
>  
>  static inline bool
> -- 
> 2.34.1
Srinivas, Vidya May 20, 2024, 5:14 p.m. UTC | #2
> -----Original Message-----
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Sent: Monday, May 20, 2024 10:10 PM
> To: Srinivas, Vidya <vidya.srinivas@intel.com>
> Cc: intel-gfx@lists.freedesktop.org; Syrjala, Ville <ville.syrjala@intel.com>; Lee,
> Shawn C <shawn.c.lee@intel.com>; Srinivas@freedesktop.org
> Subject: Re: [PATCH] drm/i915/dpt: Make DPT object unshrinkable
> 
> On Mon, May 20, 2024 at 08:54:10PM +0530, Srinivas, Vidya wrote:
> > In some scenarios, the DPT object gets shrunk but the actual
> > framebuffer did not and thus its still there on the DPT's
> > vm->bound_list. Then it tries to rewrite the PTEs via a stale CPU
> > mapping. This causes panic.
> >
> > Credits-to: Ville Syrjala <ville.syrjala@linux.intel.com>
> > 	    Shawn Lee <shawn.c.lee@intel.com>
> >
> > Signed-off-by: Srinivas, Vidya <vidya.srinivas@intel.com>
> 
> The format should be "first_name last_name <email>"

Apologies for the mistake. My gitconfig got messed up.

> 
> We also probably want
> Cc: stable@vger.kernel.org
> Fixes: 0dc987b699ce ("drm/i915/display: Add smem fallback allocation for
> dpt")
> 
Thank you so much. Will float new patch with this added.

> Although the patch won't actually build unless we also have commit
> 779cb5ba64ec ("drm/i915/dpt: Treat the DPT BO as a framebuffer") but that
> hast the same fixes tag, so should be fine even if someone backports things
> that far back.
> 
> > ---
> >  drivers/gpu/drm/i915/gem/i915_gem_object.h | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.h
> > b/drivers/gpu/drm/i915/gem/i915_gem_object.h
> > index 3560a062d287..e6b485fc54d4 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_object.h
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h
> > @@ -284,7 +284,8 @@ bool i915_gem_object_has_iomem(const struct
> > drm_i915_gem_object *obj);  static inline bool
> > i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj)
> > {
> 
> Maybe toss something like this here:
> /* TODO: make DPT shrinkable when it has no bound vmas */
> 
> DPTs aren't necessarily so small that shrinking them wouldn't have any
> benefits. But actually implementing that would require some actual work, so
> not suitable for a quick fix.
> 
> I can add all that stuff when applying the patch, no need to resend for this.
> 
> > -	return i915_gem_object_type_has(obj,
> I915_GEM_OBJECT_IS_SHRINKABLE);
> > +	return i915_gem_object_type_has(obj,
> I915_GEM_OBJECT_IS_SHRINKABLE) &&
> > +		!obj->is_dpt;
> >  }
> >
> >  static inline bool
> > --
> > 2.34.1
> 
> --
> Ville Syrjälä
> Intel
diff mbox series

Patch

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_object.h b/drivers/gpu/drm/i915/gem/i915_gem_object.h
index 3560a062d287..e6b485fc54d4 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_object.h
+++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h
@@ -284,7 +284,8 @@  bool i915_gem_object_has_iomem(const struct drm_i915_gem_object *obj);
 static inline bool
 i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj)
 {
-	return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE);
+	return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE) &&
+		!obj->is_dpt;
 }
 
 static inline bool