Commit d7c0bcf2 authored by Brian Geffon's avatar Brian Geffon Committed by Hubert Mazur
Browse files

FROMLIST: 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@vger.kernel.org
Cc: Ville Syrjala <ville.syrjala@linux.intel.com>
Cc: Vidya Srinivas <vidya.srinivas@intel.com>
Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/13487
Link: https://lore.kernel.org/lkml/20250116135636.410164-1-bgeffon@google.com/


Fixes: 0b62af28 ("i915: convert shmem_sg_free_table() to use a folio_batch")
Signed-off-by: default avatarBrian Geffon <bgeffon@google.com>
Suggested-by: default avatarTomasz Figa <tfiga@google.com>
Reviewed-by: default avatarJonathan Cavitt <jonathan.cavitt@intel.com>
Tested-by: default avatarVidya Srinivas <vidya.srinivas@intel.com>
(am from https://patchwork.kernel.org/patch/13951705/)
(also found at https://lore.kernel.org/r/20250127204332.336665-1-bgeffon@google.com

)

BUG=b:341810357
TEST=fixes local repro

Change-Id: I53426e2d57d2bf4fe790fe0bb14aab0e52d9043c
Signed-off-by: default avatarBrian Geffon <bgeffon@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/6207891


Reviewed-by: default avatarPrahlad Kilambi <prahladk@google.com>
Reviewed-by: default avatarSean Paul <sean@poorly.run>
Commit-Queue: Sean Paul <seanpaul@chromium.org>
Reviewed-by: default avatarDrew Davenport <ddavenport@chromium.org>
Reviewed-by: default avatarSean Paul <seanpaul@chromium.org>
Signed-off-by: default avatarHubert Mazur <hmazur@google.com>
parent 31c97627
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment