* [igt-dev] [PATCH i-g-t 1/3] tools/aubdump: Add gen8_map_range
@ 2018-03-07 8:31 Jordan Justen
2018-03-07 8:31 ` [igt-dev] [PATCH i-g-t 2/3] tools/aubdump: Add bitmap to track gtt pages that have been mapped Jordan Justen
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Jordan Justen @ 2018-03-07 8:31 UTC (permalink / raw)
To: IGT GPU Tools
This function should allow us to only write the page table entries
that get used.
v2:
* Use align; deobfuscate start addr calc. (Scott)
Cc: Scott D Phillips <scott.d.phillips@intel.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
---
tools/aubdump.c | 40 +++++++++++++++++++++++++++++-----------
1 file changed, 29 insertions(+), 11 deletions(-)
diff --git a/tools/aubdump.c b/tools/aubdump.c
index 5989bed4..bf4be82d 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -382,12 +382,39 @@ register_write_out(uint32_t addr, uint32_t value)
dword_out(value);
}
+static void
+gen8_map_ggtt_range(uint64_t start, uint64_t end)
+{
+ uint64_t entry_addr;
+ uint64_t page_num;
+ uint64_t end_aligned = align_u64(end, 4096);
+
+ if (start >= end && end < 1ull << 32)
+ return;
+
+ entry_addr = start & ~(4096 - 1);
+ do {
+ page_num = entry_addr >> 21;
+ uint64_t last_page_entry =
+ min((page_num + 1) << 21, end_aligned);
+ uint64_t num_entries = (last_page_entry - entry_addr) >> 12;
+ mem_trace_memory_write_header_out(
+ entry_addr >> 9, num_entries * GEN8_PTE_SIZE,
+ AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT_ENTRY);
+ while (num_entries-- > 0) {
+ dword_out((entry_addr & ~(4096 - 1)) |
+ 3 /* read/write | present */);
+ dword_out(entry_addr >> 32);
+ entry_addr += 4096;
+ }
+ } while (entry_addr < end);
+}
+
static void
gen10_write_header(void)
{
char app_name[8 * 4];
int app_name_len, dwords;
- uint32_t entry = 0x3; /* read/write | present */
app_name_len =
snprintf(app_name, sizeof(app_name), "PCI-ID=0x%X %s", device,
@@ -403,16 +430,7 @@ gen10_write_header(void)
dword_out(0); /* version */
data_out(app_name, app_name_len);
- /* GGTT PT */
- for (uint32_t page = 0; page < ALIGN(PT_SIZE, 4096) / 4096; page++) {
- uint32_t to_write = min(PT_SIZE - page * 4096, 4096);
- mem_trace_memory_write_header_out(page << 12, to_write,
- AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT_ENTRY);
- for (uint32_t i = 0; i < to_write / GEN8_PTE_SIZE; i++) {
- dword_out(entry + 0x1000 * i + 0x200000 * page);
- dword_out(0);
- }
- }
+ gen8_map_ggtt_range(0, MEMORY_MAP_SIZE);
/* RENDER_RING */
mem_trace_memory_write_header_out(RENDER_RING_ADDR, RING_SIZE,
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [igt-dev] [PATCH i-g-t 2/3] tools/aubdump: Add bitmap to track gtt pages that have been mapped
2018-03-07 8:31 [igt-dev] [PATCH i-g-t 1/3] tools/aubdump: Add gen8_map_range Jordan Justen
@ 2018-03-07 8:31 ` Jordan Justen
2018-03-07 16:20 ` Scott D Phillips
2018-03-07 8:31 ` [igt-dev] [PATCH i-g-t 3/3] tools/aubdump: For gen10+ support addresses up to 4GB Jordan Justen
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Jordan Justen @ 2018-03-07 8:31 UTC (permalink / raw)
To: IGT GPU Tools
This will allow us to map ranges as they are used, but prevents
remapping already mapped regions.
By mapping ranges as they are used, we can support pinned pages
without having to map all pages of the first 32-bits.
v2:
* Make bitmap manipulation functions independent from 4k page size.
Maybe will be usable also for 1GB pages with PPGTT.
Cc: Scott D Phillips <scott.d.phillips@intel.com>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
---
tools/aubdump.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 95 insertions(+), 1 deletion(-)
diff --git a/tools/aubdump.c b/tools/aubdump.c
index bf4be82d..dc5db9dc 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -383,7 +383,7 @@ register_write_out(uint32_t addr, uint32_t value)
}
static void
-gen8_map_ggtt_range(uint64_t start, uint64_t end)
+gen8_emit_ggtt_pte_for_range(uint64_t start, uint64_t end)
{
uint64_t entry_addr;
uint64_t page_num;
@@ -410,6 +410,100 @@ gen8_map_ggtt_range(uint64_t start, uint64_t end)
} while (entry_addr < end);
}
+/**
+ * Sets bits `start` through `end` - 1 in the bitmap array.
+ */
+static void
+set_bitmap_range(uint32_t *bitmap, uint32_t start, uint32_t end)
+{
+ uint32_t pos = start;
+ while (pos < end) {
+ const uint32_t bit = 1 << (pos & 0x1f);
+ if (bit == 1 && (end - pos) > 32) {
+ bitmap[pos >> 5] = 0xffffffff;
+ pos += 32;
+ } else {
+ bitmap[pos >> 5] |= bit;
+ pos++;
+ }
+ }
+}
+
+/**
+ * Finds the next `set` (or clear) bit in the bitmap array.
+ *
+ * The search starts at `*start` and only checks until `end` - 1.
+ *
+ * If found, returns true, and the found bit index in `*start`.
+ */
+static bool
+find_bitmap_bit(uint32_t *bitmap, bool set, uint32_t *start, uint32_t end)
+{
+ uint32_t pos = *start;
+ const uint32_t neg_dw = set ? 0 : -1;
+ while (pos < end) {
+ const uint32_t dw = bitmap[pos >> 5];
+ const uint32_t bit = 1 << (pos & 0x1f);
+ if (!!(dw & bit) == set) {
+ *start = pos;
+ return true;
+ } else if (bit == 1 && dw == neg_dw)
+ pos += 32;
+ else
+ pos++;
+ }
+ return false;
+}
+
+/**
+ * Finds a range of clear bits within the bitmap array.
+ *
+ * The search starts at `*start` and only checks until `*end` - 1.
+ *
+ * If found, returns true, and `*start` and `*end` are set for the
+ * range of clear bits.
+ */
+static bool
+find_bitmap_clear_bit_range(uint32_t *bitmap, uint32_t *start, uint32_t *end)
+{
+ if (find_bitmap_bit(bitmap, false, start, *end)) {
+ uint32_t found_end = *start;
+ if (find_bitmap_bit(bitmap, true, &found_end, *end))
+ *end = found_end;
+ return true;
+ }
+ return false;
+}
+
+static void
+gen8_map_ggtt_range(uint64_t start, uint64_t end)
+{
+ uint32_t pos1, pos2, end_pos;
+ static uint32_t *bitmap = NULL;
+ if (bitmap == NULL) {
+ /* 4GiB (32-bits) of 4KiB pages (12-bits) in dwords (5-bits) */
+ bitmap = calloc(1 << (32 - 12 - 5), sizeof(*bitmap));
+ if (bitmap == NULL)
+ return;
+ }
+
+ pos1 = start >> 12;
+ end_pos = (end + 4096 - 1) >> 12;
+ while (pos1 < end_pos) {
+ pos2 = end_pos;
+ if (!find_bitmap_clear_bit_range(bitmap, &pos1, &pos2))
+ break;
+
+ if (verbose)
+ printf("MAPPING 0x%08lx-0x%08lx\n",
+ (uint64_t)pos1 << 12, (uint64_t)pos2 << 12);
+ gen8_emit_ggtt_pte_for_range((uint64_t)pos1 << 12,
+ (uint64_t)pos2 << 12);
+ set_bitmap_range(bitmap, (uint64_t)pos1, (uint64_t)pos2);
+ pos1 = pos2;
+ }
+}
+
static void
gen10_write_header(void)
{
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [igt-dev] [PATCH i-g-t 3/3] tools/aubdump: For gen10+ support addresses up to 4GB
2018-03-07 8:31 [igt-dev] [PATCH i-g-t 1/3] tools/aubdump: Add gen8_map_range Jordan Justen
2018-03-07 8:31 ` [igt-dev] [PATCH i-g-t 2/3] tools/aubdump: Add bitmap to track gtt pages that have been mapped Jordan Justen
@ 2018-03-07 8:31 ` Jordan Justen
2018-03-07 8:42 ` Jordan Justen
2018-03-07 16:21 ` Scott D Phillips
2018-03-07 8:43 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/3] tools/aubdump: Add gen8_map_range Patchwork
2018-03-07 16:09 ` [igt-dev] [PATCH i-g-t 1/3] " Scott D Phillips
3 siblings, 2 replies; 8+ messages in thread
From: Jordan Justen @ 2018-03-07 8:31 UTC (permalink / raw)
To: IGT GPU Tools; +Cc: Kenneth Graunke
For gen10, we now add mappings for buffers as they are needed.
Instead of doing this dynamically, we could always map the entire 4GB.
With 4KB pages, the tables would take up 8MB in every AUB. AUBs are
often quite huge compared to 8MB, but they can also be just a few
hundred KB.
This should allow the AUB to create up to about 4GB of allocated
buffers, whereas before we were limited to about 64MB.
While it is unlikely that we'll try to capture AUBs that generate
buffers up to 4GB in size, this change also should allow pinned
buffers to be used anywhere in the first 4GB. (I tested a pinned
buffer at 0xf0000000.)
Cc: Scott D Phillips <scott.d.phillips@intel.com>
Cc: Kenneth Graunke <kenneth@whitecape.org>
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
---
tools/aubdump.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/tools/aubdump.c b/tools/aubdump.c
index dc5db9dc..473dea4b 100644
--- a/tools/aubdump.c
+++ b/tools/aubdump.c
@@ -504,6 +504,12 @@ gen8_map_ggtt_range(uint64_t start, uint64_t end)
}
}
+static void
+gen8_map_base_size(uint64_t base, uint64_t size)
+{
+ gen8_map_range(base, base + size);
+}
+
static void
gen10_write_header(void)
{
@@ -524,15 +530,16 @@ gen10_write_header(void)
dword_out(0); /* version */
data_out(app_name, app_name_len);
- gen8_map_ggtt_range(0, MEMORY_MAP_SIZE);
-
/* RENDER_RING */
+ gen8_map_base_size(RENDER_RING_ADDR, RING_SIZE);
mem_trace_memory_write_header_out(RENDER_RING_ADDR, RING_SIZE,
AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
dword_out(0);
/* RENDER_PPHWSP */
+ gen8_map_base_size(RENDER_CONTEXT_ADDR,
+ PPHWSP_SIZE + sizeof(render_context_init));
mem_trace_memory_write_header_out(RENDER_CONTEXT_ADDR,
PPHWSP_SIZE +
sizeof(render_context_init),
@@ -544,12 +551,15 @@ gen10_write_header(void)
data_out(render_context_init, sizeof(render_context_init));
/* BLITTER_RING */
+ gen8_map_base_size(BLITTER_RING_ADDR, RING_SIZE);
mem_trace_memory_write_header_out(BLITTER_RING_ADDR, RING_SIZE,
AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
dword_out(0);
/* BLITTER_PPHWSP */
+ gen8_map_base_size(BLITTER_CONTEXT_ADDR,
+ PPHWSP_SIZE + sizeof(blitter_context_init));
mem_trace_memory_write_header_out(BLITTER_CONTEXT_ADDR,
PPHWSP_SIZE +
sizeof(blitter_context_init),
@@ -561,12 +571,15 @@ gen10_write_header(void)
data_out(blitter_context_init, sizeof(blitter_context_init));
/* VIDEO_RING */
+ gen8_map_base_size(VIDEO_RING_ADDR, RING_SIZE);
mem_trace_memory_write_header_out(VIDEO_RING_ADDR, RING_SIZE,
AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
dword_out(0);
/* VIDEO_PPHWSP */
+ gen8_map_base_size(VIDEO_CONTEXT_ADDR,
+ PPHWSP_SIZE + sizeof(video_context_init));
mem_trace_memory_write_header_out(VIDEO_CONTEXT_ADDR,
PPHWSP_SIZE +
sizeof(video_context_init),
@@ -961,6 +974,9 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2)
if (bo->map == NULL && bo->size > 0)
bo->map = gem_mmap(fd, obj->handle, 0, bo->size);
fail_if(bo->map == MAP_FAILED, "intel_aubdump: bo mmap failed\n");
+
+ if (gen >= 10)
+ gen8_map_range(bo->offset, bo->offset + bo->size);
}
batch_index = (execbuffer2->flags & I915_EXEC_BATCH_FIRST) ? 0 :
--
2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 3/3] tools/aubdump: For gen10+ support addresses up to 4GB
2018-03-07 8:31 ` [igt-dev] [PATCH i-g-t 3/3] tools/aubdump: For gen10+ support addresses up to 4GB Jordan Justen
@ 2018-03-07 8:42 ` Jordan Justen
2018-03-07 16:21 ` Scott D Phillips
1 sibling, 0 replies; 8+ messages in thread
From: Jordan Justen @ 2018-03-07 8:42 UTC (permalink / raw)
To: IGT GPU Tools; +Cc: Kenneth Graunke
On 2018-03-07 00:31:21, Jordan Justen wrote:
> For gen10, we now add mappings for buffers as they are needed.
>
> Instead of doing this dynamically, we could always map the entire 4GB.
> With 4KB pages, the tables would take up 8MB in every AUB. AUBs are
> often quite huge compared to 8MB, but they can also be just a few
> hundred KB.
>
> This should allow the AUB to create up to about 4GB of allocated
> buffers, whereas before we were limited to about 64MB.
>
> While it is unlikely that we'll try to capture AUBs that generate
> buffers up to 4GB in size, this change also should allow pinned
> buffers to be used anywhere in the first 4GB. (I tested a pinned
> buffer at 0xf0000000.)
>
> Cc: Scott D Phillips <scott.d.phillips@intel.com>
> Cc: Kenneth Graunke <kenneth@whitecape.org>
> Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
> ---
> tools/aubdump.c | 20 ++++++++++++++++++--
> 1 file changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/tools/aubdump.c b/tools/aubdump.c
> index dc5db9dc..473dea4b 100644
> --- a/tools/aubdump.c
> +++ b/tools/aubdump.c
> @@ -504,6 +504,12 @@ gen8_map_ggtt_range(uint64_t start, uint64_t end)
> }
> }
>
> +static void
> +gen8_map_base_size(uint64_t base, uint64_t size)
> +{
> + gen8_map_range(base, base + size);
Whoops. s/gen8_map_range/gen8_map_ggtt_range/
Updated in git://people.freedesktop.org/~jljusten/intel-gpu-tools aubdump
> +}
> +
> static void
> gen10_write_header(void)
> {
> @@ -524,15 +530,16 @@ gen10_write_header(void)
> dword_out(0); /* version */
> data_out(app_name, app_name_len);
>
> - gen8_map_ggtt_range(0, MEMORY_MAP_SIZE);
> -
> /* RENDER_RING */
> + gen8_map_base_size(RENDER_RING_ADDR, RING_SIZE);
> mem_trace_memory_write_header_out(RENDER_RING_ADDR, RING_SIZE,
> AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
> for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
> dword_out(0);
>
> /* RENDER_PPHWSP */
> + gen8_map_base_size(RENDER_CONTEXT_ADDR,
> + PPHWSP_SIZE + sizeof(render_context_init));
> mem_trace_memory_write_header_out(RENDER_CONTEXT_ADDR,
> PPHWSP_SIZE +
> sizeof(render_context_init),
> @@ -544,12 +551,15 @@ gen10_write_header(void)
> data_out(render_context_init, sizeof(render_context_init));
>
> /* BLITTER_RING */
> + gen8_map_base_size(BLITTER_RING_ADDR, RING_SIZE);
> mem_trace_memory_write_header_out(BLITTER_RING_ADDR, RING_SIZE,
> AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
> for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
> dword_out(0);
>
> /* BLITTER_PPHWSP */
> + gen8_map_base_size(BLITTER_CONTEXT_ADDR,
> + PPHWSP_SIZE + sizeof(blitter_context_init));
> mem_trace_memory_write_header_out(BLITTER_CONTEXT_ADDR,
> PPHWSP_SIZE +
> sizeof(blitter_context_init),
> @@ -561,12 +571,15 @@ gen10_write_header(void)
> data_out(blitter_context_init, sizeof(blitter_context_init));
>
> /* VIDEO_RING */
> + gen8_map_base_size(VIDEO_RING_ADDR, RING_SIZE);
> mem_trace_memory_write_header_out(VIDEO_RING_ADDR, RING_SIZE,
> AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_LOCAL);
> for (uint32_t i = 0; i < RING_SIZE; i += sizeof(uint32_t))
> dword_out(0);
>
> /* VIDEO_PPHWSP */
> + gen8_map_base_size(VIDEO_CONTEXT_ADDR,
> + PPHWSP_SIZE + sizeof(video_context_init));
> mem_trace_memory_write_header_out(VIDEO_CONTEXT_ADDR,
> PPHWSP_SIZE +
> sizeof(video_context_init),
> @@ -961,6 +974,9 @@ dump_execbuffer2(int fd, struct drm_i915_gem_execbuffer2 *execbuffer2)
> if (bo->map == NULL && bo->size > 0)
> bo->map = gem_mmap(fd, obj->handle, 0, bo->size);
> fail_if(bo->map == MAP_FAILED, "intel_aubdump: bo mmap failed\n");
> +
> + if (gen >= 10)
> + gen8_map_range(bo->offset, bo->offset + bo->size);
s/gen8_map_range/gen8_map_ggtt_range/
> }
>
> batch_index = (execbuffer2->flags & I915_EXEC_BATCH_FIRST) ? 0 :
> --
> 2.16.1
>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 8+ messages in thread
* [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/3] tools/aubdump: Add gen8_map_range
2018-03-07 8:31 [igt-dev] [PATCH i-g-t 1/3] tools/aubdump: Add gen8_map_range Jordan Justen
2018-03-07 8:31 ` [igt-dev] [PATCH i-g-t 2/3] tools/aubdump: Add bitmap to track gtt pages that have been mapped Jordan Justen
2018-03-07 8:31 ` [igt-dev] [PATCH i-g-t 3/3] tools/aubdump: For gen10+ support addresses up to 4GB Jordan Justen
@ 2018-03-07 8:43 ` Patchwork
2018-03-07 16:09 ` [igt-dev] [PATCH i-g-t 1/3] " Scott D Phillips
3 siblings, 0 replies; 8+ messages in thread
From: Patchwork @ 2018-03-07 8:43 UTC (permalink / raw)
To: Jordan Justen; +Cc: igt-dev
== Series Details ==
Series: series starting with [i-g-t,1/3] tools/aubdump: Add gen8_map_range
URL : https://patchwork.freedesktop.org/series/39511/
State : failure
== Summary ==
IGT patchset build failed on latest successful build
b4689dce36d0fbd9aec70d5a4b077c43a6b9c254 igt: Remove gen7_forcewake_mt
make all-recursive
Making all in lib
make all-recursive
Making all in .
Making all in tests
make[4]: Nothing to be done for 'all'.
Making all in man
make[2]: Nothing to be done for 'all'.
Making all in tools
Making all in null_state_gen
make[3]: Nothing to be done for 'all'.
Making all in registers
make[3]: Nothing to be done for 'all'.
CC aubdump.lo
aubdump.c: In function ‘gen8_emit_ggtt_pte_for_range’:
aubdump.c:398:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
uint64_t last_page_entry =
^~~~~~~~
aubdump.c: In function ‘gen8_map_base_size’:
aubdump.c:510:2: error: implicit declaration of function ‘gen8_map_range’ [-Werror=implicit-function-declaration]
gen8_map_range(base, base + size);
^~~~~~~~~~~~~~
aubdump.c:510:2: warning: nested extern declaration of ‘gen8_map_range’ [-Wnested-externs]
At top level:
aubdump.c:479:1: warning: ‘gen8_map_ggtt_range’ defined but not used [-Wunused-function]
gen8_map_ggtt_range(uint64_t start, uint64_t end)
^~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
Makefile:1174: recipe for target 'aubdump.lo' failed
make[3]: *** [aubdump.lo] Error 1
Makefile:1222: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
Makefile:532: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
Makefile:464: recipe for target 'all' failed
make: *** [all] Error 2
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/3] tools/aubdump: Add gen8_map_range
2018-03-07 8:31 [igt-dev] [PATCH i-g-t 1/3] tools/aubdump: Add gen8_map_range Jordan Justen
` (2 preceding siblings ...)
2018-03-07 8:43 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/3] tools/aubdump: Add gen8_map_range Patchwork
@ 2018-03-07 16:09 ` Scott D Phillips
3 siblings, 0 replies; 8+ messages in thread
From: Scott D Phillips @ 2018-03-07 16:09 UTC (permalink / raw)
To: Jordan Justen, IGT GPU Tools
Jordan Justen <jordan.l.justen@intel.com> writes:
> This function should allow us to only write the page table entries
> that get used.
>
> v2:
> * Use align; deobfuscate start addr calc. (Scott)
>
> Cc: Scott D Phillips <scott.d.phillips@intel.com>
> Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
> ---
> tools/aubdump.c | 40 +++++++++++++++++++++++++++++-----------
> 1 file changed, 29 insertions(+), 11 deletions(-)
>
> diff --git a/tools/aubdump.c b/tools/aubdump.c
> index 5989bed4..bf4be82d 100644
> --- a/tools/aubdump.c
> +++ b/tools/aubdump.c
> @@ -382,12 +382,39 @@ register_write_out(uint32_t addr, uint32_t value)
> dword_out(value);
> }
>
> +static void
> +gen8_map_ggtt_range(uint64_t start, uint64_t end)
> +{
> + uint64_t entry_addr;
> + uint64_t page_num;
> + uint64_t end_aligned = align_u64(end, 4096);
> +
> + if (start >= end && end < 1ull << 32)
Did you mean something like (start >= end || end > 1ull << 32) ?
With that changed, this is
Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
> + return;
> +
> + entry_addr = start & ~(4096 - 1);
> + do {
> + page_num = entry_addr >> 21;
> + uint64_t last_page_entry =
> + min((page_num + 1) << 21, end_aligned);
> + uint64_t num_entries = (last_page_entry - entry_addr) >> 12;
> + mem_trace_memory_write_header_out(
> + entry_addr >> 9, num_entries * GEN8_PTE_SIZE,
> + AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT_ENTRY);
> + while (num_entries-- > 0) {
> + dword_out((entry_addr & ~(4096 - 1)) |
> + 3 /* read/write | present */);
> + dword_out(entry_addr >> 32);
> + entry_addr += 4096;
> + }
> + } while (entry_addr < end);
> +}
> +
> static void
> gen10_write_header(void)
> {
> char app_name[8 * 4];
> int app_name_len, dwords;
> - uint32_t entry = 0x3; /* read/write | present */
>
> app_name_len =
> snprintf(app_name, sizeof(app_name), "PCI-ID=0x%X %s", device,
> @@ -403,16 +430,7 @@ gen10_write_header(void)
> dword_out(0); /* version */
> data_out(app_name, app_name_len);
>
> - /* GGTT PT */
> - for (uint32_t page = 0; page < ALIGN(PT_SIZE, 4096) / 4096; page++) {
> - uint32_t to_write = min(PT_SIZE - page * 4096, 4096);
> - mem_trace_memory_write_header_out(page << 12, to_write,
> - AUB_MEM_TRACE_MEMORY_ADDRESS_SPACE_GGTT_ENTRY);
> - for (uint32_t i = 0; i < to_write / GEN8_PTE_SIZE; i++) {
> - dword_out(entry + 0x1000 * i + 0x200000 * page);
> - dword_out(0);
> - }
> - }
> + gen8_map_ggtt_range(0, MEMORY_MAP_SIZE);
>
> /* RENDER_RING */
> mem_trace_memory_write_header_out(RENDER_RING_ADDR, RING_SIZE,
> --
> 2.16.1
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 2/3] tools/aubdump: Add bitmap to track gtt pages that have been mapped
2018-03-07 8:31 ` [igt-dev] [PATCH i-g-t 2/3] tools/aubdump: Add bitmap to track gtt pages that have been mapped Jordan Justen
@ 2018-03-07 16:20 ` Scott D Phillips
0 siblings, 0 replies; 8+ messages in thread
From: Scott D Phillips @ 2018-03-07 16:20 UTC (permalink / raw)
To: Jordan Justen, IGT GPU Tools
Jordan Justen <jordan.l.justen@intel.com> writes:
> This will allow us to map ranges as they are used, but prevents
> remapping already mapped regions.
>
> By mapping ranges as they are used, we can support pinned pages
> without having to map all pages of the first 32-bits.
>
> v2:
> * Make bitmap manipulation functions independent from 4k page size.
> Maybe will be usable also for 1GB pages with PPGTT.
>
> Cc: Scott D Phillips <scott.d.phillips@intel.com>
> Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
lgtm
Reviewed-b: Scott D Phillips <scott.d.phillips@intel.com>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 3/3] tools/aubdump: For gen10+ support addresses up to 4GB
2018-03-07 8:31 ` [igt-dev] [PATCH i-g-t 3/3] tools/aubdump: For gen10+ support addresses up to 4GB Jordan Justen
2018-03-07 8:42 ` Jordan Justen
@ 2018-03-07 16:21 ` Scott D Phillips
1 sibling, 0 replies; 8+ messages in thread
From: Scott D Phillips @ 2018-03-07 16:21 UTC (permalink / raw)
To: Jordan Justen, IGT GPU Tools; +Cc: Kenneth Graunke
Jordan Justen <jordan.l.justen@intel.com> writes:
> For gen10, we now add mappings for buffers as they are needed.
>
> Instead of doing this dynamically, we could always map the entire 4GB.
> With 4KB pages, the tables would take up 8MB in every AUB. AUBs are
> often quite huge compared to 8MB, but they can also be just a few
> hundred KB.
>
> This should allow the AUB to create up to about 4GB of allocated
> buffers, whereas before we were limited to about 64MB.
>
> While it is unlikely that we'll try to capture AUBs that generate
> buffers up to 4GB in size, this change also should allow pinned
> buffers to be used anywhere in the first 4GB. (I tested a pinned
> buffer at 0xf0000000.)
>
> Cc: Scott D Phillips <scott.d.phillips@intel.com>
> Cc: Kenneth Graunke <kenneth@whitecape.org>
> Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Scott D Phillips <scott.d.phillips@intel.com>
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-03-07 16:21 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-07 8:31 [igt-dev] [PATCH i-g-t 1/3] tools/aubdump: Add gen8_map_range Jordan Justen
2018-03-07 8:31 ` [igt-dev] [PATCH i-g-t 2/3] tools/aubdump: Add bitmap to track gtt pages that have been mapped Jordan Justen
2018-03-07 16:20 ` Scott D Phillips
2018-03-07 8:31 ` [igt-dev] [PATCH i-g-t 3/3] tools/aubdump: For gen10+ support addresses up to 4GB Jordan Justen
2018-03-07 8:42 ` Jordan Justen
2018-03-07 16:21 ` Scott D Phillips
2018-03-07 8:43 ` [igt-dev] ✗ Fi.CI.BAT: failure for series starting with [i-g-t,1/3] tools/aubdump: Add gen8_map_range Patchwork
2018-03-07 16:09 ` [igt-dev] [PATCH i-g-t 1/3] " Scott D Phillips
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox