Skip to contentSkip to conversation

gpu: host1x: Reduce host1x job allocation size

PATCH In review David Ung 3 participants 10 messages Mar 6, 2015 – Apr 9, 2015 6 messages not in the archive

Subsystems (3)
lore
Share & tools
lore

David Ung

author
#0 lore raw

PATCH v2 1/3 gpu: host1x: Reduce host1x job allocation size

There is 2 set of num_relocs * sizeof(*) array at the end of host1x job. Only the 1st set is really used and with job->gather_addr_phys pointing somewhere within the 1st set of reloc physical addresses. This patch removes the 2nd set of unused addresses.

---
 drivers/gpu/host1x/job.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/host1x/job.c +3 -2
index 63bd63f..9c11265 100644
@@ -46,8 +46,9 @@ struct host1x_job *host1x_job_alloc(struct host1x_channel *ch,
 		(u64)num_unpins * sizeof(struct host1x_job_unpin_data) +
 		(u64)num_waitchks * sizeof(struct host1x_waitchk) +
 		(u64)num_cmdbufs * sizeof(struct host1x_job_gather) +
-		(u64)num_unpins * sizeof(dma_addr_t) +
-		(u64)num_unpins * sizeof(u32 *);
+		(u64)num_relocs * sizeof(dma_addr_t) +
+		(u64)num_cmdbufs * sizeof(dma_addr_t);
+
 	if (total > ULONG_MAX)
 		return NULL;
 
Signature · 1 line
1.8.1.5

A message that is not in the archive (sent off-list or not yet received): 1425606712-15986-1-git-send-email-davidu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org

author
#2 lore raw

PATCH v2 2/3 gpu: host1x: Remove addr_phys member from host1x_job

We are using addr_phys and gather_addr_phys/reloc_addr_phys interchangeably which points to the same set of memory. Using only gather/reloc_addr_phys make the code clearer and less error prone.

---
 drivers/gpu/host1x/job.c | 11 +++++------
 include/linux/host1x.h   |  1 -
 2 files changed, 5 insertions(+), 7 deletions(-)
drivers/gpu/host1x/job.c +5 -6
index 9c11265..7ecbefd 100644
@@ -69,10 +69,9 @@ struct host1x_job *host1x_job_alloc(struct host1x_channel *ch,
 	mem += num_waitchks * sizeof(struct host1x_waitchk);
 	job->gathers = num_cmdbufs ? mem : NULL;
 	mem += num_cmdbufs * sizeof(struct host1x_job_gather);
-	job->addr_phys = num_unpins ? mem : NULL;
-
-	job->reloc_addr_phys = job->addr_phys;
-	job->gather_addr_phys = &job->addr_phys[num_relocs];
+	job->reloc_addr_phys = num_unpins ? mem : NULL;
+	mem += num_relocs * sizeof(dma_addr_t);
+	job->gather_addr_phys = num_unpins ? mem : NULL;
 
 	return job;
 }
@@ -194,7 +193,7 @@ static unsigned int pin_job(struct host1x_job *job)
 		if (!phys_addr)
 			goto unpin;
 
-		job->addr_phys[job->num_unpins] = phys_addr;
+		job->reloc_addr_phys[i] = phys_addr;
 		job->unpins[job->num_unpins].bo = reloc->target.bo;
 		job->unpins[job->num_unpins].sgt = sgt;
 		job->num_unpins++;
@@ -213,7 +212,7 @@ static unsigned int pin_job(struct host1x_job *job)
 		if (!phys_addr)
 			goto unpin;
 
-		job->addr_phys[job->num_unpins] = phys_addr;
+		job->gather_addr_phys[i] = phys_addr;
 		job->unpins[job->num_unpins].bo = g->bo;
 		job->unpins[job->num_unpins].sgt = sgt;
 		job->num_unpins++;
include/linux/host1x.h +0 -1
index bb9840f..a722c4b 100644
@@ -202,7 +202,6 @@ struct host1x_job {
 	struct host1x_job_unpin_data *unpins;
 	unsigned int num_unpins;
 
-	dma_addr_t *addr_phys;
 	dma_addr_t *gather_addr_phys;
 	dma_addr_t *reloc_addr_phys;
 
Signature · 1 line
1.8.1.5
author
#3 lore raw

PATCH v2 3/3 gpu: host1x: Record the physical address for gathers

In reply to a message not in the archive

The gather's base physical address is recorded during patching of gathers, but only the 1st one within the same buffer object has it set, subsequent gathers in the same buffer are being skipped.
This patch records the phys addr during pin_job for all gathers.

---
 drivers/gpu/host1x/job.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/gpu/host1x/job.c +3 -6
index 7ecbefd..6b374bc 100644
@@ -202,17 +202,16 @@ static unsigned int pin_job(struct host1x_job *job)
 	for (i = 0; i < job->num_gathers; i++) {
 		struct host1x_job_gather *g = &job->gathers[i];
 		struct sg_table *sgt;
-		dma_addr_t phys_addr;
 
 		g->bo = host1x_bo_get(g->bo);
 		if (!g->bo)
 			goto unpin;
 
-		phys_addr = host1x_bo_pin(g->bo, &sgt);
-		if (!phys_addr)
+		g->base = host1x_bo_pin(g->bo, &sgt);
+		if (!g->base)
 			goto unpin;
 
-		job->gather_addr_phys[i] = phys_addr;
+		job->gather_addr_phys[i] = g->base;
 		job->unpins[job->num_unpins].bo = g->bo;
 		job->unpins[job->num_unpins].sgt = sgt;
 		job->num_unpins++;
@@ -536,8 +535,6 @@ int host1x_job_pin(struct host1x_job *job, struct device *dev)
 		if (g->handled)
 			continue;
 
-		g->base = job->gather_addr_phys[i];
-
 		for (j = i + 1; j < job->num_gathers; j++)
 			if (job->gathers[j].bo == g->bo)
 				job->gathers[j].handled = true;
Signature · 1 line
1.8.1.5
author
#4 lore raw
In reply to a message not in the archive

ping?

________________________________________
From: David Ung <[email protected]>
Sent: Thursday, March 5, 2015 5:51 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Arto Merilainen; Terje Bergstrom; [email protected]; David Ung
Subject: [PATCH V2 1/3] gpu: host1x: Reduce host1x job allocation size

There is 2 set of num_relocs * sizeof(*) array at the end of host1x job. Only the 1st set is really used and with job->gather_addr_phys pointing somewhere within the 1st set of reloc physical addresses. This patch removes the 2nd set of unused addresses.

---
 drivers/gpu/host1x/job.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/host1x/job.c +3 -2
index 63bd63f..9c11265 100644
@@ -46,8 +46,9 @@ struct host1x_job *host1x_job_alloc(struct host1x_channel *ch,
                (u64)num_unpins * sizeof(struct host1x_job_unpin_data) +
                (u64)num_waitchks * sizeof(struct host1x_waitchk) +
                (u64)num_cmdbufs * sizeof(struct host1x_job_gather) +
-               (u64)num_unpins * sizeof(dma_addr_t) +
-               (u64)num_unpins * sizeof(u32 *);
+               (u64)num_relocs * sizeof(dma_addr_t) +
+               (u64)num_cmdbufs * sizeof(dma_addr_t);
+
        if (total > ULONG_MAX)
                return NULL;
 

--
1.8.1.5

A message that is not in the archive (sent off-list or not yet received): 0e36c4295adc4f2daae9715cd0dde87d-wO81nVYWzR5xWE4FnwvcdlaTQe2KTcn/@public.gmane.org

#6 lore raw

The series looks ok to me, the only problem I see is that we are lacking means to thoroughly test host1x patches across all the supported Tegra chips.

Could you detail what kind of testing this patch series has undergone, and which chips/boards have been tested?

Quoted 38 lines · David Ung

ping?

________________________________________
From: David Ung <[email protected]>
Sent: Thursday, March 5, 2015 5:51 PM
To: [email protected]
Cc: [email protected]; [email protected]; [email protected]; Arto Merilainen; Terje Bergstrom; [email protected]; David Ung
Subject: [PATCH V2 1/3] gpu: host1x: Reduce host1x job allocation size

There is 2 set of num_relocs * sizeof(*) array at the end of host1x job. Only the 1st set is really used and with job->gather_addr_phys pointing somewhere within the 1st set of reloc physical addresses. This patch removes the 2nd set of unused addresses.

---
 drivers/gpu/host1x/job.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/host1x/job.c +3 -3
index 63bd63f..9c11265 100644
@@ -46,8 +46,9 @@ struct host1x_job *host1x_job_alloc(struct host1x_channel *ch,
                (u64)num_unpins * sizeof(struct host1x_job_unpin_data) +
                (u64)num_waitchks * sizeof(struct host1x_waitchk) +
                (u64)num_cmdbufs * sizeof(struct host1x_job_gather) +
-               (u64)num_unpins * sizeof(dma_addr_t) +
-               (u64)num_unpins * sizeof(u32 *);
+               (u64)num_relocs * sizeof(dma_addr_t) +
+               (u64)num_cmdbufs * sizeof(dma_addr_t);
+
        if (total > ULONG_MAX)
                return NULL;
 
--

1.8.1.5

A message that is not in the archive (sent off-list or not yet received): CAAVeFuK4NOrfCcX846rgPdViR6Ur4pSrrVihiV7KP1kRf15kdw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#8 lore raw
Quoted 10 lines

-----Original Message-----
From: Alexandre Courbot [mailto:[email protected]]
Sent: Monday, March 23, 2015 12:09 AM
To: David Ung
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Arto Merilainen; Terje Bergstrom
Subject: Re: [PATCH V2 1/3] gpu: host1x: Reduce host1x job allocation size

Quoted 6 lines

The series looks ok to me, the only problem I see is that we are lacking means to thoroughly test host1x patches across all the supported Tegra chips.

Could you detail what kind of testing this patch series has undergone, and which chips/boards have been tested?

Tested the host1x channel tests for T132 on A44.
Also ran Paul's EIMT set up which only tests booting kernel to console for T20/T30/T114/T124 and QEMU

A message that is not in the archive (sent off-list or not yet received): 2253e92cd45c4b33913a45011c4ce823-wO81nVYWzR5xWE4FnwvcdlaTQe2KTcn/@public.gmane.org

#10 lore raw
Quoted 14 lines · David Ung
Quoted 14 lines

-----Original Message-----
From: Alexandre Courbot [mailto:[email protected]]
Sent: Monday, March 23, 2015 12:09 AM
To: David Ung
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Arto Merilainen; Terje Bergstrom
Subject: Re: [PATCH V2 1/3] gpu: host1x: Reduce host1x job allocation size

The series looks ok to me, the only problem I see is that we are lacking means to thoroughly test host1x patches across all the supported Tegra chips.

Quoted 5 lines
Quoted 2 lines

Could you detail what kind of testing this patch series has undergone, and which chips/boards have been tested?

Tested the host1x channel tests for T132 on A44.
Also ran Paul's EIMT set up which only tests booting kernel to console for T20/T30/T114/T124 and QEMU

Thierry, what do you think?

I know we are lacking proper testing infrastructure for host1x, but these patches really looks harmless to me.

A message that is not in the archive (sent off-list or not yet received): CAAVeFuLZOJdOtpuSqdRzGa0rK3WZWURz-pn2tXhqTv58J0R_NA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

author
#12 lore raw
Quoted 27 lines

-----Original Message-----
From: Alexandre Courbot [mailto:[email protected]]
Sent: Monday, March 30, 2015 11:30 PM
To: David Ung; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Arto Merilainen; Terje Bergstrom
Subject: Re: [PATCH V2 1/3] gpu: host1x: Reduce host1x job allocation size

Quoted 18 lines · David Ung
Quoted 17 lines

-----Original Message-----
From: Alexandre Courbot [mailto:[email protected]]
Sent: Monday, March 23, 2015 12:09 AM
To: David Ung
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Arto Merilainen; Terje Bergstrom
Subject: Re: [PATCH V2 1/3] gpu: host1x: Reduce host1x job allocation size

The series looks ok to me, the only problem I see is that we are lacking means to thoroughly test host1x patches across all the supported Tegra chips.

Could you detail what kind of testing this patch series has undergone, and which chips/boards have been tested?

Quoted 8 lines
Quoted 3 lines

Tested the host1x channel tests for T132 on A44.
Also ran Paul's EIMT set up which only tests booting kernel to console for T20/T30/T114/T124 and QEMU

Thierry, what do you think?

I know we are lacking proper testing infrastructure for host1x, but these patches really looks harmless to me.

Thank you Alex for the review.
It would be good to have closure to this patchset.

Thierry ping?

A message that is not in the archive (sent off-list or not yet received): 4ca2d661eab54c3eb861680ebc24a430-wO81nVYWzR5xWE4FnwvcdlaTQe2KTcn/@public.gmane.org

Reviewed-by
#14 lore raw

Forgot this:

Quoted 42 lines · David Ung
Quoted 27 lines

-----Original Message-----
From: Alexandre Courbot [mailto:[email protected]]
Sent: Monday, March 30, 2015 11:30 PM
To: David Ung; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Arto Merilainen; Terje Bergstrom
Subject: Re: [PATCH V2 1/3] gpu: host1x: Reduce host1x job allocation size

Quoted 18 lines · David Ung
Quoted 17 lines

-----Original Message-----
From: Alexandre Courbot [mailto:[email protected]]
Sent: Monday, March 23, 2015 12:09 AM
To: David Ung
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Arto Merilainen; Terje Bergstrom
Subject: Re: [PATCH V2 1/3] gpu: host1x: Reduce host1x job allocation
size

The series looks ok to me, the only problem I see is that we are lacking means to thoroughly test host1x patches across all the supported Tegra chips.

Could you detail what kind of testing this patch series has undergone, and which chips/boards have been tested?

Quoted 8 lines
Quoted 3 lines

Tested the host1x channel tests for T132 on A44.
Also ran Paul's EIMT set up which only tests booting kernel to console for T20/T30/T114/T124 and QEMU

Thierry, what do you think?

I know we are lacking proper testing infrastructure for host1x, but these patches really looks harmless to me.

Thank you Alex for the review.
It would be good to have closure to this patchset.

Thierry ping?

#15 lore raw
In reply to a message not in the archive
Quoted 31 lines · David Ung
Quoted 31 lines

-----Original Message-----
From: Alexandre Courbot [mailto:[email protected]]
Sent: Monday, March 30, 2015 11:30 PM
To: David Ung; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Arto Merilainen; Terje Bergstrom
Subject: Re: [PATCH V2 1/3] gpu: host1x: Reduce host1x job allocation size

Quoted 21 lines · David Ung
Quoted 11 lines

-----Original Message-----
From: Alexandre Courbot [mailto:[email protected]]
Sent: Monday, March 23, 2015 12:09 AM
To: David Ung
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Arto Merilainen; Terje Bergstrom
Subject: Re: [PATCH V2 1/3] gpu: host1x: Reduce host1x job allocation
size

Quoted 6 lines

The series looks ok to me, the only problem I see is that we are lacking means to thoroughly test host1x patches across all the supported Tegra chips.

Could you detail what kind of testing this patch series has undergone, and which chips/boards have been tested?

Tested the host1x channel tests for T132 on A44.
Also ran Paul's EIMT set up which only tests booting kernel to console for T20/T30/T114/T124 and QEMU

Quoted 8 lines
Quoted 4 lines

Thierry, what do you think?

I know we are lacking proper testing infrastructure for host1x, but these patches really looks harmless to me.

Thank you Alex for the review.
It would be good to have closure to this patchset.

We'll get closure on this once the testing infrastructure appears. I won't apply these patches before then.

Thierry