All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/3] host1x_cdma_update_sync_queue() clean up
@ 2018-08-07 13:07 Dmitry Osipenko
  2018-08-07 13:07 ` [PATCH v2 1/3] gpu: host1x: Cancel only job that actually got stuck Dmitry Osipenko
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Dmitry Osipenko @ 2018-08-07 13:07 UTC (permalink / raw)
  To: Thierry Reding, Mikko Perttunen; +Cc: linux-tegra, dri-devel, linux-kernel

v2: I've added two more patches on top of "Cancel only job that actually got
    stuck" patch. Hence it is a patch-series now.

Dmitry Osipenko (3):
  gpu: host1x: Cancel only job that actually got stuck
  gpu: host1x: Don't complete a completed job
  gpu: host1x: Continue CDMA execution starting with a next job

 drivers/gpu/host1x/cdma.c       | 62 +++++++++++++--------------------
 drivers/gpu/host1x/hw/cdma_hw.c | 13 -------
 2 files changed, 24 insertions(+), 51 deletions(-)

-- 
2.18.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2 1/3] gpu: host1x: Cancel only job that actually got stuck
  2018-08-07 13:07 [PATCH v2 0/3] host1x_cdma_update_sync_queue() clean up Dmitry Osipenko
@ 2018-08-07 13:07 ` Dmitry Osipenko
  2018-08-07 13:07 ` [PATCH v2 2/3] gpu: host1x: Don't complete a completed job Dmitry Osipenko
  2018-08-07 13:07 ` [PATCH v2 3/3] gpu: host1x: Continue CDMA execution starting with a next job Dmitry Osipenko
  2 siblings, 0 replies; 9+ messages in thread
From: Dmitry Osipenko @ 2018-08-07 13:07 UTC (permalink / raw)
  To: Thierry Reding, Mikko Perttunen; +Cc: linux-tegra, dri-devel, linux-kernel

Host1x doesn't have information about jobs inter-dependency, that is
something that will become available once host1x will get a proper
jobs scheduler implementation. Currently a hang job causes other unrelated
jobs to be canceled, that is a relic from downstream driver which is
irrelevant to upstream. Let's cancel only the hanging job and not to touch
other jobs in queue.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
---
 drivers/gpu/host1x/cdma.c | 33 +++++++--------------------------
 1 file changed, 7 insertions(+), 26 deletions(-)

diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
index 91df51e631b2..75f339f5df6f 100644
--- a/drivers/gpu/host1x/cdma.c
+++ b/drivers/gpu/host1x/cdma.c
@@ -348,13 +348,11 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
 	}
 
 	/*
-	 * Walk the sync_queue, first incrementing with the CPU syncpts that
-	 * are partially executed (the first buffer) or fully skipped while
-	 * still in the current context (slots are also NOP-ed).
+	 * Increment with CPU the remaining syncpts of a partially executed job.
 	 *
-	 * At the point contexts are interleaved, syncpt increments must be
-	 * done inline with the pushbuffer from a GATHER buffer to maintain
-	 * the order (slots are modified to be a GATHER of syncpt incrs).
+	 * Syncpt increments must be done inline with the pushbuffer from a
+	 * GATHER buffer to maintain the order (slots are modified to be a
+	 * GATHER of syncpt incrs).
 	 *
 	 * Note: save in restart_addr the location where the timed out buffer
 	 * started in the PB, so we can start the refetch from there (with the
@@ -362,20 +360,15 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
 	 * properly for this buffer and resources are freed.
 	 */
 
-	dev_dbg(dev, "%s: perform CPU incr on pending same ctx buffers\n",
-		__func__);
+	dev_dbg(dev, "%s: perform CPU incr on pending buffers\n", __func__);
 
 	if (!list_empty(&cdma->sync_queue))
 		restart_addr = job->first_get;
 	else
 		restart_addr = cdma->last_pos;
 
