From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Matt Roper <matthew.d.roper@intel.com>
Cc: Intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [RFC 5/8] drm/i915: Improve the vm_fault_gtt user PAT index restriction
Date: Fri, 28 Jul 2023 13:28:41 +0100 [thread overview]
Message-ID: <712d6084-f5ae-14c9-b9cc-c29389e93447@linux.intel.com> (raw)
In-Reply-To: <20230728000415.GE138014@mdroper-desk1.amr.corp.intel.com>
On 28/07/2023 01:04, Matt Roper wrote:
> On Thu, Jul 27, 2023 at 03:55:01PM +0100, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> Now that i915 understands the caching modes behind PAT indices, we can
>> refine the check in vm_fault_gtt() to not reject the uncached PAT if it
>> was set by userspace on a snoopable platform.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> Cc: Fei Yang <fei.yang@intel.com>
>> Cc: Matt Roper <matthew.d.roper@intel.com>
>> ---
>> drivers/gpu/drm/i915/gem/i915_gem_mman.c | 14 +++-----------
>> 1 file changed, 3 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_mman.c b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
>> index cd7f8ded0d6f..9aa6ecf68432 100644
>> --- a/drivers/gpu/drm/i915/gem/i915_gem_mman.c
>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_mman.c
>> @@ -382,17 +382,9 @@ static vm_fault_t vm_fault_gtt(struct vm_fault *vmf)
>> goto err_reset;
>> }
>>
>> - /*
>> - * For objects created by userspace through GEM_CREATE with pat_index
>> - * set by set_pat extension, coherency is managed by userspace, make
>> - * sure we don't fail handling the vm fault by calling
>> - * i915_gem_object_has_cache_level() which always return true for such
>> - * objects. Otherwise this helper function would fall back to checking
>> - * whether the object is un-cached.
>> - */
>> - if (!((obj->pat_set_by_user ||
>> - i915_gem_object_has_cache_mode(obj, I915_CACHE_MODE_UC)) ||
>> - HAS_LLC(i915))) {
>> + /* Access to snoopable pages through the GTT is incoherent. */
>
> This comment was removed in the previous patch, but now it came back
> here. Should we have just left it be in the previous patch?
Oops yes, fumble when splitting the single patch into this series.
> I'm not really clear on what it means either. Are we using "GTT" as
> shorthand to refer to the aperture here?
It is about CPU mmap access so I think so.
Original code was:
/* Access to snoopable pages through the GTT is incoherent. */
if (obj->cache_level != I915_CACHE_NONE && !HAS_LLC(i915)) {
ret = -EFAULT;
goto err_unpin;
}
Which was disallowing anything not uncached on snoopable platforms. So I
made it equivalent to that:
/* Access to snoopable pages through the GTT is incoherent. */
if (!i915_gem_object_has_cache_mode(obj, I915_CACHE_MODE_UC) &&
!HAS_LLC(i915)) {
ret = -EFAULT;
goto err_unpin;
}
Should be like-for-like assuming PAT-to-cache-mode tables are all good.
On Meteorlake it is no change in behaviour either way due !HAS_LLC.
Regards,
Tvrtko
>
> Matt
>
>> + if (!i915_gem_object_has_cache_mode(obj, I915_CACHE_MODE_UC) &&
>> + !HAS_LLC(i915)) {
>> ret = -EFAULT;
>> goto err_unpin;
>> }
>> --
>> 2.39.2
>>
>
next prev parent reply other threads:[~2023-07-28 12:28 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-27 14:54 [Intel-gfx] [RFC 0/8] Another take on PAT/object cache mode refactoring Tvrtko Ursulin
2023-07-27 14:54 ` [Intel-gfx] [RFC 1/8] drm/i915: Skip clflush after GPU writes on Meteorlake Tvrtko Ursulin
2023-07-27 22:19 ` Matt Roper
2023-07-28 5:50 ` Yang, Fei
2023-07-27 14:54 ` [Intel-gfx] [RFC 2/8] drm/i915: Split PTE encode between Gen12 and Meteorlake Tvrtko Ursulin
2023-07-27 22:25 ` Matt Roper
2023-07-28 8:18 ` Tvrtko Ursulin
2023-07-28 14:41 ` Matt Roper
2023-07-27 14:54 ` [Intel-gfx] [RFC 3/8] drm/i915: Cache PAT index used by the driver Tvrtko Ursulin
2023-07-27 22:44 ` Matt Roper
2023-07-28 12:03 ` Tvrtko Ursulin
2023-07-27 14:55 ` [Intel-gfx] [RFC 4/8] drm/i915: Refactor PAT/object cache handling Tvrtko Ursulin
2023-07-27 23:57 ` Matt Roper
2023-07-28 0:17 ` Matt Roper
2023-07-28 12:35 ` Tvrtko Ursulin
2023-07-28 12:23 ` Tvrtko Ursulin
2023-07-28 12:39 ` Tvrtko Ursulin
2023-07-28 14:53 ` Matt Roper
2023-07-28 7:14 ` Yang, Fei
2023-07-28 12:55 ` Tvrtko Ursulin
2023-07-27 14:55 ` [Intel-gfx] [RFC 5/8] drm/i915: Improve the vm_fault_gtt user PAT index restriction Tvrtko Ursulin
2023-07-28 0:04 ` Matt Roper
2023-07-28 12:28 ` Tvrtko Ursulin [this message]
2023-07-27 14:55 ` [Intel-gfx] [RFC 6/8] drm/i915: Lift the user PAT restriction from gpu_write_needs_clflush Tvrtko Ursulin
2023-07-28 0:05 ` Matt Roper
2023-07-27 14:55 ` [Intel-gfx] [RFC 7/8] drm/i915: Lift the user PAT restriction from use_cpu_reloc Tvrtko Ursulin
2023-07-28 0:09 ` Matt Roper
2023-07-28 12:45 ` Tvrtko Ursulin
2023-07-27 14:55 ` [Intel-gfx] [RFC 8/8] drm/i915: Refine the caching check in i915_gem_object_can_bypass_llc Tvrtko Ursulin
2023-07-27 19:43 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for Another take on PAT/object cache mode refactoring Patchwork
2023-07-27 19:43 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2023-07-27 20:01 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2023-07-28 1:03 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
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=712d6084-f5ae-14c9-b9cc-c29389e93447@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=matthew.d.roper@intel.com \
/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