diff mbox

drm/i915/ppgtt: Break loop in gen8_ppgtt_clear_range failure path

Message ID 1435233578-29520-1-git-send-email-michel.thierry@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Michel Thierry June 25, 2015, 11:59 a.m. UTC
If for some reason [1], the page directory/table does not exist, clear_range
would end up in an infinite while loop.

Introduced by commit 06fda602dbca ("drm/i915: Create page table allocators").

[1] This is already being addressed in one of Mika's patches:
http://mid.gmane.org/1432314314-23530-17-git-send-email-mika.kuoppala@intel.com

Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reported-by: John Harrison <john.c.harrison@intel.com>
Signed-off-by: Michel Thierry <michel.thierry@intel.com>
---
 drivers/gpu/drm/i915/i915_gem_gtt.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Mika Kuoppala June 25, 2015, 3:39 p.m. UTC | #1
Michel Thierry <michel.thierry@intel.com> writes:

> If for some reason [1], the page directory/table does not exist, clear_range
> would end up in an infinite while loop.
>
> Introduced by commit 06fda602dbca ("drm/i915: Create page table allocators").
>
> [1] This is already being addressed in one of Mika's patches:
> http://mid.gmane.org/1432314314-23530-17-git-send-email-mika.kuoppala@intel.com
>

We need both.

> Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> Reported-by: John Harrison <john.c.harrison@intel.com>
> Signed-off-by: Michel Thierry <michel.thierry@intel.com>

Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>

> ---
>  drivers/gpu/drm/i915/i915_gem_gtt.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 2279e03..5dbe928 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -517,17 +517,17 @@ static void gen8_ppgtt_clear_range(struct i915_address_space *vm,
>  		struct page *page_table;
>  
>  		if (WARN_ON(!ppgtt->pdp.page_directory[pdpe]))
> -			continue;
> +			break;
>  
>  		pd = ppgtt->pdp.page_directory[pdpe];
>  
>  		if (WARN_ON(!pd->page_table[pde]))
> -			continue;
> +			break;
>  
>  		pt = pd->page_table[pde];
>  
>  		if (WARN_ON(!pt->page))
> -			continue;
> +			break;
>  
>  		page_table = pt->page;
>  
> -- 
> 2.4.4
Daniel Vetter June 25, 2015, 4:04 p.m. UTC | #2
On Thu, Jun 25, 2015 at 06:39:30PM +0300, Mika Kuoppala wrote:
> Michel Thierry <michel.thierry@intel.com> writes:
> 
> > If for some reason [1], the page directory/table does not exist, clear_range
> > would end up in an infinite while loop.
> >
> > Introduced by commit 06fda602dbca ("drm/i915: Create page table allocators").
> >
> > [1] This is already being addressed in one of Mika's patches:
> > http://mid.gmane.org/1432314314-23530-17-git-send-email-mika.kuoppala@intel.com
> >
> 
> We need both.
> 
> > Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
> > Reported-by: John Harrison <john.c.harrison@intel.com>
> > Signed-off-by: Michel Thierry <michel.thierry@intel.com>
> 
> Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>

Since the offending commit is in 4.1 this is for Jani.

Cc: stable@vger.kernel.org

Cheers, Daniel

> 
> > ---
> >  drivers/gpu/drm/i915/i915_gem_gtt.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > index 2279e03..5dbe928 100644
> > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> > @@ -517,17 +517,17 @@ static void gen8_ppgtt_clear_range(struct i915_address_space *vm,
> >  		struct page *page_table;
> >  
> >  		if (WARN_ON(!ppgtt->pdp.page_directory[pdpe]))
> > -			continue;
> > +			break;
> >  
> >  		pd = ppgtt->pdp.page_directory[pdpe];
> >  
> >  		if (WARN_ON(!pd->page_table[pde]))
> > -			continue;
> > +			break;
> >  
> >  		pt = pd->page_table[pde];
> >  
> >  		if (WARN_ON(!pt->page))
> > -			continue;
> > +			break;
> >  
> >  		page_table = pt->page;
> >  
> > -- 
> > 2.4.4
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Jani Nikula June 26, 2015, 10:38 a.m. UTC | #3
On Thu, 25 Jun 2015, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Thu, Jun 25, 2015 at 06:39:30PM +0300, Mika Kuoppala wrote:
>> Michel Thierry <michel.thierry@intel.com> writes:
>> 
>> > If for some reason [1], the page directory/table does not exist, clear_range
>> > would end up in an infinite while loop.
>> >
>> > Introduced by commit 06fda602dbca ("drm/i915: Create page table allocators").
>> >
>> > [1] This is already being addressed in one of Mika's patches:
>> > http://mid.gmane.org/1432314314-23530-17-git-send-email-mika.kuoppala@intel.com
>> >
>> 
>> We need both.
>> 
>> > Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
>> > Reported-by: John Harrison <john.c.harrison@intel.com>
>> > Signed-off-by: Michel Thierry <michel.thierry@intel.com>
>> 
>> Reviewed-by: Mika Kuoppala <mika.kuoppala@intel.com>
>
> Since the offending commit is in 4.1 this is for Jani.
>
> Cc: stable@vger.kernel.org

Pushed to drm-intel-next-fixes, thanks for the patch and review. Fingers
crossed, I hope I didn't screw up the conflict resolution for nightly...

BR,
Jani.

>
> Cheers, Daniel
>
>> 
>> > ---
>> >  drivers/gpu/drm/i915/i915_gem_gtt.c | 6 +++---
>> >  1 file changed, 3 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
>> > index 2279e03..5dbe928 100644
>> > --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
>> > +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
>> > @@ -517,17 +517,17 @@ static void gen8_ppgtt_clear_range(struct i915_address_space *vm,
>> >  		struct page *page_table;
>> >  
>> >  		if (WARN_ON(!ppgtt->pdp.page_directory[pdpe]))
>> > -			continue;
>> > +			break;
>> >  
>> >  		pd = ppgtt->pdp.page_directory[pdpe];
>> >  
>> >  		if (WARN_ON(!pd->page_table[pde]))
>> > -			continue;
>> > +			break;
>> >  
>> >  		pt = pd->page_table[pde];
>> >  
>> >  		if (WARN_ON(!pt->page))
>> > -			continue;
>> > +			break;
>> >  
>> >  		page_table = pt->page;
>> >  
>> > -- 
>> > 2.4.4
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx
>
> -- 
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
index 2279e03..5dbe928 100644
--- a/drivers/gpu/drm/i915/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
@@ -517,17 +517,17 @@  static void gen8_ppgtt_clear_range(struct i915_address_space *vm,
 		struct page *page_table;
 
 		if (WARN_ON(!ppgtt->pdp.page_directory[pdpe]))
-			continue;
+			break;
 
 		pd = ppgtt->pdp.page_directory[pdpe];
 
 		if (WARN_ON(!pd->page_table[pde]))
-			continue;
+			break;
 
 		pt = pd->page_table[pde];
 
 		if (WARN_ON(!pt->page))
-			continue;
+			break;
 
 		page_table = pt->page;