-	/* do CPU increments as long as this context continues */
-	list_for_each_entry_from(job, &cdma->sync_queue, list) {
-		/* different context, gets us out of this loop */
-		if (job->client != cdma->timeout.client)
-			break;
-
+	/* do CPU increments for the remaining syncpts */
+	if (job) {
 		/* won't need a timeout when replayed */
 		job->timeout = 0;
 
@@ -388,20 +381,8 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
 		host1x_hw_cdma_timeout_cpu_incr(host1x, cdma, job->first_get,
 						syncpt_incrs, job->syncpt_end,
 						job->num_slots);
-
-		syncpt_val += syncpt_incrs;
 	}
 
-	/*
-	 * The following sumbits from the same client may be dependent on the
-	 * failed submit and therefore they may fail. Force a small timeout
-	 * to make the queue cleanup faster.
-	 */
-
-	list_for_each_entry_from(job, &cdma->sync_queue, list)
-		if (job->client == cdma->timeout.client)
-			job->timeout = min_t(unsigned int, job->timeout, 500);
-
 	dev_dbg(dev, "%s: finished sync_queue modification\n", __func__);
 
 	/* roll back DMAGET and start up channel again */
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/3] gpu: host1x: Don't complete a completed job
  2018-08-07 13:07 [PATCH v2 0/3] host1x_cdma_update_sync_queue() clean up Dmitry Osipenko
  2018-08-07 13:07 ` [PATCH v2 1/3] gpu: host1x: Cancel only job that actually got stuck Dmitry Osipenko
@ 2018-08-07 13:07 ` Dmitry Osipenko
  2018-10-09  5:00   ` Mikko Perttunen
  2018-08-07 13:07 ` [PATCH v2 3/3] gpu: host1x: Continue CDMA execution starting with a next job Dmitry Osipenko
  2 siblings, 1 reply; 9+ messages in thread
From: Dmitry Osipenko @ 2018-08-07 13:07 UTC (permalink / raw)
  To: Thierry Reding, Mikko Perttunen; +Cc: linux-tegra, dri-devel, linux-kernel

There is a chance that the last job has been completed at the time of
CDMA timeout handler invocation. In this case there is no need to complete
the completed job.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/gpu/host1x/cdma.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
index 75f339f5df6f..6aa6fa1498e8 100644
--- a/drivers/gpu/host1x/cdma.c
+++ b/drivers/gpu/host1x/cdma.c
@@ -323,7 +323,7 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
 {
 	struct host1x *host1x = cdma_to_host1x(cdma);
 	u32 restart_addr, syncpt_incrs, syncpt_val;
-	struct host1x_job *job = NULL;
+	struct host1x_job *job;
 
 	syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt);
 
@@ -342,11 +342,16 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
 
 	list_for_each_entry(job, &cdma->sync_queue, list) {
 		if (syncpt_val < job->syncpt_end)
-			break;
+			goto syncpt_incr;
 
 		host1x_job_dump(dev, job);
 	}
 
+	/* all jobs have been completed */
+	job = NULL;
+
+syncpt_incr:
+
 	/*
 	 * Increment with CPU the remaining syncpts of a partially executed job.
 	 *
@@ -359,16 +364,16 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
 	 * modified NOP-ed PB slots). This lets things appear to have completed
 	 * properly for this buffer and resources are freed.
 	 */
-
-	dev_dbg(dev, "%s: perform CPU incr on pending buffers\n", __func__);
-
-	if (!list_empty(&cdma->sync_queue))
+	if (job)
 		restart_addr = job->first_get;
 	else
 		restart_addr = cdma->last_pos;
 
 	/* do CPU increments for the remaining syncpts */
 	if (job) {
+		dev_dbg(dev, "%s: perform CPU incr on pending buffers\n",
+			__func__);
+
 		/* won't need a timeout when replayed */
 		job->timeout = 0;
 
@@ -381,9 +386,10 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
 		host1x_hw_cdma_timeout_cpu_incr(host1x, cdma, job->first_get,
 						syncpt_incrs, job->syncpt_end,
 						job->num_slots);
-	}
 
-	dev_dbg(dev, "%s: finished sync_queue modification\n", __func__);
+		dev_dbg(dev, "%s: finished sync_queue modification\n",
+			__func__);
+	}
 
 	/* roll back DMAGET and start up channel again */
 	host1x_hw_cdma_resume(host1x, cdma, restart_addr);
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 3/3] gpu: host1x: Continue CDMA execution starting with a next job
  2018-08-07 13:07 [PATCH v2 0/3] host1x_cdma_update_sync_queue() clean up Dmitry Osipenko
  2018-08-07 13:07 ` [PATCH v2 1/3] gpu: host1x: Cancel only job that actually got stuck Dmitry Osipenko
  2018-08-07 13:07 ` [PATCH v2 2/3] gpu: host1x: Don't complete a completed job Dmitry Osipenko
@ 2018-08-07 13:07 ` Dmitry Osipenko
  2018-08-18 15:10   ` Dmitry Osipenko
  2018-10-09  5:10     ` Mikko Perttunen
  2 siblings, 2 replies; 9+ messages in thread
From: Dmitry Osipenko @ 2018-08-07 13:07 UTC (permalink / raw)
  To: Thierry Reding, Mikko Perttunen; +Cc: linux-tegra, dri-devel, linux-kernel

Currently gathers of a hung job are getting NOP'ed and a restarted CDMA
executes the NOP'ed gathers. There shouldn't be a reason to not restart
CDMA execution starting with a next job, avoiding the unnecessary churning
with gathers NOP'ing.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/gpu/host1x/cdma.c       | 23 +++++++++++------------
 drivers/gpu/host1x/hw/cdma_hw.c | 13 -------------
 2 files changed, 11 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
index 6aa6fa1498e8..9e4f01c7f663 100644
--- a/drivers/gpu/host1x/cdma.c
+++ b/drivers/gpu/host1x/cdma.c
@@ -323,7 +323,7 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
 {
 	struct host1x *host1x = cdma_to_host1x(cdma);
 	u32 restart_addr, syncpt_incrs, syncpt_val;
-	struct host1x_job *job;
+	struct host1x_job *job, *next_job = NULL;
 
 	syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt);
 
@@ -341,8 +341,13 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
 		__func__);
 
 	list_for_each_entry(job, &cdma->sync_queue, list) {
-		if (syncpt_val < job->syncpt_end)
+		if (syncpt_val < job->syncpt_end) {
+
+			if (!list_is_last(&job->list, &cdma->sync_queue))
+				next_job = list_next_entry(job, list);
+
 			goto syncpt_incr;
+		}
 
 		host1x_job_dump(dev, job);
 	}
@@ -355,17 +360,11 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
 	/*
 	 * Increment with CPU the remaining syncpts of a partially executed job.
 	 *
-	 * Syncpt increments must be done inline with the pushbuffer from a
-	 * GATHER buffer to maintain the order (slots are modified to be a
-	 * GATHER of syncpt incrs).
-	 *
-	 * Note: save in restart_addr the location where the timed out buffer
-	 * started in the PB, so we can start the refetch from there (with the
-	 * modified NOP-ed PB slots). This lets things appear to have completed
-	 * properly for this buffer and resources are freed.
+	 * CDMA will continue execution starting with the next job or will get
+	 * into idle state.
 	 */
-	if (job)
-		restart_addr = job->first_get;
+	if (next_job)
+		restart_addr = next_job->first_get;
 	else
 		restart_addr = cdma->last_pos;
 
diff --git a/drivers/gpu/host1x/hw/cdma_hw.c b/drivers/gpu/host1x/hw/cdma_hw.c
index ce320534cbed..bc203532ae6d 100644
--- a/drivers/gpu/host1x/hw/cdma_hw.c
+++ b/drivers/gpu/host1x/hw/cdma_hw.c
@@ -40,7 +40,6 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
 				u32 syncpt_incrs, u32 syncval, u32 nr_slots)
 {
 	struct host1x *host1x = cdma_to_host1x(cdma);
-	struct push_buffer *pb = &cdma->push_buffer;
 	unsigned int i;
 
 	for (i = 0; i < syncpt_incrs; i++)
@@ -48,18 +47,6 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
 
 	/* after CPU incr, ensure shadow is up to date */
 	host1x_syncpt_load(cdma->timeout.syncpt);
-
-	/* NOP all the PB slots */
-	while (nr_slots--) {
-		u32 *p = (u32 *)(pb->mapped + getptr);
-		*(p++) = HOST1X_OPCODE_NOP;
-		*(p++) = HOST1X_OPCODE_NOP;
-		dev_dbg(host1x->dev, "%s: NOP at %pad+%#x\n", __func__,
-			&pb->dma, getptr);
-		getptr = (getptr + 8) & (pb->size - 1);
-	}
-
-	wmb();
 }
 
 /*
-- 
2.18.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/3] gpu: host1x: Continue CDMA execution starting with a next job
  2018-08-07 13:07 ` [PATCH v2 3/3] gpu: host1x: Continue CDMA execution starting with a next job Dmitry Osipenko
