From: "Hellstrom, Thomas" <thomas.hellstrom@intel.com>
To: "Souza, Jose" <jose.souza@intel.com>,
"airlied@linux.ie" <airlied@linux.ie>,
"jiasheng@iscas.ac.cn" <jiasheng@iscas.ac.cn>,
"Vivi, Rodrigo" <rodrigo.vivi@intel.com>,
"Sripada, Radhakrishna" <radhakrishna.sripada@intel.com>,
"joonas.lahtinen@linux.intel.com"
<joonas.lahtinen@linux.intel.com>,
"ville.syrjala@linux.intel.com" <ville.syrjala@linux.intel.com>,
"Roper, Matthew D" <matthew.d.roper@intel.com>,
"tvrtko.ursulin@linux.intel.com" <tvrtko.ursulin@linux.intel.com>,
"Auld, Matthew" <matthew.auld@intel.com>,
"daniel@ffwll.ch" <daniel@ffwll.ch>,
"jani.nikula@linux.intel.com" <jani.nikula@linux.intel.com>,
"De Marchi, Lucas" <lucas.demarchi@intel.com>
Cc: "intel-gfx@lists.freedesktop.org"
<intel-gfx@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH] drm/i915/gt: Handle errors for i915_gem_object_trylock
Date: Thu, 3 Mar 2022 10:22:49 +0000 [thread overview]
Message-ID: <c2f150f4a73739b42c3f70002073c2a5de11ef0e.camel@intel.com> (raw)
In-Reply-To: <9586bba7-ffb8-945f-eb30-88629e34737d@linux.intel.com>
On Wed, 2022-03-02 at 10:37 +0000, Tvrtko Ursulin wrote:
>
> + Thomas, Matt
>
> On 02/03/2022 06:19, Jiasheng Jiang wrote:
> > As the potential failure of the i915_gem_object_trylock(),
> > it should be better to check it and return error if fails.
> >
> > Fixes: 94ce0d65076c ("drm/i915/gt: Setup a default migration
> > context on the GT")
> > Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
> > ---
> > drivers/gpu/drm/i915/gt/selftest_migrate.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/gt/selftest_migrate.c
> > b/drivers/gpu/drm/i915/gt/selftest_migrate.c
> > index fa4293d2944f..79c6c68f7316 100644
> > --- a/drivers/gpu/drm/i915/gt/selftest_migrate.c
> > +++ b/drivers/gpu/drm/i915/gt/selftest_migrate.c
> > @@ -465,7 +465,11 @@ create_init_lmem_internal(struct intel_gt *gt,
> > size_t sz, bool try_lmem)
> > return obj;
> > }
> >
> > - i915_gem_object_trylock(obj, NULL);
>
> Guys why is this a trylock to start with? (Since being added in
> 94ce0d65076c ("drm/i915/gt: Setup a default migration context on the
> GT").
>
> Surely it can't ever fail since the object has just been created.
Typically in some situations, we want to create locked objects when
we're already in a ww transaction and might not have access to the ww
context, in which case an ordinary sleeping lock would trigger a
lockdep splat, so a trylock is used instead since it will never fail.
I once introduced a i915_gem_object_lock_isolated() wrapper around
trylock to annotate this situation, but that was removed during the
obj->mm.lock removal IIRC. Similarly TTM has an option to create an
object locked.
So here we should probably BUG on a trylock failure, if anything.
In the long run we should probably mimic TTM and introduce an
interface to create an object locked.
/Thomas
>
> Regards,
>
> Tvrtko
>
> > + 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);
----------------------------------------------------------------------
Intel Sweden AB
Registered Office: Isafjordsgatan 30B, 164 40 Kista, Stockholm, Sweden
Registration Number: 556189-6027
This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
next prev parent reply other threads:[~2022-03-03 10:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-02 6:19 [Intel-gfx] [PATCH] drm/i915/gt: Handle errors for i915_gem_object_trylock Jiasheng Jiang
2022-03-02 10:37 ` Tvrtko Ursulin
2022-03-03 10:22 ` Hellstrom, Thomas [this message]
2022-03-02 19:01 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2022-03-03 4:38 ` [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=c2f150f4a73739b42c3f70002073c2a5de11ef0e.camel@intel.com \
--to=thomas.hellstrom@intel.com \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=jiasheng@iscas.ac.cn \
--cc=joonas.lahtinen@linux.intel.com \
--cc=jose.souza@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=matthew.auld@intel.com \
--cc=matthew.d.roper@intel.com \
--cc=radhakrishna.sripada@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=tvrtko.ursulin@linux.intel.com \
--cc=ville.syrjala@linux.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