diff options
author | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-01-25 16:16:56 -0500 |
---|---|---|
committer | Daniel Vetter <daniel.vetter@ffwll.ch> | 2016-02-08 03:55:53 -0500 |
commit | 1c0230de6dd096e46c46294e93ba68cc16f70331 (patch) | |
tree | a687ea8a0ba7ecbafe717eb22bdd79f3b02c757c /drivers/gpu | |
parent | 32a3dbeb2b951044111042ce6ccb2dcd7bca35de (diff) |
drm/vmwgfx: Nuke preclose hook
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>
Link: http://patchwork.freedesktop.org/patch/msgid/1452548477-15905-23-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 11 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_fence.c | 52 | ||||
-rw-r--r-- | drivers/gpu/drm/vmwgfx/vmwgfx_fence.h | 2 |
4 files changed, 0 insertions, 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) | |||
971 | return 0; | 971 | return 0; |
972 | } | 972 | } |
973 | 973 | ||
974 | static void vmw_preclose(struct drm_device *dev, | ||
975 | struct drm_file *file_priv) | ||
976 | { | ||
977 | struct vmw_fpriv *vmw_fp = vmw_fpriv(file_priv); | ||
978 | struct vmw_private *dev_priv = vmw_priv(dev); | ||
979 | |||
980 | vmw_event_fence_fpriv_gone(dev_priv->fman, &vmw_fp->fence_events); | ||
981 | } | ||
982 | |||
983 | static void vmw_postclose(struct drm_device *dev, | 974 | static void vmw_postclose(struct drm_device *dev, |
984 | struct drm_file *file_priv) | 975 | struct drm_file *file_priv) |
985 | { | 976 | { |
@@ -1010,7 +1001,6 @@ static int vmw_driver_open(struct drm_device *dev, struct drm_file *file_priv) | |||
1010 | if (unlikely(vmw_fp == NULL)) | 1001 | if (unlikely(vmw_fp == NULL)) |
1011 | return ret; | 1002 | return ret; |
1012 | 1003 | ||
1013 | INIT_LIST_HEAD(&vmw_fp->fence_events); | ||
1014 | vmw_fp->tfile = ttm_object_file_init(dev_priv->tdev, 10); | 1004 | vmw_fp->tfile = ttm_object_file_init(dev_priv->tdev, 10); |
1015 | if (unlikely(vmw_fp->tfile == NULL)) | 1005 | if (unlikely(vmw_fp->tfile == NULL)) |
1016 | goto out_no_tfile; | 1006 | goto out_no_tfile; |
@@ -1500,7 +1490,6 @@ static struct drm_driver driver = { | |||
1500 | .master_set = vmw_master_set, | 1490 | .master_set = vmw_master_set, |
1501 | .master_drop = vmw_master_drop, | 1491 | .master_drop = vmw_master_drop, |
1502 | .open = vmw_driver_open, | 1492 | .open = vmw_driver_open, |
1503 | .preclose = vmw_preclose, | ||
1504 | .postclose = vmw_postclose, | 1493 | .postclose = vmw_postclose, |
1505 | .set_busid = drm_pci_set_busid, | 1494 | .set_busid = drm_pci_set_busid, |
1506 | 1495 | ||
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 @@ | |||
80 | struct vmw_fpriv { | 80 | struct vmw_fpriv { |
81 | struct drm_master *locked_master; | 81 | struct drm_master *locked_master; |
82 | struct ttm_object_file *tfile; | 82 | struct ttm_object_file *tfile; |
83 | struct list_head fence_events; | ||
84 | bool gb_aware; | 83 | bool gb_aware; |
85 | }; | 84 | }; |
86 | 85 | ||
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c index 37c305b62608..e959df6ede83 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 { | |||
71 | */ | 71 | */ |
72 | struct vmw_event_fence_action { | 72 | struct vmw_event_fence_action { |
73 | struct vmw_fence_action action; | 73 | struct vmw_fence_action action; |
74 | struct list_head fpriv_head; | ||
75 | 74 | ||
76 | struct drm_pending_event *event; | 75 | struct drm_pending_event *event; |
77 | struct vmw_fence_obj *fence; | 76 | struct vmw_fence_obj *fence; |
@@ -808,44 +807,6 @@ int vmw_fence_obj_unref_ioctl(struct drm_device *dev, void *data, | |||
808 | } | 807 | } |
809 | 808 | ||
810 | /** | 809 | /** |
811 | * vmw_event_fence_fpriv_gone - Remove references to struct drm_file objects | ||
812 | * | ||
813 | * @fman: Pointer to a struct vmw_fence_manager | ||
814 | * @event_list: Pointer to linked list of struct vmw_event_fence_action objects | ||
815 | * with pointers to a struct drm_file object about to be closed. | ||
816 | * | ||
817 | * This function removes all pending fence events with references to a | ||
818 | * specific struct drm_file object about to be closed. The caller is required | ||
819 | * to pass a list of all struct vmw_event_fence_action objects with such | ||
820 | * events attached. This function is typically called before the | ||
821 | * struct drm_file object's event management is taken down. | ||
822 | */ | ||
823 | void vmw_event_fence_fpriv_gone(struct vmw_fence_manager *fman, | ||
824 | struct list_head *event_list) | ||
825 | { | ||
826 | struct vmw_event_fence_action *eaction; | ||
827 | struct drm_pending_event *event; | ||
828 | unsigned long irq_flags; | ||
829 | |||
830 | while (1) { | ||
831 | spin_lock_irqsave(&fman->lock, irq_flags); | ||
832 | if (list_empty(event_list)) | ||
833 | goto out_unlock; | ||
834 | eaction = list_first_entry(event_list, | ||
835 | struct vmw_event_fence_action, | ||
836 | fpriv_head); | ||
837 | list_del_init(&eaction->fpriv_head); | ||
838 | event = eaction->event; | ||
839 | eaction->event = NULL; | ||
840 | spin_unlock_irqrestore(&fman->lock, irq_flags); | ||
841 | event->destroy(event); | ||
842 | } | ||
843 | out_unlock: | ||
844 | spin_unlock_irqrestore(&fman->lock, irq_flags); | ||
845 | } | ||
846 | |||
847 | |||
848 | /** | ||
849 | * vmw_event_fence_action_seq_passed | 810 | * vmw_event_fence_action_seq_passed |
850 | * | 811 | * |
851 | * @action: The struct vmw_fence_action embedded in a struct | 812 | * @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) | |||
879 | *eaction->tv_usec = tv.tv_usec; | 840 | *eaction->tv_usec = tv.tv_usec; |
880 | } | 841 | } |
881 | 842 | ||
882 | list_del_init(&eaction->fpriv_head); | ||
883 | drm_send_event_locked(dev, eaction->event); | 843 | drm_send_event_locked(dev, eaction->event); |
884 | eaction->event = NULL; | 844 | eaction->event = NULL; |
885 | spin_unlock_irqrestore(&dev->event_lock, irq_flags); | 845 | spin_unlock_irqrestore(&dev->event_lock, irq_flags); |
@@ -898,12 +858,6 @@ static void vmw_event_fence_action_cleanup(struct vmw_fence_action *action) | |||
898 | { | 858 | { |
899 | struct vmw_event_fence_action *eaction = | 859 | struct vmw_event_fence_action *eaction = |
900 | container_of(action, struct vmw_event_fence_action, action); | 860 | container_of(action, struct vmw_event_fence_action, action); |
901 | struct vmw_fence_manager *fman = fman_from_fence(eaction->fence); | ||
902 | unsigned long irq_flags; | ||
903 | |||
904 | spin_lock_irqsave(&fman->lock, irq_flags); | ||
905 | list_del(&eaction->fpriv_head); | ||
906 | spin_unlock_irqrestore(&fman->lock, irq_flags); | ||
907 | 861 | ||
908 | vmw_fence_obj_unreference(&eaction->fence); | 862 | vmw_fence_obj_unreference(&eaction->fence); |
909 | kfree(eaction); | 863 | kfree(eaction); |
@@ -983,8 +937,6 @@ int vmw_event_fence_action_queue(struct drm_file *file_priv, | |||
983 | { | 937 | { |
984 | struct vmw_event_fence_action *eaction; | 938 | struct vmw_event_fence_action *eaction; |
985 | struct vmw_fence_manager *fman = fman_from_fence(fence); | 939 | struct vmw_fence_manager *fman = fman_from_fence(fence); |
986 | struct vmw_fpriv *vmw_fp = vmw_fpriv(file_priv); | ||
987 | unsigned long irq_flags; | ||
988 | 940 | ||
989 | eaction = kzalloc(sizeof(*eaction), GFP_KERNEL); | 941 | eaction = kzalloc(sizeof(*eaction), GFP_KERNEL); |
990 | if (unlikely(eaction == NULL)) | 942 | if (unlikely(eaction == NULL)) |
@@ -1001,10 +953,6 @@ int vmw_event_fence_action_queue(struct drm_file *file_priv, | |||
1001 | eaction->tv_sec = tv_sec; | 953 | eaction->tv_sec = tv_sec; |
1002 | eaction->tv_usec = tv_usec; | 954 | eaction->tv_usec = tv_usec; |
1003 | 955 | ||
1004 | spin_lock_irqsave(&fman->lock, irq_flags); | ||
1005 | list_add_tail(&eaction->fpriv_head, &vmw_fp->fence_events); | ||
1006 | spin_unlock_irqrestore(&fman->lock, irq_flags); | ||
1007 | |||
1008 | vmw_fence_obj_add_action(fence, &eaction->action); | 956 | vmw_fence_obj_add_action(fence, &eaction->action); |
1009 | 957 | ||
1010 | return 0; | 958 | 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, | |||
116 | struct drm_file *file_priv); | 116 | struct drm_file *file_priv); |
117 | extern int vmw_fence_event_ioctl(struct drm_device *dev, void *data, | 117 | extern int vmw_fence_event_ioctl(struct drm_device *dev, void *data, |
118 | struct drm_file *file_priv); | 118 | struct drm_file *file_priv); |
119 | extern void vmw_event_fence_fpriv_gone(struct vmw_fence_manager *fman, | ||
120 | struct list_head *event_list); | ||
121 | extern int vmw_event_fence_action_queue(struct drm_file *filee_priv, | 119 | extern int vmw_event_fence_action_queue(struct drm_file *filee_priv, |
122 | struct vmw_fence_obj *fence, | 120 | struct vmw_fence_obj *fence, |
123 | struct drm_pending_event *event, | 121 | struct drm_pending_event *event, |