@ 2018-08-18 15:10   ` Dmitry Osipenko
  2018-10-09  5:10     ` Mikko Perttunen
  1 sibling, 0 replies; 9+ messages in thread
From: Dmitry Osipenko @ 2018-08-18 15:10 UTC (permalink / raw)
  To: Thierry Reding, Mikko Perttunen; +Cc: linux-tegra, dri-devel, linux-kernel

On 07.08.2018 16:07, Dmitry Osipenko wrote:
> Currently gathers of a hung job are getting NOP'ed and a restarted CDMA
> executes the NOP'ed gathers. There shouldn't be a reason to not restart
> CDMA execution starting with a next job, avoiding the unnecessary churning
> with gathers NOP'ing.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>  drivers/gpu/host1x/cdma.c       | 23 +++++++++++------------
>  drivers/gpu/host1x/hw/cdma_hw.c | 13 -------------
>  2 files changed, 11 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
> index 6aa6fa1498e8..9e4f01c7f663 100644
> --- a/drivers/gpu/host1x/cdma.c
> +++ b/drivers/gpu/host1x/cdma.c
> @@ -323,7 +323,7 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>  {
>  	struct host1x *host1x = cdma_to_host1x(cdma);
>  	u32 restart_addr, syncpt_incrs, syncpt_val;
> -	struct host1x_job *job;
> +	struct host1x_job *job, *next_job = NULL;
>  
>  	syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt);
>  
> @@ -341,8 +341,13 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>  		__func__);
>  
>  	list_for_each_entry(job, &cdma->sync_queue, list) {
> -		if (syncpt_val < job->syncpt_end)
> +		if (syncpt_val < job->syncpt_end) {
> +
> +			if (!list_is_last(&job->list, &cdma->sync_queue))
> +				next_job = list_next_entry(job, list);
> +
>  			goto syncpt_incr;
> +		}
>  
>  		host1x_job_dump(dev, job);
>  	}
> @@ -355,17 +360,11 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>  	/*
>  	 * Increment with CPU the remaining syncpts of a partially executed job.
>  	 *
> -	 * Syncpt increments must be done inline with the pushbuffer from a
> -	 * GATHER buffer to maintain the order (slots are modified to be a
> -	 * GATHER of syncpt incrs).
> -	 *
> -	 * Note: save in restart_addr the location where the timed out buffer
> -	 * started in the PB, so we can start the refetch from there (with the
> -	 * modified NOP-ed PB slots). This lets things appear to have completed
> -	 * properly for this buffer and resources are freed.
> +	 * CDMA will continue execution starting with the next job or will get
> +	 * into idle state.
>  	 */
> -	if (job)
> -		restart_addr = job->first_get;
> +	if (next_job)
> +		restart_addr = next_job->first_get;
>  	else
>  		restart_addr = cdma->last_pos;
>  
> diff --git a/drivers/gpu/host1x/hw/cdma_hw.c b/drivers/gpu/host1x/hw/cdma_hw.c
> index ce320534cbed..bc203532ae6d 100644
> --- a/drivers/gpu/host1x/hw/cdma_hw.c
> +++ b/drivers/gpu/host1x/hw/cdma_hw.c
> @@ -40,7 +40,6 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
>  				u32 syncpt_incrs, u32 syncval, u32 nr_slots)
>  {
>  	struct host1x *host1x = cdma_to_host1x(cdma);

The *host1x is now unused and should be removed as well, I'll fix it in v3.
Mikko, could you take a look at the patches?

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/3] gpu: host1x: Don't complete a completed job
  2018-08-07 13:07 ` [PATCH v2 2/3] gpu: host1x: Don't complete a completed job Dmitry Osipenko
@ 2018-10-09  5:00   ` Mikko Perttunen
  0 siblings, 0 replies; 9+ messages in thread
From: Mikko Perttunen @ 2018-10-09  5:00 UTC (permalink / raw)
  To: Dmitry Osipenko, Thierry Reding; +Cc: linux-tegra, dri-devel, linux-kernel

Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>

