All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: "Daniel Vetter" <daniel.vetter@ffwll.ch>,
	"Intel Graphics Development" <intel-gfx@lists.freedesktop.org>,
	"Thomas Hellström" <thellstrom@vmware.com>,
	"Daniel Vetter" <daniel.vetter@intel.com>
Subject: [PATCH] drm/vmwgfx: Nuke preclose hook
Date: Mon, 11 Jan 2016 22:41:17 +0100	[thread overview]
Message-ID: <1452548477-15905-24-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1452548477-15905-1-git-send-email-daniel.vetter@ffwll.ch>

Again since the drm core takes care of event unlinking/disarming this
is now just needless code.

v2: I've completely missed eaction->fpriv_head and all the related
code. We need to nuke that too to avoid accidentally deferencing the
freed-up vmwgfx-private fpriv.

v3: Also remove vmw_fpriv->fence_events and unused variables I missed.

Cc: Thomas Hellström <thellstrom@vmware.com>
Acked-by: Daniel Stone <daniels@collabora.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c   | 11 --------
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.h   |  1 -
 drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 52 -----------------------------------
 drivers/gpu/drm/vmwgfx/vmwgfx_fence.h |  2 --
 4 files changed, 66 deletions(-)

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index c49812b80dd0..c96a2d2d5107 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -971,15 +971,6 @@ static int vmw_driver_unload(struct drm_device *dev)
 	return 0;
 }
 
