drm/etnaviv: remove unnecessary local irq disable
Subsystems (2)
Lucas Stach
maintainerPATCH 1/3 drm/etnaviv: remove unnecessary local irq disable
The only event function that is called from IRQ context is event_free, which is already using atomic bitmap operations, so we can avoid taking the event spinlock in this function completely. As other the other functions still using the event spinlock are all called from normal process context, we can avoid disabling IRQs while holding the spinlock.
--- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +5 -13
@@ -976,7 +976,6 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m)void etnaviv_gpu_recover_hang (struct etnaviv_gpu *gpu) { -unsigned long flags;unsigned int i =0 ;dev_err (gpu->dev,"recover hung GPU!\n" );
@@ -989,11 +988,11 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)etnaviv_hw_reset (gpu);/* complete all events, the GPU won't do it after the reset */ -spin_lock_irqsave (&gpu->event_spinlock, flags); +spin_lock (&gpu->event_spinlock);for_each_set_bit_from (i, gpu->event_bitmap,ETNA_NR_EVENTS )complete (&gpu->event_free);bitmap_zero (gpu->event_bitmap,ETNA_NR_EVENTS ); -spin_unlock_irqrestore (&gpu->event_spinlock, flags); +spin_unlock (&gpu->event_spinlock);etnaviv_gpu_hw_init (gpu); gpu->lastctx =NULL ;
@@ -1083,7 +1082,7 @@ static inline bool fence_after(u32 a, u32 b)static int event_alloc (struct etnaviv_gpu *gpu,unsigned nr_events,unsigned int *events) { -unsigned long flags, timeout =msecs_to_jiffies (10 *10000 ); +unsigned long timeout =msecs_to_jiffies (10 *10000 );unsigned i, acquired =0 ;for (i =0 ; i < nr_events; i++) {
@@ -1100,7 +1099,7 @@ static int event_alloc(struct etnaviv_gpu *gpu, unsigned nr_events, timeout = ret; } -spin_lock_irqsave (&gpu->event_spinlock, flags); +spin_lock (&gpu->event_spinlock);for (i =0 ; i < nr_events; i++) {int event =find_first_zero_bit (gpu->event_bitmap,ETNA_NR_EVENTS );
@@ -1110,7 +1109,7 @@ static int event_alloc(struct etnaviv_gpu *gpu, unsigned nr_events,set_bit (event, gpu->event_bitmap); } -spin_unlock_irqrestore (&gpu->event_spinlock, flags); +spin_unlock (&gpu->event_spinlock);return 0 ;
@@ -1123,18 +1122,11 @@ static int event_alloc(struct etnaviv_gpu *gpu, unsigned nr_events,static void event_free (struct etnaviv_gpu *gpu,unsigned int event) { -unsigned long flags; - -spin_lock_irqsave (&gpu->event_spinlock, flags); -if (!test_bit (event, gpu->event_bitmap)) {dev_warn (gpu->dev,"event %u is already marked as free" , event); -spin_unlock_irqrestore (&gpu->event_spinlock, flags); }else {clear_bit (event, gpu->event_bitmap); -spin_unlock_irqrestore (&gpu->event_spinlock, flags); -complete (&gpu->event_free); } }
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Lucas Stach
maintainerPATCH 2/3 drm/etnaviv: replace header include with forward declaration
The etnaviv_gpu header only needs to know about the pointer types, so replace by a forward declaration and only include the headers where needed.
--- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 ++ drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +2 -0
@@ -3,10 +3,12 @@* Copyright (C) 2015-2018 Etnaviv Project */ +#include <linux/clk.h> #include <linux/component.h> #include <linux/dma-fence.h> #include <linux/moduleparam.h> #include <linux/of_device.h> +#include <linux/regulator/consumer.h> #include <linux/thermal.h> #include "etnaviv_cmdbuf.h"
drivers/gpu/drm/etnaviv/etnaviv_gpu.h +2 -3
@@ -6,9 +6,6 @@#ifndef __ETNAVIV_GPU_H__#define __ETNAVIV_GPU_H__ -#include <linux/clk.h> -#include <linux/regulator/consumer.h> -#include "etnaviv_cmdbuf.h" #include "etnaviv_drv.h"
@@ -88,6 +85,8 @@ struct etnaviv_event {struct etnaviv_cmdbuf_suballoc ;struct etnaviv_cmdbuf ; +struct regulator ; +struct clk ;#define ETNA_NR_EVENTS 30
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 2/3] drm/etnaviv: replace header include with forward declaration
Am Mo., 17. Dez. 2018 um 16:36 Uhr schrieb Lucas Stach <[email protected]>:
Quoted 5 lines
The
etnaviv_gpuheader only needs to know about the pointer types, so replace by a forward declaration and only include the headers where needed.Signed-off-by Lucas Stach <[email protected]>
Quoted 48 lines
--- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 ++ drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-)drivers/gpu/drm/etnaviv/etnaviv_gpu.c +2
-0@@ -3,10 +3,12 @@* Copyright (C) 2015-2018 Etnaviv Project */ +#include <linux/clk.h> #include <linux/component.h> #include <linux/dma-fence.h> #include <linux/moduleparam.h> #include <linux/of_device.h> +#include <linux/regulator/consumer.h> #include <linux/thermal.h> #include "etnaviv_cmdbuf.h" drivers/gpu/drm/etnaviv/etnaviv_gpu.h +2
-4@@ -6,9 +6,6 @@#ifndef __ETNAVIV_GPU_H__#define __ETNAVIV_GPU_H__ -#include <linux/clk.h> -#include <linux/regulator/consumer.h> -#include "etnaviv_cmdbuf.h" #include "etnaviv_drv.h" @@ -88,6 +85,8 @@ struct etnaviv_event {struct etnaviv_cmdbuf_suballoc ;struct etnaviv_cmdbuf ; +struct regulator ; +struct clk ;#define ETNA_NR_EVENTS 30 --2.19.1
Signature · 9 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Lucas Stach
maintainerPATCH 3/3 drm/etnaviv: remove lastctx member from gpu struct
In reply to Lucas StachIt only written and we don't infer any useful information from it anymore. Remove it.
--- drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 2 -- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 8 +------- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 -- drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 1 - 4 files changed, 1 insertion(+), 12 deletions(-)
drivers/gpu/drm/etnaviv/etnaviv_buffer.c +0 -2
@@ -439,6 +439,4 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,if (drm_debug &DRM_UT_DRIVER )etnaviv_buffer_dump (gpu, buffer,0 ,0x50 ); - - gpu->lastctx = cmdbuf->ctx; }
drivers/gpu/drm/etnaviv/etnaviv_drv.c +1 -7
@@ -72,14 +72,8 @@ static void etnaviv_postclose(struct drm_device *dev, struct drm_file *file)for (i =0 ; i <ETNA_MAX_PIPES ; i++) {struct etnaviv_gpu *gpu = priv->gpu[i]; -if (gpu) { -mutex_lock (&gpu->lock); -if (gpu->lastctx == ctx) - gpu->lastctx =NULL ; -mutex_unlock (&gpu->lock); - +if (gpu)drm_sched_entity_destroy (&ctx->sched_entity[i]); - } }kfree (ctx);
drivers/gpu/drm/etnaviv/etnaviv_gpu.c +0 -2
@@ -997,7 +997,6 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)spin_unlock (&gpu->event_spinlock);etnaviv_gpu_hw_init (gpu); - gpu->lastctx =NULL ; gpu->exec_state =-1 ;mutex_unlock (&gpu->lock);
@@ -1546,7 +1545,6 @@ static int etnaviv_gpu_hw_resume(struct etnaviv_gpu *gpu)etnaviv_gpu_update_clock (gpu);etnaviv_gpu_hw_init (gpu); - gpu->lastctx =NULL ; gpu->exec_state =-1 ;mutex_unlock (&gpu->lock);
drivers/gpu/drm/etnaviv/etnaviv_gpu.h +0 -1
@@ -97,7 +97,6 @@ struct etnaviv_gpu {struct mutex lock;struct etnaviv_chip_identity identity;enum etnaviv_sec_mode sec_mode; -struct etnaviv_file_private *lastctx;struct workqueue_struct *wq;struct drm_gpu_scheduler sched;
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH 3/3] drm/etnaviv: remove lastctx member from gpu struct
Am Mo., 17. Dez. 2018 um 16:36 Uhr schrieb Lucas Stach <[email protected]>:
Quoted 5 lines
It only written and we don't infer any useful information from it anymore. Remove it.
Signed-off-by Lucas Stach <[email protected]>
Quoted 73 lines
--- drivers/gpu/drm/etnaviv/etnaviv_buffer.c | 2 -- drivers/gpu/drm/etnaviv/etnaviv_drv.c | 8 +------- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 2 -- drivers/gpu/drm/etnaviv/etnaviv_gpu.h | 1 - 4 files changed, 1 insertion(+), 12 deletions(-)drivers/gpu/drm/etnaviv/etnaviv_buffer.c +0
-2@@ -439,6 +439,4 @@ void etnaviv_buffer_queue(struct etnaviv_gpu *gpu, u32 exec_state,if (drm_debug &DRM_UT_DRIVER )etnaviv_buffer_dump (gpu, buffer,0 ,0x50 ); - - gpu->lastctx = cmdbuf->ctx; }drivers/gpu/drm/etnaviv/etnaviv_drv.c +1
-7@@ -72,14 +72,8 @@ static void etnaviv_postclose(struct drm_device *dev, struct drm_file *file)for (i =0 ; i <ETNA_MAX_PIPES ; i++) {struct etnaviv_gpu *gpu = priv->gpu[i]; -if (gpu) { -mutex_lock (&gpu->lock); -if (gpu->lastctx == ctx) - gpu->lastctx =NULL ; -mutex_unlock (&gpu->lock); - +if (gpu)drm_sched_entity_destroy (&ctx->sched_entity[i]); - } }kfree (ctx);drivers/gpu/drm/etnaviv/etnaviv_gpu.c +0
-2@@ -997,7 +997,6 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)spin_unlock (&gpu->event_spinlock);etnaviv_gpu_hw_init (gpu); - gpu->lastctx =NULL ; gpu->exec_state =-1 ;mutex_unlock (&gpu->lock);@@ -1546,7 +1545,6 @@ static int etnaviv_gpu_hw_resume(struct etnaviv_gpu *gpu)etnaviv_gpu_update_clock (gpu);etnaviv_gpu_hw_init (gpu); - gpu->lastctx =NULL ; gpu->exec_state =-1 ;mutex_unlock (&gpu->lock);drivers/gpu/drm/etnaviv/etnaviv_gpu.h +0
-2@@ -97,7 +97,6 @@ struct etnaviv_gpu {struct mutex lock;struct etnaviv_chip_identity identity;enum etnaviv_sec_mode sec_mode; -struct etnaviv_file_private *lastctx;struct workqueue_struct *wq;struct drm_gpu_scheduler sched; --2.19.1
Signature · 9 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Am Mo., 17. Dez. 2018 um 16:36 Uhr schrieb Lucas Stach <[email protected]>:
Quoted 8 lines
The only event function that is called from IRQ context is
event_free, which is already using atomic bitmap operations, so we can avoid taking the event spinlock in this function completely. As other the other functions still using the event spinlock are all called from normal process context, we can avoid disabling IRQs while holding the spinlock.Signed-off-by Lucas Stach <[email protected]>
Quoted 79 lines
--- drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-)drivers/gpu/drm/etnaviv/etnaviv_gpu.c +5
-14@@ -976,7 +976,6 @@ int etnaviv_gpu_debugfs(struct etnaviv_gpu *gpu, struct seq_file *m)void etnaviv_gpu_recover_hang (struct etnaviv_gpu *gpu) { -unsigned long flags;unsigned int i =0 ;dev_err (gpu->dev,"recover hung GPU!\n" );@@ -989,11 +988,11 @@ void etnaviv_gpu_recover_hang(struct etnaviv_gpu *gpu)etnaviv_hw_reset (gpu);/* complete all events, the GPU won't do it after the reset */ -spin_lock_irqsave (&gpu->event_spinlock, flags); +spin_lock (&gpu->event_spinlock);for_each_set_bit_from (i, gpu->event_bitmap,ETNA_NR_EVENTS )complete (&gpu->event_free);bitmap_zero (gpu->event_bitmap,ETNA_NR_EVENTS ); -spin_unlock_irqrestore (&gpu->event_spinlock, flags); +spin_unlock (&gpu->event_spinlock);etnaviv_gpu_hw_init (gpu); gpu->lastctx =NULL ;@@ -1083,7 +1082,7 @@ static inline bool fence_after(u32 a, u32 b)static int event_alloc (struct etnaviv_gpu *gpu,unsigned nr_events,unsigned int *events) { -unsigned long flags, timeout =msecs_to_jiffies (10 *10000 ); +unsigned long timeout =msecs_to_jiffies (10 *10000 );unsigned i, acquired =0 ;for (i =0 ; i < nr_events; i++) {@@ -1100,7 +1099,7 @@ static int event_alloc(struct etnaviv_gpu *gpu, unsigned nr_events, timeout = ret; } -spin_lock_irqsave (&gpu->event_spinlock, flags); +spin_lock (&gpu->event_spinlock);for (i =0 ; i < nr_events; i++) {int event =find_first_zero_bit (gpu->event_bitmap,ETNA_NR_EVENTS );@@ -1110,7 +1109,7 @@ static int event_alloc(struct etnaviv_gpu *gpu, unsigned nr_events,set_bit (event, gpu->event_bitmap); } -spin_unlock_irqrestore (&gpu->event_spinlock, flags); +spin_unlock (&gpu->event_spinlock);return 0 ;@@ -1123,18 +1122,11 @@ static int event_alloc(struct etnaviv_gpu *gpu, unsigned nr_events,static void event_free (struct etnaviv_gpu *gpu,unsigned int event) { -unsigned long flags; - -spin_lock_irqsave (&gpu->event_spinlock, flags); -if (!test_bit (event, gpu->event_bitmap)) {dev_warn (gpu->dev,"event %u is already marked as free" , event); -spin_unlock_irqrestore (&gpu->event_spinlock, flags); }else {clear_bit (event, gpu->event_bitmap); -spin_unlock_irqrestore (&gpu->event_spinlock, flags); -complete (&gpu->event_free); } } --2.19.1
Signature · 9 lines
greets -- Christian Gmeiner, MSc https://christian-gmeiner.info _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel