mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "陈涛涛 Taotao Chen" <chentaotao@didiglobal.com>
To: "andi.shyti@kernel.org" <andi.shyti@kernel.org>,
	"rodrigo.vivi@intel.com" <rodrigo.vivi@intel.com>
Cc: "airlied@gmail.com" <airlied@gmail.com>,
	"brauner@kernel.org" <brauner@kernel.org>,
	"陈涛涛 Taotao Chen" <chentaotao@didiglobal.com>,
	"intel-gfx@lists.freedesktop.org"
	<intel-gfx@lists.freedesktop.org>,
	"jani.nikula@linux.intel.com" <jani.nikula@linux.intel.com>,
	"joonas.lahtinen@linux.intel.com"
	<joonas.lahtinen@linux.intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"lkp@intel.com" <lkp@intel.com>,
	"oe-lkp@lists.linux.dev" <oe-lkp@lists.linux.dev>,
	"oliver.sang@intel.com" <oliver.sang@intel.com>,
	"simona@ffwll.ch" <simona@ffwll.ch>,
	"tursulin@ursulin.net" <tursulin@ursulin.net>
Subject: Re: [PATCH 1/2] drm/i915: set O_LARGEFILE in __create_shmem()
Date: Thu, 21 Aug 2025 03:21:59 +0000	[thread overview]
Message-ID: <20250821032156.4946-1-chentaotao@didiglobal.com> (raw)
In-Reply-To: <nd2sd2vdwif242wslgkaonuvskawho36bp6j6a4caghauzx6f5@dgkaow5idqxt>

From: Taotao Chen <chentaotao@didiglobal.com>

Hi Andi,

> Hi Taotao,
> 
>> Reported-by: kernel test robot <oliver.sang@intel.com>
>> Closes: https://lore.kernel.org/oe-lkp/202508081029.343192ec-lkp@intel.com
>
> ...
> 
>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
>> index e3d188455f67..2b53aad915f5 100644
>> --- a/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_shmem.c
>> @@ -514,6 +514,11 @@ static int __create_shmem(struct drm_i915_private *i915,
>>  	if (IS_ERR(filp))
>>  		return PTR_ERR(filp);
>>  
>> +	/*
>> +	 * Prevent -EFBIG by allowing large writes beyond MAX_NON_LFS on shmem
>> +	 * objects by setting O_LARGEFILE.
>> +	 */
>> +	filp->f_flags |= O_LARGEFILE;
>
> I don't have anything against this, but is it really fixing the
> issue? I thought that O_LARGEFILE is ignored in 64 bit machines,
> while here the failure is happening in 64 bit machines.

As mentioned in the commit body, without O_LARGEFILE, file->f_op->write_iter
calls generic_write_check_limits(), which enforces the 2GB (MAX_NON_LFS) limit
and causes -EFBIG on large writes.

On 64-bit systems O_LARGEFILE is still set when opening files (e.g. via open()),
so we also need to set it here for shmem objects created inside the kernel.

However, on older 32-bit systems, setting O_LARGEFILE unconditionally may be risky.
Previously I did not check this, but to reduce the risk a safer approach is to wrap
it in a check, for example:

+	if (force_o_largefile())
+		filp->f_flags |= O_LARGEFILE;

>
> Besides, where do you see in the LKP logs the -EFBIG error
> message?
>

Due to the previous return order in shmem_pwrite(), this -EFBIG was being overwritten
by -EIO on short writes. This issue will be fixed in PATCH 2/2.

Taotao

> Andi
>
>>  	obj->filp = filp;
>>  	return 0;
>>  }
>> -- 
>> 2.34.1

  reply	other threads:[~2025-08-21  3:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-11  9:30 陈涛涛 Taotao Chen
2025-08-11  9:31 ` [PATCH 2/2] drm/i915: Fix incorrect error handling in shmem_pwrite() 陈涛涛 Taotao Chen
2025-08-12 14:06   ` Rodrigo Vivi
2025-08-20 17:03     ` Andi Shyti
2025-08-20 17:10   ` Andi Shyti
2025-08-21  3:21     ` 陈涛涛 Taotao Chen [this message]
2025-08-21 12:12       ` [PATCH 1/2] drm/i915: set O_LARGEFILE in __create_shmem() Andi Shyti
2025-08-12 14:03 ` Rodrigo Vivi
2025-08-20 21:31 ` Andi Shyti

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250821032156.4946-1-chentaotao@didiglobal.com \
    --to=chentaotao@didiglobal.com \
    --cc=airlied@gmail.com \
    --cc=andi.shyti@kernel.org \
    --cc=brauner@kernel.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-lkp@lists.linux.dev \
    --cc=oliver.sang@intel.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=simona@ffwll.ch \
    --cc=tursulin@ursulin.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®