All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: David Herrmann <dh.herrmann@gmail.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	"dri-devel@lists.freedesktop.org"
	<dri-devel@lists.freedesktop.org>
Subject: Re: [PATCH 07/12] drm: drop redundant drm_file->is_master
Date: Fri, 25 Jul 2014 09:56:41 +0200	[thread overview]
Message-ID: <20140725075641.GM4747@phenom.ffwll.local> (raw)
In-Reply-To: <CANq1E4TTBhgXeZgU181skJCECEYKCHNkmTdkjAhVXqygttUhbw@mail.gmail.com>

On Thu, Jul 24, 2014 at 11:38:28PM +0200, David Herrmann wrote:
> On Thu, Jul 24, 2014 at 11:52 AM, Daniel Vetter <daniel@ffwll.ch> wrote:
> > On Wed, Jul 23, 2014 at 05:26:42PM +0200, David Herrmann wrote:
> >> +static inline bool drm_is_master(const struct drm_file *file)
> >> +{
> >
> > Hm, we don't have any means to synchronize is_master checks with
> > concurrent ioctls and stuff. Do we care? Orthogonal issue really.
> 
> We don't.. My drm-master reworks contains a comment about that. It's
> not really problematic as all ioctls run for a determinate time in
> kernel-code except for drm_read(), but drm_read() is per-file, not
> per-device, so we're fine. However, with unfortunate timings, we might
> really end up with problems.
> 
> vmwgfx solves this by using separate locks and verifying them against
> the current master. it's not perfect and I'm not sure I like it better
> than no locks, but at least they were aware of the problem.
> 
> Btw., the only thing I know how to solve it properly is to make
> "master_mutex" an rwlock and all f_op entries take the read-lock,
> while master modifications take the write-lock. Not sure it's worth
> it, though.

Imo that's terrible. And I'm not even sure we need to care, e.g. if we do
a master switch to a different compositor any ioctl the new compositor
does will grab some locks, which will force the old ioctl to complete.

Well mostly, and only if we don't do lockless tricks or lock-dropping and
it's racy.

I guess a proper fix would be to wait for all ioctls on a device to
complete. The vfs doesn't have any cool infrastructure for this as part of
the general revoke work that we could reuse?
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

  reply	other threads:[~2014-07-25  7:56 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-23 15:26 [PATCH 00/12] DRM: Random Cleanups David Herrmann
2014-07-23 15:26 ` [PATCH 01/12] drm: remove unused "struct drm_freelist" David Herrmann
2014-07-23 19:17   ` Daniel Vetter
2014-07-23 15:26 ` [PATCH 02/12] drm: drop unused "struct drm_queue" David Herrmann
2014-07-23 19:35   ` Daniel Vetter
2014-07-24 11:35     ` David Herrmann
2014-07-23 15:26 ` [PATCH 03/12] drm: call ->firstopen() before ->open() David Herrmann
2014-07-23 19:25   ` Daniel Vetter
2014-07-24  9:31     ` David Herrmann
2014-07-24 10:18       ` Daniel Vetter
2014-07-24 13:47       ` Alex Deucher
2014-07-23 15:26 ` [PATCH 04/12] drm: extract legacy ctxbitmap flushing David Herrmann
2014-07-23 19:26   ` Daniel Vetter
2014-07-24  9:34     ` David Herrmann
2014-07-24 10:19       ` Daniel Vetter
2014-07-23 15:26 ` [PATCH 05/12] drm: drop i386 verification David Herrmann
2014-07-23 15:26 ` [PATCH 06/12] drm: fix __alpha__ PCI lookup David Herrmann
2014-07-23 19:29   ` Daniel Vetter
2014-07-23 19:36     ` Daniel Vetter
2014-07-23 15:26 ` [PATCH 07/12] drm: drop redundant drm_file->is_master David Herrmann
2014-07-24  9:52   ` Daniel Vetter
2014-07-24 21:38     ` David Herrmann
2014-07-25  7:56       ` Daniel Vetter [this message]
2014-07-28 15:26         ` David Herrmann
2014-07-23 15:26 ` [PATCH 08/12] drm: don't de-authenticate clients on master-close David Herrmann
2014-07-24  9:57   ` Daniel Vetter
2014-07-23 15:26 ` [PATCH 09/12] drm: move module initialization to drm_stub.c David Herrmann
2014-07-23 15:26 ` [PATCH 10/12] drm: merge drm_drv.c into drm_ioctl.c David Herrmann
2014-07-23 16:16   ` David Herrmann
2014-07-23 19:33   ` Daniel Vetter
2014-07-23 15:26 ` [PATCH 11/12] drm: make minor->index available early David Herrmann
2014-07-24 10:03   ` Daniel Vetter
2014-07-24 10:16     ` David Herrmann
2014-07-24 12:30       ` Daniel Vetter
2014-07-23 15:26 ` [PATCH 12/12] drm: make sysfs device always available for minors David Herrmann
2014-07-24 10:36   ` Daniel Vetter
2014-07-24 10:48     ` David Herrmann
2014-07-24 12:31       ` Daniel Vetter
2014-07-23 16:24 ` [PATCH 00/12] DRM: Random Cleanups Alex Deucher

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=20140725075641.GM4747@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dh.herrmann@gmail.com \
    --cc=dri-devel@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.