On 07/08/2018 22.07, Dmitry Osipenko wrote:
> There is a chance that the last job has been completed at the time of
> CDMA timeout handler invocation. In this case there is no need to complete
> the completed job.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>   drivers/gpu/host1x/cdma.c | 22 ++++++++++++++--------
>   1 file changed, 14 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
> index 75f339f5df6f..6aa6fa1498e8 100644
> --- a/drivers/gpu/host1x/cdma.c
> +++ b/drivers/gpu/host1x/cdma.c
> @@ -323,7 +323,7 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>   {
>   	struct host1x *host1x = cdma_to_host1x(cdma);
>   	u32 restart_addr, syncpt_incrs, syncpt_val;
> -	struct host1x_job *job = NULL;
> +	struct host1x_job *job;
>   
>   	syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt);
>   
> @@ -342,11 +342,16 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>   
>   	list_for_each_entry(job, &cdma->sync_queue, list) {
>   		if (syncpt_val < job->syncpt_end)
> -			break;
> +			goto syncpt_incr;
>   
>   		host1x_job_dump(dev, job);
>   	}
>   
> +	/* all jobs have been completed */
> +	job = NULL;
> +
> +syncpt_incr:
> +
>   	/*
>   	 * Increment with CPU the remaining syncpts of a partially executed job.
>   	 *
> @@ -359,16 +364,16 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>   	 * modified NOP-ed PB slots). This lets things appear to have completed
>   	 * properly for this buffer and resources are freed.
>   	 */
> -
> -	dev_dbg(dev, "%s: perform CPU incr on pending buffers\n", __func__);
> -
> -	if (!list_empty(&cdma->sync_queue))
> +	if (job)
>   		restart_addr = job->first_get;
>   	else
>   		restart_addr = cdma->last_pos;
>   
>   	/* do CPU increments for the remaining syncpts */
>   	if (job) {
> +		dev_dbg(dev, "%s: perform CPU incr on pending buffers\n",
> +			__func__);
> +
>   		/* won't need a timeout when replayed */
>   		job->timeout = 0;
>   
> @@ -381,9 +386,10 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>   		host1x_hw_cdma_timeout_cpu_incr(host1x, cdma, job->first_get,
>   						syncpt_incrs, job->syncpt_end,
>   						job->num_slots);
> -	}
>   
> -	dev_dbg(dev, "%s: finished sync_queue modification\n", __func__);
> +		dev_dbg(dev, "%s: finished sync_queue modification\n",
> +			__func__);
> +	}
>   
>   	/* roll back DMAGET and start up channel again */
>   	host1x_hw_cdma_resume(host1x, cdma, restart_addr);
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/3] gpu: host1x: Continue CDMA execution starting with a next job
  2018-08-07 13:07 ` [PATCH v2 3/3] gpu: host1x: Continue CDMA execution starting with a next job Dmitry Osipenko
@ 2018-10-09  5:10     ` Mikko Perttunen
  2018-10-09  5:10     ` Mikko Perttunen
  1 sibling, 0 replies; 9+ messages in thread
From: Mikko Perttunen @ 2018-10-09  5:10 UTC (permalink / raw)
  To: Dmitry Osipenko, Thierry Reding; +Cc: linux-tegra, linux-kernel, dri-devel

Reviewed-by: Mikko Perttnuen <mperttunen@nvidia.com>

On 07/08/2018 22.07, Dmitry Osipenko wrote:
> Currently gathers of a hung job are getting NOP'ed and a restarted CDMA
> executes the NOP'ed gathers. There shouldn't be a reason to not restart
> CDMA execution starting with a next job, avoiding the unnecessary churning
> with gathers NOP'ing.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>   drivers/gpu/host1x/cdma.c       | 23 +++++++++++------------
>   drivers/gpu/host1x/hw/cdma_hw.c | 13 -------------
>   2 files changed, 11 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
> index 6aa6fa1498e8..9e4f01c7f663 100644
> --- a/drivers/gpu/host1x/cdma.c
> +++ b/drivers/gpu/host1x/cdma.c
> @@ -323,7 +323,7 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>   {
>   	struct host1x *host1x = cdma_to_host1x(cdma);
>   	u32 restart_addr, syncpt_incrs, syncpt_val;
> -	struct host1x_job *job;
> +	struct host1x_job *job, *next_job = NULL;
>   
>   	syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt);
>   
> @@ -341,8 +341,13 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>   		__func__);
>   
>   	list_for_each_entry(job, &cdma->sync_queue, list) {
> -		if (syncpt_val < job->syncpt_end)
> +		if (syncpt_val < job->syncpt_end) {
> +
> +			if (!list_is_last(&job->list, &cdma->sync_queue))
> +				next_job = list_next_entry(job, list);
> +
>   			goto syncpt_incr;
> +		}
>   
>   		host1x_job_dump(dev, job);
>   	}
> @@ -355,17 +360,11 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>   	/*
>   	 * Increment with CPU the remaining syncpts of a partially executed job.
>   	 *
> -	 * Syncpt increments must be done inline with the pushbuffer from a
> -	 * GATHER buffer to maintain the order (slots are modified to be a
> -	 * GATHER of syncpt incrs).
> -	 *
> -	 * Note: save in restart_addr the location where the timed out buffer
> -	 * started in the PB, so we can start the refetch from there (with the
> -	 * modified NOP-ed PB slots). This lets things appear to have completed
> -	 * properly for this buffer and resources are freed.
> +	 * CDMA will continue execution starting with the next job or will get
> +	 * into idle state.
>   	 */
> -	if (job)
> -		restart_addr = job->first_get;
> +	if (next_job)
> +		restart_addr = next_job->first_get;
>   	else
>   		restart_addr = cdma->last_pos;
>   
> diff --git a/drivers/gpu/host1x/hw/cdma_hw.c b/drivers/gpu/host1x/hw/cdma_hw.c
> index ce320534cbed..bc203532ae6d 100644
> --- a/drivers/gpu/host1x/hw/cdma_hw.c
> +++ b/drivers/gpu/host1x/hw/cdma_hw.c
> @@ -40,7 +40,6 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
>   				u32 syncpt_incrs, u32 syncval, u32 nr_slots)
>   {
>   	struct host1x *host1x = cdma_to_host1x(cdma);
> -	struct push_buffer *pb = &cdma->push_buffer;
>   	unsigned int i;
>   
>   	for (i = 0; i < syncpt_incrs; i++)
> @@ -48,18 +47,6 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
>   
>   	/* after CPU incr, ensure shadow is up to date */
>   	host1x_syncpt_load(cdma->timeout.syncpt);
> -
> -	/* NOP all the PB slots */
> -	while (nr_slots--) {
> -		u32 *p = (u32 *)(pb->mapped + getptr);
> -		*(p++) = HOST1X_OPCODE_NOP;
> -		*(p++) = HOST1X_OPCODE_NOP;
> -		dev_dbg(host1x->dev, "%s: NOP at %pad+%#x\n", __func__,
> -			&pb->dma, getptr);
> -		getptr = (getptr + 8) & (pb->size - 1);
> -	}
> -
> -	wmb();
>   }
>   
>   /*
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/3] gpu: host1x: Continue CDMA execution starting with a next job
@ 2018-10-09  5:10     ` Mikko Perttunen
  0 siblings, 0 replies; 9+ messages in thread
