From: "Thomas Hellström" <thomas.hellstrom@linux.intel.com>
To: Matthew Auld <matthew.william.auld@gmail.com>
Cc: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
Matthew Auld <matthew.auld@intel.com>,
ML dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/ttm: Fix incorrect assumptions about ttm_bo_validate() semantics
Date: Fri, 18 Jun 2021 14:41:06 +0200 [thread overview]
Message-ID: <e489a32f-198b-2860-8d22-b88a9f51eb2c@linux.intel.com> (raw)
In-Reply-To: <CAM0jSHMLmWGfVQEZu9R__SGsAAjfPMSOHxgyXf8veYVxOOa8Mw@mail.gmail.com>
On 6/18/21 12:53 PM, Matthew Auld wrote:
> On Fri, 18 Jun 2021 at 09:31, Thomas Hellström
> <thomas.hellstrom@linux.intel.com> wrote:
>> We have assumed that if the current placement was not the requested
>> placement, but instead one of the busy placements, a TTM move would have
>> been triggered. That is not the case.
>>
>> So when we initially place LMEM objects in "Limbo", (that is system
>> placement without any pages allocated), to be able to defer clearing
>> objects until first get_pages(), the first get_pages() would happily keep
>> objects in system memory if that is one of the allowed placements. And
>> since we don't yet support i915 GEM system memory from TTM, everything
>> breaks apart.
>>
>> So make sure we try the requested placement first, if no eviction is
>> needed. If that fails, retry with all allowed placements also allowing
>> evictions. Also make sure we handle TTM failure codes correctly.
>>
>> Also temporarily (until we support i915 GEM system on TTM), restrict
>> allowed placements to the requested placement to avoid things falling
>> apart should LMEM be full.
>>
>> Fixes: 38f28c0695c0 ("drm/i915/ttm: Calculate the object placement at get_pages time)
>> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
>> ---
>> drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 61 +++++++++++++++++++++++--
>> 1 file changed, 58 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
>> index df46535cca47..4bb0440f693c 100644
>> --- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
>> +++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c
>> @@ -64,6 +64,30 @@ static struct ttm_placement i915_sys_placement = {
>> .busy_placement = &sys_placement_flags,
>> };
>>
>> +static int i915_ttm_err_to_gem(int err)
>> +{
>> + /* Fastpath */
>> + if (likely(!err))
>> + return 0;
>> +
>> + switch (err) {
>> + case -EBUSY:
>> + /*
>> + * TTM likes to convert -EDEADLK to -EBUSY, and wants us to
>> + * restart the operation, since we don't record the contending
>> + * lock. We use -EAGAIN to restart.
>> + */
>> + return -EAGAIN;
>> + case -ENOSPC:
>> + /* Memory type / region is full, and we can't evict. */
>> + return -ENXIO;
> ttm system will return -ENOMEM right?
>
> Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Hmm, Yes, I suppose so. Will that need some mangling before handing over
to GEM?
Thanks for reviewing!
Thomas
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
prev parent reply other threads:[~2021-06-18 12:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-18 8:31 [Intel-gfx] [PATCH] drm/i915/ttm: Fix incorrect assumptions about ttm_bo_validate() semantics Thomas Hellström
2021-06-18 9:11 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2021-06-18 10:26 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2021-06-18 12:07 ` Thomas Hellström
2021-06-18 10:53 ` [Intel-gfx] [PATCH] " Matthew Auld
2021-06-18 12:41 ` Thomas Hellström [this message]
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=e489a32f-198b-2860-8d22-b88a9f51eb2c@linux.intel.com \
--to=thomas.hellstrom@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=matthew.auld@intel.com \
--cc=matthew.william.auld@gmail.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