From: Daniel Vetter <daniel@ffwll.ch>
To: "Kristian Høgsberg" <krh@bitplanet.net>
Cc: dri-devel <dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH] drm: Don't reference objects in the flink name idr
Date: Tue, 3 Dec 2013 21:44:33 +0100 [thread overview]
Message-ID: <20131203204433.GR27344@phenom.ffwll.local> (raw)
In-Reply-To: <CAOeoa-e0eD9cz7AJGE4k-dTjKcA3s+hAcHbTwyMzsioh0O1_Yw@mail.gmail.com>
On Tue, Dec 03, 2013 at 08:33:46AM -0800, Kristian Høgsberg wrote:
> On Tue, Dec 3, 2013 at 7:26 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> > On Mon, Dec 02, 2013 at 05:36:17PM -0800, Kristian Høgsberg wrote:
> >> There's no reason to keep a reference to objects in the name idr. Each
> >> handle to an object has a reference to the object and just before we
> >> destroy the last handle we take the object out of the name idr. Thus,
> >> if an object is in the name idr, there's at least one reference to the
> >> object.
> >>
> >> Or to put it another way, the name idr reference will never keep the
> >> object alive. It just looks like it, which is confusing.
> >>
> >> Signed-off-by: Kristian Høgsberg <krh@bitplanet.net>
> >
> > I expect this to blow up when you race gem_close ioctl calls with flink
> > open. i-g-t/gem_flink_close tests actually have been written specifically
> > to exercise these races.
> > -Daniel
>
> Can you be more specific about what race you see? The one thing that
> could go wrong is that the last handle is delete after we enter
> drm_gem_flink_ioctl() and look up the object but before taking the
> object_name_lock, but that's handled by checking obj->handle_count
> under the lock. Deleting handles and removing the name is always done
> under the object_name_lock from
> drm_gem_object_handle_unreference_unlocked().
Too many nightmares around lifetime rules, I've imagined some monster that
isn't ther and stand corrected.
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
--
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
prev parent reply other threads:[~2013-12-03 20:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-03 1:36 [PATCH] drm: Don't reference objects in the flink name idr Kristian Høgsberg
2013-12-03 15:26 ` Daniel Vetter
2013-12-03 16:33 ` Kristian Høgsberg
2013-12-03 20:44 ` Daniel Vetter [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=20131203204433.GR27344@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=krh@bitplanet.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox