Re: [PATCH v5 06/12] drm/i915: Use huge tmpfs mountpoint helpers

Loïc Molinari
2025-10-22T08:28:08Z

Hi Boris,

On 22/10/2025 10:05, Boris Brezillon wrote:
> On Wed, 22 Oct 2025 11:25:10 +0800
> kernel test robot <lkp@intel.com> wrote:
>
>> Hi Loïc,
>>
>> kernel test robot noticed the following build errors:
>>
>> [auto build test ERROR on next-20251021]
>> [also build test ERROR on v6.18-rc2]
>> [cannot apply to akpm-mm/mm-everything drm-misc/drm-misc-next linus/master v6.18-rc2 v6.18-rc1 v6.17]
>> [If your patch is applied to the wrong git tree, kindly drop us a note.
>> And when submitting patch, we suggest to use '--base' as documented in
>> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>>
>> url: https://github.com/intel-lab-lkp/linux/commits/Lo-c-Molinari/drm-shmem-helper-Simplify-page-offset-calculation-in-fault-handler/20251021-193355
>> base: next-20251021
>> patch link: https://lore.kernel.org/r/20251021113049.17242-7-loic.molinari%40collabora.com
>> patch subject: [PATCH v5 06/12] drm/i915: Use huge tmpfs mountpoint helpers
>> config: x86_64-randconfig-003-20251022 (https://download.01.org/0day-ci/archive/20251022/202510221301.wU3TSqMg-lkp@intel.com/config)
>> compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
>> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251022/202510221301.wU3TSqMg-lkp@intel.com/reproduce)
>>
>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>> the same patch/commit), kindly add following tags
>> | Reported-by: kernel test robot <lkp@intel.com>
>> | Closes: https://lore.kernel.org/oe-kbuild-all/202510221301.wU3TSqMg-lkp@intel.com/
>>
>> All errors (new ones prefixed by >>):
>>
>> drivers/gpu/drm/i915/gem/i915_gem_shmem.c: In function '__create_shmem':
>>>> drivers/gpu/drm/i915/gem/i915_gem_shmem.c:511:59: error: 'struct drm_device' has no member named 'huge_mnt'
>> 511 | filp = shmem_file_setup_with_mnt(i915->drm.huge_mnt, "i915",
>> | ^
>>
>>
>> vim +511 drivers/gpu/drm/i915/gem/i915_gem_shmem.c
>>
>> 486
>> 487 static int __create_shmem(struct drm_i915_private *i915,
>> 488 struct drm_gem_object *obj,
>> 489 resource_size_t size)
>> 490 {
>> 491 unsigned long flags = VM_NORESERVE;
>> 492 struct file *filp;
>> 493
>> 494 drm_gem_private_object_init(&i915->drm, obj, size);
>> 495
>> 496 /* XXX: The __shmem_file_setup() function returns -EINVAL if size is
>> 497 * greater than MAX_LFS_FILESIZE.
>> 498 * To handle the same error as other code that returns -E2BIG when
>> 499 * the size is too large, we add a code that returns -E2BIG when the
>> 500 * size is larger than the size that can be handled.
>> 501 * If BITS_PER_LONG is 32, size > MAX_LFS_FILESIZE is always false,
>> 502 * so we only needs to check when BITS_PER_LONG is 64.
>> 503 * If BITS_PER_LONG is 32, E2BIG checks are processed when
>> 504 * i915_gem_object_size_2big() is called before init_object() callback
>> 505 * is called.
>> 506 */
>> 507 if (BITS_PER_LONG == 64 && size > MAX_LFS_FILESIZE)
>> 508 return -E2BIG;
>> 509
>> 510 if (drm_gem_has_huge_mnt(&i915->drm))
>> > 511 filp = shmem_file_setup_with_mnt(i915->drm.huge_mnt, "i915",
>> 512 size, flags);
>
> Maybe instead of this drm_gem_has_huge_mnt() (or in addition to), we
> should have a drm_gem_get_huge_mnt() helper, so we don't have drivers
> dereferencing drm_device::huge_mnt directly and we can get rid of it on
> non THP configs.

Yes, drm_gem_get_huge_mnt() should be enough. This would prevent build
errors like that for builds with CONFIG_TRANSPARENT_PAGE=n without
having to insert ifdefs and would also just compile to a single
shmem_file_setup() here. The few places which actually need a boolean
value can simply do !!drm_gem_get_huge_mnt(dev).

>
>> 513 else
>> 514 filp = shmem_file_setup("i915", size, flags);
>> 515 if (IS_ERR(filp))
>> 516 return PTR_ERR(filp);
>> 517
>> 518 /*
>> 519 * Prevent -EFBIG by allowing large writes beyond MAX_NON_LFS on shmem
>> 520 * objects by setting O_LARGEFILE.
>> 521 */
>> 522 if (force_o_largefile())
>> 523 filp->f_flags |= O_LARGEFILE;
>> 524
>> 525 obj->filp = filp;
>> 526 return 0;
>> 527 }
>> 528
>>
>

Regards,
Loïc