diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2017-06-29 08:59:27 -0400 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.com> | 2017-06-29 17:52:19 -0400 |
commit | a6aa8fca4d792c72947e341d7842d2f700534335 (patch) | |
tree | 2c7ec852941c833728e8badb2c2c70e4b2b66e50 /drivers/dma-buf | |
parent | 8f66d3aa1735bc95ae58d846a157357e8d41abb8 (diff) |
dma-buf/sw-sync: Reduce irqsave/irqrestore from known context
If we know the context under which we are called, then we can use the
simpler form of spin_lock_irq (saving the save/restore).
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Sumit Semwal <sumit.semwal@linaro.org>
Cc: Sean Paul <seanpaul@chromium.org>
Cc: Gustavo Padovan <gustavo@padovan.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170629125930.821-4-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/dma-buf')
-rw-r--r-- | drivers/dma-buf/sw_sync.c | 15 | ||||
-rw-r--r-- | drivers/dma-buf/sync_debug.c | 14 |
2 files changed, 15 insertions, 14 deletions
diff --git a/drivers/dma-buf/sw_sync.c b/drivers/dma-buf/sw_sync.c index 0e676d08aa70..fc733621987d 100644 --- a/drivers/dma-buf/sw_sync.c +++ b/drivers/dma-buf/sw_sync.c | |||
@@ -135,12 +135,11 @@ static void sync_timeline_put(struct sync_timeline *obj) | |||
135 | */ | 135 | */ |
136 | static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc) | 136 | static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc) |
137 | { | 137 | { |
138 | unsigned long flags; | ||
139 | struct sync_pt *pt, *next; | 138 | struct sync_pt *pt, *next; |
140 | 139 | ||
141 | trace_sync_timeline(obj); | 140 | trace_sync_timeline(obj); |
142 | 141 | ||
143 | spin_lock_irqsave(&obj->child_list_lock, flags); | 142 | spin_lock_irq(&obj->child_list_lock); |
144 | 143 | ||
145 | obj->value += inc; | 144 | obj->value += inc; |
146 | 145 | ||
@@ -150,7 +149,7 @@ static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc) | |||
150 | list_del_init(&pt->active_list); | 149 | list_del_init(&pt->active_list); |
151 | } | 150 | } |
152 | 151 | ||
153 | spin_unlock_irqrestore(&obj->child_list_lock, flags); | 152 | spin_unlock_irq(&obj->child_list_lock); |
154 | } | 153 | } |
155 | 154 | ||
156 | /** | 155 | /** |
@@ -167,7 +166,6 @@ static void sync_timeline_signal(struct sync_timeline *obj, unsigned int inc) | |||
167 | static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size, | 166 | static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size, |
168 | unsigned int value) | 167 | unsigned int value) |
169 | { | 168 | { |
170 | unsigned long flags; | ||
171 | struct sync_pt *pt; | 169 | struct sync_pt *pt; |
172 | 170 | ||
173 | if (size < sizeof(*pt)) | 171 | if (size < sizeof(*pt)) |
@@ -177,13 +175,16 @@ static struct sync_pt *sync_pt_create(struct sync_timeline *obj, int size, | |||
177 | if (!pt) | 175 | if (!pt) |
178 | return NULL; | 176 | return NULL; |
179 | 177 | ||
180 | spin_lock_irqsave(&obj->child_list_lock, flags); | 178 | spin_lock_irq(&obj->child_list_lock); |
179 | |||
181 | sync_timeline_get(obj); | 180 | sync_timeline_get(obj); |
182 | dma_fence_init(&pt->base, &timeline_fence_ops, &obj->child_list_lock, | 181 | dma_fence_init(&pt->base, &timeline_fence_ops, &obj->child_list_lock, |
183 | obj->context, value); | 182 | obj->context, value); |
184 | list_add_tail(&pt->child_list, &obj->child_list_head); | 183 | list_add_tail(&pt->child_list, &obj->child_list_head); |
185 | INIT_LIST_HEAD(&pt->active_list); | 184 | INIT_LIST_HEAD(&pt->active_list); |
186 | spin_unlock_irqrestore(&obj->child_list_lock, flags); | 185 | |
186 | spin_unlock_irq(&obj->child_list_lock); | ||
187 | |||
187 | return pt; | 188 | return pt; |
188 | } | 189 | } |
189 | 190 | ||
@@ -206,9 +207,11 @@ static void timeline_fence_release(struct dma_fence *fence) | |||
206 | unsigned long flags; | 207 | unsigned long flags; |
207 | 208 | ||
208 | spin_lock_irqsave(fence->lock, flags); | 209 | spin_lock_irqsave(fence->lock, flags); |
210 | |||
209 | list_del(&pt->child_list); | 211 | list_del(&pt->child_list); |
210 | if (!list_empty(&pt->active_list)) | 212 | if (!list_empty(&pt->active_list)) |
211 | list_del(&pt->active_list); | 213 | list_del(&pt->active_list); |
214 | |||
212 | spin_unlock_irqrestore(fence->lock, flags); | 215 | spin_unlock_irqrestore(fence->lock, flags); |
213 | 216 | ||
214 | sync_timeline_put(parent); | 217 | sync_timeline_put(parent); |
diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c index 82a6e7f6d37f..0e91632248ba 100644 --- a/drivers/dma-buf/sync_debug.c +++ b/drivers/dma-buf/sync_debug.c | |||
@@ -116,17 +116,16 @@ static void sync_print_fence(struct seq_file *s, | |||
116 | static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj) | 116 | static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj) |
117 | { | 117 | { |
118 | struct list_head *pos; | 118 | struct list_head *pos; |
119 | unsigned long flags; | ||
120 | 119 | ||
121 | seq_printf(s, "%s: %d\n", obj->name, obj->value); | 120 | seq_printf(s, "%s: %d\n", obj->name, obj->value); |
122 | 121 | ||
123 | spin_lock_irqsave(&obj->child_list_lock, flags); | 122 | spin_lock_irq(&obj->child_list_lock); |
124 | list_for_each(pos, &obj->child_list_head) { | 123 | list_for_each(pos, &obj->child_list_head) { |
125 | struct sync_pt *pt = | 124 | struct sync_pt *pt = |
126 | container_of(pos, struct sync_pt, child_list); | 125 | container_of(pos, struct sync_pt, child_list); |
127 | sync_print_fence(s, &pt->base, false); | 126 | sync_print_fence(s, &pt->base, false); |
128 | } | 127 | } |
129 | spin_unlock_irqrestore(&obj->child_list_lock, flags); | 128 | spin_unlock_irq(&obj->child_list_lock); |
130 | } | 129 | } |
131 | 130 | ||
132 | static void sync_print_sync_file(struct seq_file *s, | 131 | static void sync_print_sync_file(struct seq_file *s, |
@@ -151,12 +150,11 @@ static void sync_print_sync_file(struct seq_file *s, | |||
151 | 150 | ||
152 | static int sync_debugfs_show(struct seq_file *s, void *unused) | 151 | static int sync_debugfs_show(struct seq_file *s, void *unused) |
153 | { | 152 | { |
154 | unsigned long flags; | ||
155 | struct list_head *pos; | 153 | struct list_head *pos; |
156 | 154 | ||
157 | seq_puts(s, "objs:\n--------------\n"); | 155 | seq_puts(s, "objs:\n--------------\n"); |
158 | 156 | ||
159 | spin_lock_irqsave(&sync_timeline_list_lock, flags); | 157 | spin_lock_irq(&sync_timeline_list_lock); |
160 | list_for_each(pos, &sync_timeline_list_head) { | 158 | list_for_each(pos, &sync_timeline_list_head) { |
161 | struct sync_timeline *obj = | 159 | struct sync_timeline *obj = |
162 | container_of(pos, struct sync_timeline, | 160 | container_of(pos, struct sync_timeline, |
@@ -165,11 +163,11 @@ static int sync_debugfs_show(struct seq_file *s, void *unused) | |||
165 | sync_print_obj(s, obj); | 163 | sync_print_obj(s, obj); |
166 | seq_putc(s, '\n'); | 164 | seq_putc(s, '\n'); |
167 | } | 165 | } |
168 | spin_unlock_irqrestore(&sync_timeline_list_lock, flags); | 166 | spin_unlock_irq(&sync_timeline_list_lock); |
169 | 167 | ||
170 | seq_puts(s, "fences:\n--------------\n"); | 168 | seq_puts(s, "fences:\n--------------\n"); |
171 | 169 | ||
172 | spin_lock_irqsave(&sync_file_list_lock, flags); | 170 | spin_lock_irq(&sync_file_list_lock); |
173 | list_for_each(pos, &sync_file_list_head) { | 171 | list_for_each(pos, &sync_file_list_head) { |
174 | struct sync_file *sync_file = | 172 | struct sync_file *sync_file = |
175 | container_of(pos, struct sync_file, sync_file_list); | 173 | container_of(pos, struct sync_file, sync_file_list); |
@@ -177,7 +175,7 @@ static int sync_debugfs_show(struct seq_file *s, void *unused) | |||
177 | sync_print_sync_file(s, sync_file); | 175 | sync_print_sync_file(s, sync_file); |
178 | seq_putc(s, '\n'); | 176 | seq_putc(s, '\n'); |
179 | } | 177 | } |
180 | spin_unlock_irqrestore(&sync_file_list_lock, flags); | 178 | spin_unlock_irq(&sync_file_list_lock); |
181 | return 0; | 179 | return 0; |
182 | } | 180 | } |
183 | 181 | ||