diff mbox series

drm/etnaviv: dump only failing submit

Message ID 20190702141830.13580-1-l.stach@pengutronix.de (mailing list archive)
State New, archived
Headers show
Series drm/etnaviv: dump only failing submit | expand

Commit Message

Lucas Stach July 2, 2019, 2:18 p.m. UTC
Due to the tracking provided by the scheduler we know exactly which
submit is failing. Only dump this single submit and the required
auxiliary information. This cuts down the size of the devcoredumps
by only including relevant information.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/gpu/drm/etnaviv/etnaviv_dump.c  | 57 +++++++++----------------
 drivers/gpu/drm/etnaviv/etnaviv_dump.h  |  4 +-
 drivers/gpu/drm/etnaviv/etnaviv_sched.c |  2 +-
 3 files changed, 22 insertions(+), 41 deletions(-)

Comments

Lucas Stach Aug. 9, 2019, 9:09 a.m. UTC | #1
Am Dienstag, den 02.07.2019, 16:18 +0200 schrieb Lucas Stach:
> Due to the tracking provided by the scheduler we know exactly which
> submit is failing. Only dump this single submit and the required
> auxiliary information. This cuts down the size of the devcoredumps
> by only including relevant information.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>

Anyone up for reviewing this one?

Regards,
Lucas