-static void vmw_preclose(struct drm_device *dev,
-			 struct drm_file *file_priv)
-{
-	struct vmw_fpriv *vmw_fp = vmw_fpriv(file_priv);
-	struct vmw_private *dev_priv = vmw_priv(dev);
-
-	vmw_event_fence_fpriv_gone(dev_priv->fman, &vmw_fp->fence_events);
-}
-
 static void vmw_postclose(struct drm_device *dev,
 			 struct drm_file *file_priv)
 {
@@ -1010,7 +1001,6 @@ static int vmw_driver_open(struct drm_device *dev, struct drm_file *file_priv)
 	if (unlikely(vmw_fp == NULL))
 		return ret;
 
-	INIT_LIST_HEAD(&vmw_fp->fence_events);
 	vmw_fp->tfile = ttm_object_file_init(dev_priv->tdev, 10);
 	if (unlikely(vmw_fp->tfile == NULL))
 		goto out_no_tfile;
@@ -1500,7 +1490,6 @@ static struct drm_driver driver = {
 	.master_set = vmw_master_set,
 	.master_drop = vmw_master_drop,
 	.open = vmw_driver_open,
-	.preclose = vmw_preclose,
 	.postclose = vmw_postclose,
 	.set_busid = drm_pci_set_busid,
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
index 469cdd520615..5cb1b1687cd4 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.h
@@ -80,7 +80,6 @@
 struct vmw_fpriv {
 	struct drm_master *locked_master;
 	struct ttm_object_file *tfile;
-	struct list_head fence_events;
 	bool gb_aware;
 };
 
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
index e0edf149d9d5..ac477863fc07 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
@@ -71,7 +71,6 @@ struct vmw_user_fence {
  */
 struct vmw_event_fence_action {
 	struct vmw_fence_action action;
-	struct list_head fpriv_head;
 
 	struct drm_pending_event *event;
 	struct vmw_fence_obj *fence;
@@ -808,44 +807,6 @@ int vmw_fence_obj_unref_ioctl(struct drm_device *dev, void *data,
 }
 
 /**
- * vmw_event_fence_fpriv_gone - Remove references to struct drm_file objects
- *
- * @fman: Pointer to a struct vmw_fence_manager
- * @event_list: Pointer to linked list of struct vmw_event_fence_action objects
- * with pointers to a struct drm_file object about to be closed.
- *
- * This function removes all pending fence events with references to a
- * specific struct drm_file object about to be closed. The caller is required
- * to pass a list of all struct vmw_event_fence_action objects with such
- * events attached. This function is typically called before the
- * struct drm_file object's event management is taken down.
- */
-void vmw_event_fence_fpriv_gone(struct vmw_fence_manager *fman,
-				struct list_head *event_list)
-{
-	struct vmw_event_fence_action *eaction;
-	struct drm_pending_event *event;
-	unsigned long irq_flags;
-
-	while (1) {
-		spin_lock_irqsave(&fman->lock, irq_flags);
-		if (list_empty(event_list))
-			goto out_unlock;
-		eaction = list_first_entry(event_list,
-					   struct vmw_event_fence_action,
-					   fpriv_head);
-		list_del_init(&eaction->fpriv_head);
-		event = eaction->event;
-		eaction->event = NULL;
-		spin_unlock_irqrestore(&fman->lock, irq_flags);
-		event->destroy(event);
-	}
-out_unlock:
-	spin_unlock_irqrestore(&fman->lock, irq_flags);
-}
-
-
-/**
  * vmw_event_fence_action_seq_passed
  *
  * @action: The struct vmw_fence_action embedded in a struct
@@ -879,7 +840,6 @@ static void vmw_event_fence_action_seq_passed(struct vmw_fence_action *action)
 		*eaction->tv_usec = tv.tv_usec;
 	}
 
-	list_del_init(&eaction->fpriv_head);
 	eaction->event = NULL;
 	drm_send_event_locked(dev, eaction->event);
 	spin_unlock_irqrestore(&dev->event_lock, irq_flags);
@@ -898,12 +858,6 @@ static void vmw_event_fence_action_cleanup(struct vmw_fence_action *action)
 {
 	struct vmw_event_fence_action *eaction =
 		container_of(action, struct vmw_event_fence_action, action);
-	struct vmw_fence_manager *fman = fman_from_fence(eaction->fence);
-	unsigned long irq_flags;
-
-	spin_lock_irqsave(&fman->lock, irq_flags);
-	list_del(&eaction->fpriv_head);
-	spin_unlock_irqrestore(&fman->lock, irq_flags);
 
 	vmw_fence_obj_unreference(&eaction->fence);
 	kfree(eaction);
@@ -983,8 +937,6 @@ int vmw_event_fence_action_queue(struct drm_file *file_priv,
 {
 	struct vmw_event_fence_action *eaction;
 	struct vmw_fence_manager *fman = fman_from_fence(fence);
-	struct vmw_fpriv *vmw_fp = vmw_fpriv(file_priv);
-	unsigned long irq_flags;
 
 	eaction = kzalloc(sizeof(*eaction), GFP_KERNEL);
 	if (unlikely(eaction == NULL))
@@ -1001,10 +953,6 @@ int vmw_event_fence_action_queue(struct drm_file *file_priv,
 	eaction->tv_sec = tv_sec;
 	eaction->tv_usec = tv_usec;
 
-	spin_lock_irqsave(&fman->lock, irq_flags);
-	list_add_tail(&eaction->fpriv_head, &vmw_fp->fence_events);
-	spin_unlock_irqrestore(&fman->lock, irq_flags);
-
 	vmw_fence_obj_add_action(fence, &eaction->action);
 
 	return 0;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.h b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.h
index 8be6c29f5eb5..83ae301ee141 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.h
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.h
@@ -116,8 +116,6 @@ extern int vmw_fence_obj_unref_ioctl(struct drm_device *dev, void *data,
 				     struct drm_file *file_priv);
 extern int vmw_fence_event_ioctl(struct drm_device *dev, void *data,
 				 struct drm_file *file_priv);
-extern void vmw_event_fence_fpriv_gone(struct vmw_fence_manager *fman,
-				       struct list_head *event_list);
 extern int vmw_event_fence_action_queue(struct drm_file *filee_priv,
 					struct vmw_fence_obj *fence,
 					struct drm_pending_event *event,
-- 
2.6.4

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  parent reply	other threads:[~2016-01-11 21:41 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-11 21:40 [PATCH 00/22] drm_event cleanup, round 2 Daniel Vetter
2016-01-11 21:40 ` [PATCH 01/22] drm: kerneldoc for drm_fops.c Daniel Vetter
2016-01-11 21:40 ` [PATCH 02/22] drm: Add functions to setup/tear down drm_events Daniel Vetter
2016-01-14 18:46   ` Laurent Pinchart
2016-01-11 21:40 ` [PATCH 03/22] drm/exynos: Use the new event init/free functions Daniel Vetter
2016-01-11 21:40 ` [PATCH 04/22] drm/vmwgfx: " Daniel Vetter
2016-01-11 21:40 ` [PATCH 05/22] drm: Create drm_send_event helpers Daniel Vetter
2016-01-14 18:46   ` Laurent Pinchart
2016-01-11 21:41 ` [PATCH 06/22] drm/fsl: Remove preclose hook Daniel Vetter
2016-01-11 21:41 ` [PATCH 07/22] drm/armada: Remove NULL open/pre/postclose hooks Daniel Vetter
2016-01-12 11:51   ` Russell King - ARM Linux
2016-01-12 12:33     ` Daniel Vetter
2016-01-11 21:41 ` [PATCH 08/22] drm/gma500: Remove empty preclose hook Daniel Vetter
2016-01-12 10:11   ` Patrik Jakobsson
2016-01-11 21:41 ` [PATCH 09/22] drm: Clean up pending events in the core Daniel Vetter
2016-01-14 18:45   ` Laurent Pinchart
2016-01-25 14:45   ` [REGRESSION] " Maarten Lankhorst
2016-01-11 21:41 ` [PATCH 10/22] drm: Nuke vblank event file cleanup code Daniel Vetter
2016-01-25  0:26   ` Laurent Pinchart
2016-01-11 21:41 ` [PATCH 11/22] drm/i915: Nuke intel_modeset_preclose Daniel Vetter
2016-01-11 21:41 ` [PATCH 12/22] drm/atmel: Nuke preclose Daniel Vetter
2016-01-13 14:56   ` Boris Brezillon
2016-01-11 21:41 ` [PATCH 13/22] drm/exynos: Remove event cancelling from postclose Daniel Vetter
2016-01-12  6:13   ` Inki Dae
2016-01-11 21:41 ` [PATCH 14/22] drm/imx: Unconfuse preclose logic Daniel Vetter
2016-01-12  8:57   ` Philipp Zabel
2016-01-11 21:41 ` [PATCH 15/22] drm/msm: Nuke preclose hooks Daniel Vetter
2016-01-11 21:41 ` [PATCH 16/22] drm/omap: Nuke close hooks Daniel Vetter
2016-01-12 14:09   ` Tomi Valkeinen
2016-01-13 11:00   ` Tomi Valkeinen
2016-01-13 11:05   ` [PATCH] " Daniel Vetter
2016-01-13 23:07     ` Laurent Pinchart
2016-01-11 21:41 ` [PATCH 17/22] drm/rcar: Nuke preclose hook Daniel Vetter
2016-01-11 21:41 ` [PATCH 18/22] drm/shmob: " Daniel Vetter
2016-01-11 21:41 ` [PATCH 19/22] drm/tegra: Stop cancelling page flip events Daniel Vetter
2016-01-13 14:03   ` Thierry Reding
2016-01-11 21:41 ` [PATCH 20/22] drm/tilcdc: Nuke preclose hook Daniel Vetter
2016-01-12 14:19   ` Tomi Valkeinen
2016-01-12 15:12     ` Daniel Vetter
2016-01-13 11:25       ` Tomi Valkeinen
2016-01-11 21:41 ` [PATCH 21/22] drm/vc4: " Daniel Vetter
2016-01-18 17:19   ` Eric Anholt
2016-01-11 21:41 ` [PATCH 22/22] drm/vmwgfx: " Daniel Vetter
2016-01-11 21:41 ` Daniel Vetter [this message]
2016-01-12  8:30 ` ✗ failure: Fi.CI.BAT Patchwork
2016-01-25  7:50 ` [PATCH 00/22] drm_event cleanup, round 2 Daniel Vetter
  -- strict thread matches above, loose matches on Subject: below --
2016-01-08 20:36 [PATCH 21/21] drm/vmwgfx: Nuke preclose hook Daniel Vetter
2016-01-10 22:02 ` [PATCH] " Daniel Vetter
2016-01-10 22:17   ` Thomas Hellstrom
2016-01-10 22:22     ` Daniel Vetter

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=1452548477-15905-24-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=thellstrom@vmware.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 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.