From: Rolf Eike Beer <eb@emlix.com>
To: Jani Nikula <jani.nikula@linux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@intel.com>,
Tvrtko Ursulin <tursulin@ursulin.net>
Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] drm/i915/selftests: check the return value of i915_gem_object_trylock()
Date: Thu, 19 Dec 2024 11:16:51 +0100 [thread overview]
Message-ID: <9379466.CDJkKcVGEf@devpool47.emlix.com> (raw)
In-Reply-To: <7746997.EvYhyI6sBW@devpool47.emlix.com>
A trylock can fail, in which case operating on the object is unsafe and
unconditionally unlocking is wrong.
Signed-off-by: Rolf Eike Beer <eb@emlix.com>
---
drivers/gpu/drm/i915/gt/selftest_migrate.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/gt/selftest_migrate.c b/drivers/gpu/drm/i915/gt/selftest_migrate.c
index ca460cee4f8b..b2cb501febe8 100644
--- a/drivers/gpu/drm/i915/gt/selftest_migrate.c
+++ b/drivers/gpu/drm/i915/gt/selftest_migrate.c
@@ -822,7 +822,10 @@ create_init_lmem_internal(struct intel_gt *gt, size_t sz, bool try_lmem)
return obj;
}
- i915_gem_object_trylock(obj, NULL);
+ if (!i915_gem_object_trylock(obj, NULL)) {
+ i915_gem_object_put(obj);
+ return ERR_PTR(-EBUSY);
+ }
err = i915_gem_object_pin_pages(obj);
if (err) {
i915_gem_object_unlock(obj);
--
2.47.1
--
Rolf Eike Beer
emlix GmbH
Headquarters: Berliner Str. 12, 37073 Göttingen, Germany
Phone +49 (0)551 30664-0, e-mail info@emlix.com
District Court of Göttingen, Registry Number HR B 3160
Managing Directors: Heike Jordan, Dr. Uwe Kracke
VAT ID No. DE 205 198 055
Office Berlin: Panoramastr. 1, 10178 Berlin, Germany
Office Bonn: Bachstr. 6, 53115 Bonn, Germany
http://www.emlix.com
emlix - your embedded Linux partner
next prev parent reply other threads:[~2024-12-19 16:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-19 10:16 [PATCH 0/2] annotate i915_gem_object_trylock() as __must_check Rolf Eike Beer
2024-12-19 10:16 ` Rolf Eike Beer [this message]
2024-12-19 10:18 ` [PATCH 2/2] drm/i915: mark " Rolf Eike Beer
2024-12-19 17:10 ` ✗ Fi.CI.CHECKPATCH: warning for annotate " Patchwork
2024-12-19 17:10 ` ✗ Fi.CI.SPARSE: " Patchwork
2024-12-19 17:19 ` ✗ i915.CI.BAT: 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=9379466.CDJkKcVGEf@devpool47.emlix.com \
--to=eb@emlix.com \
--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=rodrigo.vivi@intel.com \
--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 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.