[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CH0PR11MB5444F718F2073C04D7F5729AE5EC2@CH0PR11MB5444.namprd11.prod.outlook.com>
Date: Mon, 27 Jan 2025 21:15:21 +0000
From: "Cavitt, Jonathan" <jonathan.cavitt@...el.com>
To: Brian Geffon <bgeffon@...gle.com>, "intel-gfx@...ts.freedesktop.org"
<intel-gfx@...ts.freedesktop.org>
CC: "Wilson, Chris P" <chris.p.wilson@...el.com>, "Saarinen, Jani"
<jani.saarinen@...el.com>, "Mistat, Tomasz" <tomasz.mistat@...el.com>,
"Srinivas, Vidya" <vidya.srinivas@...el.com>, "ville.syrjala@...ux.intel.com"
<ville.syrjala@...ux.intel.com>, "jani.nikula@...ux.intel.com"
<jani.nikula@...ux.intel.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "dri-devel@...ts.freedesktop.org"
<dri-devel@...ts.freedesktop.org>, Joonas Lahtinen
<joonas.lahtinen@...ux.intel.com>, "stable@...r.kernel.org"
<stable@...r.kernel.org>, Tomasz Figa <tfiga@...gle.com>, "Cavitt, Jonathan"
<jonathan.cavitt@...el.com>
Subject: RE: [PATCH v3] drm/i915: Fix page cleanup on DMA remap failure
-----Original Message-----
From: Intel-gfx <intel-gfx-bounces@...ts.freedesktop.org> On Behalf Of Brian Geffon
Sent: Monday, January 27, 2025 12:44 PM
To: intel-gfx@...ts.freedesktop.org
Cc: Wilson, Chris P <chris.p.wilson@...el.com>; Saarinen, Jani <jani.saarinen@...el.com>; Mistat, Tomasz <tomasz.mistat@...el.com>; Srinivas, Vidya <vidya.srinivas@...el.com>; ville.syrjala@...ux.intel.com; jani.nikula@...ux.intel.com; linux-kernel@...r.kernel.org; dri-devel@...ts.freedesktop.org; Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>; Brian Geffon <bgeffon@...gle.com>; stable@...r.kernel.org; Tomasz Figa <tfiga@...gle.com>
Subject: [PATCH v3] drm/i915: Fix page cleanup on DMA remap failure
>
> When converting to folios the cleanup path of shmem_get_pages() was
> missed. When a DMA remap fails and the max segment size is greater than
> PAGE_SIZE it will attempt to retry the remap with a PAGE_SIZEd segment
> size. The cleanup code isn't properly using the folio apis and as a
> result isn't handling compound pages correctly.
>
> v2 -> v3:
> (Ville) Just use shmem_sg_free_table() as-is in the failure path of
> shmem_get_pages(). shmem_sg_free_table() will clear mapping unevictable
> but it will be reset when it retries in shmem_sg_alloc_table().
>
> v1 -> v2:
> (Ville) Fixed locations where we were not clearing mapping unevictable.
>
> Cc: stable@...r.kernel.org
> Cc: Ville Syrjala <ville.syrjala@...ux.intel.com>
> Cc: Vidya Srinivas <vidya.srinivas@...el.com>
> Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13487
> Link: https://lore.kernel.org/lkml/20250116135636.410164-1-bgeffon@google.com/
> Fixes: 0b62af28f249 ("i915: convert shmem_sg_free_table() to use a folio_batch")
> Signed-off-by: Brian Geffon <bgeffon@...gle.com>
> Suggested-by: Tomasz Figa <tfiga@...gle.com>
Seems good to me.
Reviewed-by: Jonathan Cavitt <jonathan.cavitt@...el.com>
-Jonathan Cavitt
> ---
> drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 6 +-----
> 1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
> index fe69f2c8527d..ae3343c81a64 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
> @@ -209,8 +209,6 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj)
> struct address_space *mapping = obj->base.filp->f_mapping;
> unsigned int max_segment = i915_sg_segment_size(i915->drm.dev);
> struct sg_table *st;
> - struct sgt_iter sgt_iter;
> - struct page *page;
> int ret;
>
> /*
> @@ -239,9 +237,7 @@ static int shmem_get_pages(struct drm_i915_gem_object *obj)
> * for PAGE_SIZE chunks instead may be helpful.
> */
> if (max_segment > PAGE_SIZE) {
> - for_each_sgt_page(page, sgt_iter, st)
> - put_page(page);
> - sg_free_table(st);
> + shmem_sg_free_table(st, mapping, false, false);
> kfree(st);
>
> max_segment = PAGE_SIZE;
> --
> 2.48.1.262.g85cc9f2d1e-goog
>
>
Powered by blists - more mailing lists