]> Gentwo Git Trees - linux/.git/commit
drm/gpusvm: fix hmm_pfn_to_map_order() usage
authorMatthew Auld <matthew.auld@intel.com>
Thu, 28 Aug 2025 14:24:32 +0000 (15:24 +0100)
committerMatthew Auld <matthew.auld@intel.com>
Fri, 5 Sep 2025 10:45:46 +0000 (11:45 +0100)
commitc50729c68aaf93611c855752b00e49ce1fdd1558
treee83cc5711d777b21b1ffc4b6ea03057d1f137d58
parent5952d80514054d12d2ec72aa111c2e09eb70e881
drm/gpusvm: fix hmm_pfn_to_map_order() usage

Handle the case where the hmm range partially covers a huge page (like
2M), otherwise we can potentially end up doing something nasty like
mapping memory which is outside the range, and maybe not even mapped by
the mm. Fix is based on the xe userptr code, which in a future patch
will directly use gpusvm, so needs alignment here.

v2:
  - Add kernel-doc (Matt B)
  - s/fls/ilog2/ (Thomas)

Reported-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://lore.kernel.org/r/20250828142430.615826-11-matthew.auld@intel.com
drivers/gpu/drm/drm_gpusvm.c