[PATCH 01/27] drm/etnaviv: fix GPU vs sync point race

Philipp Zabel p.zabel at pengutronix.de
Fri Dec 1 11:33:03 UTC 2017


On Fri, 2017-12-01 at 11:35 +0100, Lucas Stach wrote:
> If the FE is restarted before the sync point event is cleared, the GPU
> might trigger a completion IRQ for the next sync point before corrupting
> the state of the currently running worker.

I don't understand this explanation. That sounds like it would be ok to
trigger a completion IRQ for the next sync point after corrupting the
state of the currently running worker. Maybe "s/before/, /"?

> Signed-off-by: Lucas Stach <l.stach at pengutronix.de>

For the patch,

Reviewed-by: Philipp Zabel <p.zabel at pengutronix.de>

regards
Philipp

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> index e19cbe05da2a..f0fae218e4aa 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
> @@ -1484,22 +1484,18 @@ int etnaviv_gpu_submit(struct etnaviv_gpu *gpu,
>  	return ret;
>  }
>  
> -static void etnaviv_process_sync_point(struct etnaviv_gpu *gpu,
> -	struct etnaviv_event *event)
> -{
> -	u32 addr = gpu_read(gpu, VIVS_FE_DMA_ADDRESS);
> -
> -	event->sync_point(gpu, event);
> -	etnaviv_gpu_start_fe(gpu, addr + 2, 2);
> -}
> -
>  static void sync_point_worker(struct work_struct *work)
>  {
>  	struct etnaviv_gpu *gpu = container_of(work, struct etnaviv_gpu,
>  					       sync_point_work);
> +	struct etnaviv_event *event = &gpu->event[gpu->sync_point_event];
> +	u32 addr = gpu_read(gpu, VIVS_FE_DMA_ADDRESS);
>  
> -	etnaviv_process_sync_point(gpu, &gpu->event[gpu->sync_point_event]);
> +	event->sync_point(gpu, event);
>  	event_free(gpu, gpu->sync_point_event);
> +
> +	/* restart FE last to avoid GPU and IRQ racing against this worker */
> +	etnaviv_gpu_start_fe(gpu, addr + 2, 2);
>  }
>  
>  /*


More information about the dri-devel mailing list