From: Mikko Perttunen @ 2018-10-09  5:10 UTC (permalink / raw)
  To: Dmitry Osipenko, Thierry Reding; +Cc: linux-tegra, dri-devel, linux-kernel

Reviewed-by: Mikko Perttnuen <mperttunen@nvidia.com>

On 07/08/2018 22.07, Dmitry Osipenko wrote:
> Currently gathers of a hung job are getting NOP'ed and a restarted CDMA
> executes the NOP'ed gathers. There shouldn't be a reason to not restart
> CDMA execution starting with a next job, avoiding the unnecessary churning
> with gathers NOP'ing.
> 
> Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
> ---
>   drivers/gpu/host1x/cdma.c       | 23 +++++++++++------------
>   drivers/gpu/host1x/hw/cdma_hw.c | 13 -------------
>   2 files changed, 11 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/gpu/host1x/cdma.c b/drivers/gpu/host1x/cdma.c
> index 6aa6fa1498e8..9e4f01c7f663 100644
> --- a/drivers/gpu/host1x/cdma.c
> +++ b/drivers/gpu/host1x/cdma.c
> @@ -323,7 +323,7 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>   {
>   	struct host1x *host1x = cdma_to_host1x(cdma);
>   	u32 restart_addr, syncpt_incrs, syncpt_val;
> -	struct host1x_job *job;
> +	struct host1x_job *job, *next_job = NULL;
>   
>   	syncpt_val = host1x_syncpt_load(cdma->timeout.syncpt);
>   
> @@ -341,8 +341,13 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>   		__func__);
>   
>   	list_for_each_entry(job, &cdma->sync_queue, list) {
> -		if (syncpt_val < job->syncpt_end)
> +		if (syncpt_val < job->syncpt_end) {
> +
> +			if (!list_is_last(&job->list, &cdma->sync_queue))
> +				next_job = list_next_entry(job, list);
> +
>   			goto syncpt_incr;
> +		}
>   
>   		host1x_job_dump(dev, job);
>   	}
> @@ -355,17 +360,11 @@ void host1x_cdma_update_sync_queue(struct host1x_cdma *cdma,
>   	/*
>   	 * Increment with CPU the remaining syncpts of a partially executed job.
>   	 *
> -	 * Syncpt increments must be done inline with the pushbuffer from a
> -	 * GATHER buffer to maintain the order (slots are modified to be a
> -	 * GATHER of syncpt incrs).
> -	 *
> -	 * Note: save in restart_addr the location where the timed out buffer
> -	 * started in the PB, so we can start the refetch from there (with the
> -	 * modified NOP-ed PB slots). This lets things appear to have completed
> -	 * properly for this buffer and resources are freed.
> +	 * CDMA will continue execution starting with the next job or will get
> +	 * into idle state.
>   	 */
> -	if (job)
> -		restart_addr = job->first_get;
> +	if (next_job)
> +		restart_addr = next_job->first_get;
>   	else
>   		restart_addr = cdma->last_pos;
>   
> diff --git a/drivers/gpu/host1x/hw/cdma_hw.c b/drivers/gpu/host1x/hw/cdma_hw.c
> index ce320534cbed..bc203532ae6d 100644
> --- a/drivers/gpu/host1x/hw/cdma_hw.c
> +++ b/drivers/gpu/host1x/hw/cdma_hw.c
> @@ -40,7 +40,6 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
>   				u32 syncpt_incrs, u32 syncval, u32 nr_slots)
>   {
>   	struct host1x *host1x = cdma_to_host1x(cdma);
> -	struct push_buffer *pb = &cdma->push_buffer;
>   	unsigned int i;
>   
>   	for (i = 0; i < syncpt_incrs; i++)
> @@ -48,18 +47,6 @@ static void cdma_timeout_cpu_incr(struct host1x_cdma *cdma, u32 getptr,
>   
>   	/* after CPU incr, ensure shadow is up to date */
>   	host1x_syncpt_load(cdma->timeout.syncpt);
> -
> -	/* NOP all the PB slots */
> -	while (nr_slots--) {
> -		u32 *p = (u32 *)(pb->mapped + getptr);
> -		*(p++) = HOST1X_OPCODE_NOP;
> -		*(p++) = HOST1X_OPCODE_NOP;
> -		dev_dbg(host1x->dev, "%s: NOP at %pad+%#x\n", __func__,
> -			&pb->dma, getptr);
> -		getptr = (getptr + 8) & (pb->size - 1);
> -	}
> -
> -	wmb();
>   }
>   
>   /*
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 3/3] gpu: host1x: Continue CDMA execution starting with a next job
  2018-10-09  5:10     ` Mikko Perttunen
  (?)
@ 2018-10-09  9:16     ` Dmitry Osipenko
  -1 siblings, 0 replies; 9+ messages in thread
From: Dmitry Osipenko @ 2018-10-09  9:16 UTC (permalink / raw)
  To: Mikko Perttunen, Thierry Reding; +Cc: linux-tegra, dri-devel, linux-kernel

On 10/9/18 8:10 AM, Mikko Perttunen wrote:
> Reviewed-by: Mikko Perttnuen <mperttunen@nvidia.com>

Thank you :)

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2018-10-09  9:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-07 13:07 [PATCH v2 0/3] host1x_cdma_update_sync_queue() clean up Dmitry Osipenko
2018-08-07 13:07 ` [PATCH v2 1/3] gpu: host1x: Cancel only job that actually got stuck Dmitry Osipenko
2018-08-07 13:07 ` [PATCH v2 2/3] gpu: host1x: Don't complete a completed job Dmitry Osipenko
2018-10-09  5:00   ` Mikko Perttunen
2018-08-07 13:07 ` [PATCH v2 3/3] gpu: host1x: Continue CDMA execution starting with a next job Dmitry Osipenko
2018-08-18 15:10   ` Dmitry Osipenko
2018-10-09  5:10   ` Mikko Perttunen
2018-10-09  5:10     ` Mikko Perttunen
2018-10-09  9:16     ` Dmitry Osipenko

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.