diff mbox

[3/5] drm: Add drm_object lease infrastructure [v4]

Message ID 87mv4qx1rt.fsf@keithp.com (mailing list archive)
State New, archived
Headers show

Commit Message

Keith Packard Oct. 16, 2017, 8:42 p.m. UTC
Sean Paul <seanpaul@chromium.org> writes:


> With these nits fixed,
> Reviewed-by: Sean Paul <seanpaul@chromium.org>

Like this?

Comments

Sean Paul Oct. 16, 2017, 9:05 p.m. UTC | #1
On Mon, Oct 16, 2017 at 01:42:46PM -0700, Keith Packard wrote:
> Sean Paul <seanpaul@chromium.org> writes:
> 
> 
> > With these nits fixed,
> > Reviewed-by: Sean Paul <seanpaul@chromium.org>
> 
> Like this?
> 

Perfect, thanks!

Sean

> From 0aa52dd5a0873831c79c14942075354c041e5bed Mon Sep 17 00:00:00 2001
> From: Keith Packard <keithp@keithp.com>
> Date: Mon, 16 Oct 2017 13:41:20 -0700
> Subject: [PATCH] drm: Mark functions requiring idr_mutex. Add lockdep to
>  _drm_lease_revoke
> 
> Reasonable suggestions by Sean Paul.
> 
> Signed-off-by: Keith Packard <keithp@keithp.com>
> ---
>  drivers/gpu/drm/drm_lease.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
> index 88c213f9c4ab..20694c77a2de 100644
> --- a/drivers/gpu/drm/drm_lease.c
> +++ b/drivers/gpu/drm/drm_lease.c
> @@ -58,7 +58,9 @@ _drm_find_lessee(struct drm_master *master, int lessee_id)
>  }
>  
>  /**
> - * _drm_lease_held_master - check to see if an object is leased (or owned) by master
> + * _drm_lease_held_master - check to see if an object is leased (or
> + *                          owned) by master (idr_mutex held)
> + *
>   * @master: the master to check the lease status of
>   * @id: the id to check
>   *
> @@ -77,7 +79,7 @@ static int _drm_lease_held_master(struct drm_master *master, int id)
>  }
>  
>  /**
> - * _drm_has_leased - check to see if an object has been leased
> + * _drm_has_leased - check to see if an object has been leased (idr mutex held)
>   * @master: the master to check the lease status of
>   * @id: the id to check
>   *
> @@ -300,8 +302,8 @@ void drm_lease_destroy(struct drm_master *master)
>  }
>  
>  /**
> - * _drm_lease_revoke - revoke access to all leased objects
> - * @master: the master losing its lease
> + * _drm_lease_revoke - revoke access to all leased objects (idr_mutex held)
> + * @top: the master losing its lease
>   */
>  
>  void _drm_lease_revoke(struct drm_master *top)
> @@ -310,6 +312,7 @@ void _drm_lease_revoke(struct drm_master *top)
>  	void *entry;
>  	struct drm_master *master = top;
>  
> +	lockdep_assert_held(&top->dev->mode_config.idr_mutex);
>  	/*
>  	 * Walk the tree starting at 'top' emptying all leases. Because
>  	 * the tree is fully connected, we can do this without recursing
> -- 
> 2.15.0.rc0
> 

> 
> 
> -- 
> -keith
diff mbox

Patch

From 0aa52dd5a0873831c79c14942075354c041e5bed Mon Sep 17 00:00:00 2001
From: Keith Packard <keithp@keithp.com>
Date: Mon, 16 Oct 2017 13:41:20 -0700
Subject: [PATCH] drm: Mark functions requiring idr_mutex. Add lockdep to
 _drm_lease_revoke

Reasonable suggestions by Sean Paul.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 drivers/gpu/drm/drm_lease.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
index 88c213f9c4ab..20694c77a2de 100644
--- a/drivers/gpu/drm/drm_lease.c
+++ b/drivers/gpu/drm/drm_lease.c
@@ -58,7 +58,9 @@  _drm_find_lessee(struct drm_master *master, int lessee_id)
 }
 
 /**
- * _drm_lease_held_master - check to see if an object is leased (or owned) by master
+ * _drm_lease_held_master - check to see if an object is leased (or
+ *                          owned) by master (idr_mutex held)
+ *
  * @master: the master to check the lease status of
  * @id: the id to check
  *
@@ -77,7 +79,7 @@  static int _drm_lease_held_master(struct drm_master *master, int id)
 }
 
 /**
- * _drm_has_leased - check to see if an object has been leased
+ * _drm_has_leased - check to see if an object has been leased (idr mutex held)
  * @master: the master to check the lease status of
  * @id: the id to check
  *
@@ -300,8 +302,8 @@  void drm_lease_destroy(struct drm_master *master)
 }
 
 /**
- * _drm_lease_revoke - revoke access to all leased objects
- * @master: the master losing its lease
+ * _drm_lease_revoke - revoke access to all leased objects (idr_mutex held)
+ * @top: the master losing its lease
  */
 
 void _drm_lease_revoke(struct drm_master *top)
@@ -310,6 +312,7 @@  void _drm_lease_revoke(struct drm_master *top)
 	void *entry;
 	struct drm_master *master = top;
 
+	lockdep_assert_held(&top->dev->mode_config.idr_mutex);
 	/*
 	 * Walk the tree starting at 'top' emptying all leases. Because
 	 * the tree is fully connected, we can do this without recursing
-- 
2.15.0.rc0