dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Daniel Vetter <daniel.vetter@intel.com>
Subject: Re: [PATCH] drm/doc: Unify KMS Locking docs
Date: Mon, 30 May 2016 11:19:10 +0200	[thread overview]
Message-ID: <20160530091910.GE27098@phenom.ffwll.local> (raw)
In-Reply-To: <1464599449-12509-1-git-send-email-daniel.vetter@ffwll.ch>

On Mon, May 30, 2016 at 11:10:49AM +0200, Daniel Vetter wrote:
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>

Merged with Jani's irc-ack - we want to get all things docbook merged
before the big sphinx conversion happens.
-Daniel

> ---
>  Documentation/DocBook/gpu.tmpl     | 16 ----------------
>  drivers/gpu/drm/drm_modeset_lock.c | 11 +++++++++--
>  2 files changed, 9 insertions(+), 18 deletions(-)
> 
> diff --git a/Documentation/DocBook/gpu.tmpl b/Documentation/DocBook/gpu.tmpl
> index d755d53615d7..cb130514cedf 100644
> --- a/Documentation/DocBook/gpu.tmpl
> +++ b/Documentation/DocBook/gpu.tmpl
> @@ -1092,22 +1092,6 @@ int max_width, max_height;</synopsis>
>          operation.
>        </para>
>      </sect2>
> -    <sect2>
> -      <title>Locking</title>
> -      <para>
> -        Beside some lookup structures with their own locking (which is hidden
> -	behind the interface functions) most of the modeset state is protected
> -	by the <code>dev-&lt;mode_config.lock</code> mutex and additionally
> -	per-crtc locks to allow cursor updates, pageflips and similar operations
> -	to occur concurrently with background tasks like output detection.
> -	Operations which cross domains like a full modeset always grab all
> -	locks. Drivers there need to protect resources shared between crtcs with
> -	additional locking. They also need to be careful to always grab the
> -	relevant crtc locks if a modset functions touches crtc state, e.g. for
> -	load detection (which does only grab the <code>mode_config.lock</code>
> -	to allow concurrent screen updates on live crtcs).
> -      </para>
> -    </sect2>
>    </sect1>
>  
>    <!-- Internals: kms initialization and cleanup -->
> diff --git a/drivers/gpu/drm/drm_modeset_lock.c b/drivers/gpu/drm/drm_modeset_lock.c
> index e3a4adf03e7b..f33ebe638a28 100644
> --- a/drivers/gpu/drm/drm_modeset_lock.c
> +++ b/drivers/gpu/drm/drm_modeset_lock.c
> @@ -30,12 +30,12 @@
>   *
>   * As KMS moves toward more fine grained locking, and atomic ioctl where
>   * userspace can indirectly control locking order, it becomes necessary
> - * to use ww_mutex and acquire-contexts to avoid deadlocks.  But because
> + * to use &ww_mutex and acquire-contexts to avoid deadlocks.  But because
>   * the locking is more distributed around the driver code, we want a bit
>   * of extra utility/tracking out of our acquire-ctx.  This is provided
>   * by drm_modeset_lock / drm_modeset_acquire_ctx.
>   *
> - * For basic principles of ww_mutex, see: Documentation/locking/ww-mutex-design.txt
> + * For basic principles of &ww_mutex, see: Documentation/locking/ww-mutex-design.txt
>   *
>   * The basic usage pattern is to:
>   *
> @@ -51,6 +51,13 @@
>   *     ... do stuff ...
>   *     drm_modeset_drop_locks(&ctx);
>   *     drm_modeset_acquire_fini(&ctx);
> + *
> + *  On top of of these per-object locks using &ww_mutex there's also an overall
> + *  dev->mode_config.lock, for protecting everything else. Mostly this means
> + *  probe state of connectors, and preventing hotplug add/removal of connectors.
> + *
> + *  Finally there's a bunch of dedicated locks to protect drm core internal
> + *  lists and lookup data structures.
>   */
>  
>  /**
> -- 
> 2.8.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

      reply	other threads:[~2016-05-30  9:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-30  9:10 [PATCH] drm/doc: Unify KMS Locking docs Daniel Vetter
2016-05-30  9:19 ` 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=20160530091910.GE27098@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).