> ---
>  drivers/gpu/drm/etnaviv/etnaviv_dump.c  | 57 +++++++++----------------
>  drivers/gpu/drm/etnaviv/etnaviv_dump.h  |  4 +-
>  drivers/gpu/drm/etnaviv/etnaviv_sched.c |  2 +-
>  3 files changed, 22 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
> index 515515ef24f9..bab09bae35d0 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
> @@ -91,9 +91,9 @@ static void etnaviv_core_dump_registers(struct core_dump_iterator *iter,
>  }
>  
>  static void etnaviv_core_dump_mmu(struct core_dump_iterator *iter,
> > -	struct etnaviv_gpu *gpu, size_t mmu_size)
> > +	struct etnaviv_iommu *mmu, size_t mmu_size)
>  {
> > -	etnaviv_iommu_dump(gpu->mmu, iter->data);
> > +	etnaviv_iommu_dump(mmu, iter->data);
>  
> >  	etnaviv_core_dump_header(iter, ETDUMP_BUF_MMU, iter->data + mmu_size);
>  }
> @@ -108,17 +108,15 @@ static void etnaviv_core_dump_mem(struct core_dump_iterator *iter, u32 type,
> >  	etnaviv_core_dump_header(iter, type, iter->data + size);
>  }
>  
> -void etnaviv_core_dump(struct etnaviv_gpu *gpu)
> +void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
>  {
> > +	struct etnaviv_gpu *gpu = submit->gpu;
> >  	struct core_dump_iterator iter;
> > -	struct etnaviv_vram_mapping *vram;
> >  	struct etnaviv_gem_object *obj;
> > -	struct etnaviv_gem_submit *submit;
> > -	struct drm_sched_job *s_job;
> >  	unsigned int n_obj, n_bomap_pages;
> >  	size_t file_size, mmu_size;
> >  	__le64 *bomap, *bomap_start;
> > -	unsigned long flags;
> > +	int i;
>  
> >  	/* Only catch the first event, or when manually re-armed */
> >  	if (!etnaviv_dump_core)
> @@ -129,28 +127,16 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
>  
> >  	mmu_size = etnaviv_iommu_dump_size(gpu->mmu);
>  
> > -	/* We always dump registers, mmu, ring and end marker */
> > -	n_obj = 4;
> > +	/* We always dump registers, mmu, ring, hanging cmdbuf and end marker */
> > +	n_obj = 5;
> >  	n_bomap_pages = 0;
> >  	file_size = ARRAY_SIZE(etnaviv_dump_registers) *
> >  			sizeof(struct etnaviv_dump_registers) +
> > -		    mmu_size + gpu->buffer.size;
> -
> > -	/* Add in the active command buffers */
> > -	spin_lock_irqsave(&gpu->sched.job_list_lock, flags);
> > -	list_for_each_entry(s_job, &gpu->sched.ring_mirror_list, node) {
> > -		submit = to_etnaviv_submit(s_job);
> > -		file_size += submit->cmdbuf.size;
> > -		n_obj++;
> > -	}
> > -	spin_unlock_irqrestore(&gpu->sched.job_list_lock, flags);
> > +		    mmu_size + gpu->buffer.size + submit->cmdbuf.size;
>  
> >  	/* Add in the active buffer objects */
> > -	list_for_each_entry(vram, &gpu->mmu->mappings, mmu_node) {
> > -		if (!vram->use)
> > -			continue;
> -
> > -		obj = vram->object;
> > +	for (i = 0; i < submit->nr_bos; i++) {
> > +		obj = submit->bos[i].obj;
> >  		file_size += obj->base.size;
> >  		n_bomap_pages += obj->base.size >> PAGE_SHIFT;
> >  		n_obj++;
> @@ -181,19 +167,15 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
> >  	memset(iter.hdr, 0, iter.data - iter.start);
>  
> >  	etnaviv_core_dump_registers(&iter, gpu);
> > -	etnaviv_core_dump_mmu(&iter, gpu, mmu_size);
> > +	etnaviv_core_dump_mmu(&iter, gpu->mmu, mmu_size);
> +
> >  	etnaviv_core_dump_mem(&iter, ETDUMP_BUF_RING, gpu->buffer.vaddr,
> >  			      gpu->buffer.size,
> >  			      etnaviv_cmdbuf_get_va(&gpu->buffer));
>  
> > -	spin_lock_irqsave(&gpu->sched.job_list_lock, flags);
> > -	list_for_each_entry(s_job, &gpu->sched.ring_mirror_list, node) {
> > -		submit = to_etnaviv_submit(s_job);
> > -		etnaviv_core_dump_mem(&iter, ETDUMP_BUF_CMD,
> > -				      submit->cmdbuf.vaddr, submit->cmdbuf.size,
> > -				      etnaviv_cmdbuf_get_va(&submit->cmdbuf));
> > -	}
> > -	spin_unlock_irqrestore(&gpu->sched.job_list_lock, flags);
> > +	etnaviv_core_dump_mem(&iter, ETDUMP_BUF_CMD,
> > +			      submit->cmdbuf.vaddr, submit->cmdbuf.size,
> > +			      etnaviv_cmdbuf_get_va(&submit->cmdbuf));
>  
> >  	/* Reserve space for the bomap */
> >  	if (n_bomap_pages) {
> @@ -206,14 +188,13 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
> >  		bomap_start = bomap = NULL;
> >  	}
>  
> > -	list_for_each_entry(vram, &gpu->mmu->mappings, mmu_node) {
> > +	for (i = 0; i < submit->nr_bos; i++) {
> > +		struct etnaviv_vram_mapping *vram;
> >  		struct page **pages;
> >  		void *vaddr;
>  
> > -		if (vram->use == 0)
> > -			continue;
> -
> > -		obj = vram->object;
> > +		obj = submit->bos[i].obj;
> > +		vram = submit->bos[i].mapping;
>  
> >  		mutex_lock(&obj->lock);
> >  		pages = etnaviv_gem_get_pages(obj);
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.h b/drivers/gpu/drm/etnaviv/etnaviv_dump.h
> index 2d916c2667ee..a125c46b895b 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_dump.h
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.h
> @@ -35,8 +35,8 @@ struct etnaviv_dump_registers {
>  };
>  
>  #ifdef __KERNEL__
> -struct etnaviv_gpu;
> -void etnaviv_core_dump(struct etnaviv_gpu *gpu);
> +struct etnaviv_gem_submit;
> +void etnaviv_core_dump(struct etnaviv_gem_submit *submit);
>  #endif
>  
>  #endif
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
> index 6d24fea1766b..b2e0a34bb796 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
> @@ -115,7 +115,7 @@ static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
> >  		drm_sched_increase_karma(sched_job);
>  
> >  	/* get the GPU back into the init state */
> > -	etnaviv_core_dump(gpu);
> > +	etnaviv_core_dump(submit);
> >  	etnaviv_gpu_recover_hang(gpu);
>  
> >  	drm_sched_resubmit_jobs(&gpu->sched);
Philipp Zabel Aug. 9, 2019, 10:17 a.m. UTC | #2
On Tue, 2019-07-02 at 16:18 +0200, Lucas Stach wrote:
> Due to the tracking provided by the scheduler we know exactly which
> submit is failing. Only dump this single submit and the required
> auxiliary information. This cuts down the size of the devcoredumps
> by only including relevant information.
> 
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> ---
>  drivers/gpu/drm/etnaviv/etnaviv_dump.c  | 57 +++++++++----------------
>  drivers/gpu/drm/etnaviv/etnaviv_dump.h  |  4 +-
>  drivers/gpu/drm/etnaviv/etnaviv_sched.c |  2 +-
>  3 files changed, 22 insertions(+), 41 deletions(-)
> 
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
> index 515515ef24f9..bab09bae35d0 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
> @@ -91,9 +91,9 @@ static void etnaviv_core_dump_registers(struct core_dump_iterator *iter,
>  }
>  
>  static void etnaviv_core_dump_mmu(struct core_dump_iterator *iter,
> -	struct etnaviv_gpu *gpu, size_t mmu_size)
> +	struct etnaviv_iommu *mmu, size_t mmu_size)
>  {
> -	etnaviv_iommu_dump(gpu->mmu, iter->data);
> +	etnaviv_iommu_dump(mmu, iter->data);
>  
>  	etnaviv_core_dump_header(iter, ETDUMP_BUF_MMU, iter->data + mmu_size);
>  }
[...]
> @@ -181,19 +167,15 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
>  	memset(iter.hdr, 0, iter.data - iter.start);
>  
>  	etnaviv_core_dump_registers(&iter, gpu);
> -	etnaviv_core_dump_mmu(&iter, gpu, mmu_size);
> +	etnaviv_core_dump_mmu(&iter, gpu->mmu, mmu_size);
> +

I'd split this into a separate commit, or at least mention it in the
commit message. This change is neither necessary for nor enabled by the
rest of the patch. Otherwise,

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

regards
Philipp
diff mbox series

Patch

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.c b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
index 515515ef24f9..bab09bae35d0 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_dump.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.c
@@ -91,9 +91,9 @@  static void etnaviv_core_dump_registers(struct core_dump_iterator *iter,
 }
 
 static void etnaviv_core_dump_mmu(struct core_dump_iterator *iter,
-	struct etnaviv_gpu *gpu, size_t mmu_size)
+	struct etnaviv_iommu *mmu, size_t mmu_size)
 {
-	etnaviv_iommu_dump(gpu->mmu, iter->data);
+	etnaviv_iommu_dump(mmu, iter->data);
 
 	etnaviv_core_dump_header(iter, ETDUMP_BUF_MMU, iter->data + mmu_size);
 }
@@ -108,17 +108,15 @@  static void etnaviv_core_dump_mem(struct core_dump_iterator *iter, u32 type,
 	etnaviv_core_dump_header(iter, type, iter->data + size);
 }
 
-void etnaviv_core_dump(struct etnaviv_gpu *gpu)
+void etnaviv_core_dump(struct etnaviv_gem_submit *submit)
 {
+	struct etnaviv_gpu *gpu = submit->gpu;
 	struct core_dump_iterator iter;
-	struct etnaviv_vram_mapping *vram;
 	struct etnaviv_gem_object *obj;
-	struct etnaviv_gem_submit *submit;
-	struct drm_sched_job *s_job;
 	unsigned int n_obj, n_bomap_pages;
 	size_t file_size, mmu_size;
 	__le64 *bomap, *bomap_start;
-	unsigned long flags;
+	int i;
 
 	/* Only catch the first event, or when manually re-armed */
 	if (!etnaviv_dump_core)
@@ -129,28 +127,16 @@  void etnaviv_core_dump(struct etnaviv_gpu *gpu)
 
 	mmu_size = etnaviv_iommu_dump_size(gpu->mmu);
 
-	/* We always dump registers, mmu, ring and end marker */
-	n_obj = 4;
+	/* We always dump registers, mmu, ring, hanging cmdbuf and end marker */
+	n_obj = 5;
 	n_bomap_pages = 0;
 	file_size = ARRAY_SIZE(etnaviv_dump_registers) *
 			sizeof(struct etnaviv_dump_registers) +
-		    mmu_size + gpu->buffer.size;
-
-	/* Add in the active command buffers */
-	spin_lock_irqsave(&gpu->sched.job_list_lock, flags);
-	list_for_each_entry(s_job, &gpu->sched.ring_mirror_list, node) {
-		submit = to_etnaviv_submit(s_job);
-		file_size += submit->cmdbuf.size;
-		n_obj++;
-	}
-	spin_unlock_irqrestore(&gpu->sched.job_list_lock, flags);
+		    mmu_size + gpu->buffer.size + submit->cmdbuf.size;
 
 	/* Add in the active buffer objects */
-	list_for_each_entry(vram, &gpu->mmu->mappings, mmu_node) {
-		if (!vram->use)
-			continue;
-
-		obj = vram->object;
+	for (i = 0; i < submit->nr_bos; i++) {
+		obj = submit->bos[i].obj;
 		file_size += obj->base.size;
 		n_bomap_pages += obj->base.size >> PAGE_SHIFT;
 		n_obj++;
@@ -181,19 +167,15 @@  void etnaviv_core_dump(struct etnaviv_gpu *gpu)
 	memset(iter.hdr, 0, iter.data - iter.start);
 
 	etnaviv_core_dump_registers(&iter, gpu);
-	etnaviv_core_dump_mmu(&iter, gpu, mmu_size);
+	etnaviv_core_dump_mmu(&iter, gpu->mmu, mmu_size);
+
 	etnaviv_core_dump_mem(&iter, ETDUMP_BUF_RING, gpu->buffer.vaddr,
 			      gpu->buffer.size,
 			      etnaviv_cmdbuf_get_va(&gpu->buffer));
 
-	spin_lock_irqsave(&gpu->sched.job_list_lock, flags);
-	list_for_each_entry(s_job, &gpu->sched.ring_mirror_list, node) {
-		submit = to_etnaviv_submit(s_job);
-		etnaviv_core_dump_mem(&iter, ETDUMP_BUF_CMD,
-				      submit->cmdbuf.vaddr, submit->cmdbuf.size,
-				      etnaviv_cmdbuf_get_va(&submit->cmdbuf));
-	}
-	spin_unlock_irqrestore(&gpu->sched.job_list_lock, flags);
+	etnaviv_core_dump_mem(&iter, ETDUMP_BUF_CMD,
+			      submit->cmdbuf.vaddr, submit->cmdbuf.size,
+			      etnaviv_cmdbuf_get_va(&submit->cmdbuf));
 
 	/* Reserve space for the bomap */
 	if (n_bomap_pages) {
@@ -206,14 +188,13 @@  void etnaviv_core_dump(struct etnaviv_gpu *gpu)
 		bomap_start = bomap = NULL;
 	}
 
-	list_for_each_entry(vram, &gpu->mmu->mappings, mmu_node) {
+	for (i = 0; i < submit->nr_bos; i++) {
+		struct etnaviv_vram_mapping *vram;
 		struct page **pages;
 		void *vaddr;
 
-		if (vram->use == 0)
-			continue;
-
-		obj = vram->object;
+		obj = submit->bos[i].obj;
+		vram = submit->bos[i].mapping;
 
 		mutex_lock(&obj->lock);
 		pages = etnaviv_gem_get_pages(obj);
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_dump.h b/drivers/gpu/drm/etnaviv/etnaviv_dump.h
index 2d916c2667ee..a125c46b895b 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_dump.h
+++ b/drivers/gpu/drm/etnaviv/etnaviv_dump.h
@@ -35,8 +35,8 @@  struct etnaviv_dump_registers {
 };
 
 #ifdef __KERNEL__
-struct etnaviv_gpu;
-void etnaviv_core_dump(struct etnaviv_gpu *gpu);
+struct etnaviv_gem_submit;
+void etnaviv_core_dump(struct etnaviv_gem_submit *submit);
 #endif
 
 #endif
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_sched.c b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
index 6d24fea1766b..b2e0a34bb796 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_sched.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_sched.c
@@ -115,7 +115,7 @@  static void etnaviv_sched_timedout_job(struct drm_sched_job *sched_job)
 		drm_sched_increase_karma(sched_job);
 
 	/* get the GPU back into the init state */
-	etnaviv_core_dump(gpu);
+	etnaviv_core_dump(submit);
 	etnaviv_gpu_recover_hang(gpu);
 
 	drm_sched_resubmit_jobs(&gpu->sched);