From: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: [Intel-gfx] [PATCH v2] drm/i915/gem: reschedule relocations to avoid timeouts
Date: Thu, 11 Aug 2022 11:09:47 +0530 [thread overview]
Message-ID: <20220811053947.3251999-1-syed.abdul.muqthyar.ahmed@intel.com> (raw)
Platforms with greater system memory will need to relocate more entries.
It may lead to soft hangs.
Adding cond_resched() for rescheduling process to avoid timeouts.
Suggested-by: Chris Wilson <chris.p.wilson@intel.com>
Signed-off-by: S A Muqthyar Ahmed <syed.abdul.muqthyar.ahmed@intel.com>
---
drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
index b7b2c14fd9e15e..25ab4b9e20049e 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
@@ -1551,6 +1551,11 @@ static int eb_relocate_vma(struct i915_execbuffer *eb, struct eb_vma *ev)
}
} while (r++, --count);
urelocs += ARRAY_SIZE(stack);
+
+ if (need_resched()) {
+ reloc_cache_reset(&eb->reloc_cache, eb);
+ cond_resched();
+ }
} while (remain);
out:
reloc_cache_reset(&eb->reloc_cache, eb);
@@ -1564,18 +1569,19 @@ eb_relocate_vma_slow(struct i915_execbuffer *eb, struct eb_vma *ev)
struct drm_i915_gem_relocation_entry *relocs =
u64_to_ptr(typeof(*relocs), entry->relocs_ptr);
unsigned int i;
- int err;
+ int err = 0;
- for (i = 0; i < entry->relocation_count; i++) {
+ for (i = 0; !err && i < entry->relocation_count; i++) {
u64 offset = eb_relocate_entry(eb, ev, &relocs[i]);
- if ((s64)offset < 0) {
+ if ((s64)offset < 0)
err = (int)offset;
- goto err;
+
+ if (need_resched()) {
+ reloc_cache_reset(&eb->reloc_cache, eb);
+ cond_resched();
}
}
- err = 0;
-err:
reloc_cache_reset(&eb->reloc_cache, eb);
return err;
}
--
2.25.1
next reply other threads:[~2022-08-11 5:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-11 5:39 S A Muqthyar Ahmed [this message]
2022-08-11 7:49 ` [Intel-gfx] ✓ Fi.CI.BAT: success for drm/i915/gem: reschedule relocations to avoid timeouts (rev2) Patchwork
2022-08-11 20:54 ` [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=20220811053947.3251999-1-syed.abdul.muqthyar.ahmed@intel.com \
--to=syed.abdul.muqthyar.ahmed@intel.com \
--cc=intel-gfx@lists.freedesktop.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.