<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, Jul 18, 2018 at 3:08 AM Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 18/07/18 00:05, Jason Ekstrand wrote:<br>
> For large buffers which span an entire l1 page table, we got the range<br>
> calculations wrong. In this case, we end up with an l1_start which is<br>
> the first byte represented by the given l1 table and an l1_end which is<br>
> the first byte after the range represented by the l1 table. Then<br>
> l2_start_index == L2_index(l2_end) due to roll-over. Instead, compute<br>
> lN_end using (1Ull << shift) - 1 so that lN_end is the last byte in the<br>
> range represented by the Nth level page table. When we do this, we<br>
> don't need the conditional expression anymore.<br>
> ---<br>
> src/intel/tools/intel_dump_gpu.c | 12 ++++++------<br>
> 1 file changed, 6 insertions(+), 6 deletions(-)<br>
><br>
> diff --git a/src/intel/tools/intel_dump_gpu.c b/src/intel/tools/intel_dump_gpu.c<br>
> index 766ba662d91..5a0283960c1 100644<br>
> --- a/src/intel/tools/intel_dump_gpu.c<br>
> +++ b/src/intel/tools/intel_dump_gpu.c<br>
> @@ -457,28 +457,28 @@ map_ppgtt(uint64_t start, uint64_t size)<br>
> <br>
> for (uint64_t l4 = l4_start; l4 < l4_end; l4 += (1ULL << 39)) {<br>
> uint64_t l3_start = max(l4, start & 0xffffc0000000);<br>
> - uint64_t l3_end = min(l4 + (1ULL << 39),<br>
> + uint64_t l3_end = min(l4 + (1ULL << 39) - 1,<br>
> ((start + size - 1) | 0x00003fffffff) & 0xffffffffffff);<br>
> uint64_t l3_start_idx = L3_index(l3_start);<br>
> - uint64_t l3_end_idx = L3_index(l3_start) >= l3_start_idx ? L3_index(l3_end) : 0x1ff;<br>
> + uint64_t l3_end_idx = L3_index(l3_start);<br>
<br>
uint64_t l3_end_idx = L3_index(l3_end);<br></blockquote><div><br></div><div>Right. Fixed locally. Review?<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
> <br>
> populate_ppgtt_table(L3_table(l4), l3_start_idx, l3_end_idx, 3);<br>
> <br>
> for (uint64_t l3 = l3_start; l3 < l3_end; l3 += (1ULL << 30)) {<br>
> uint64_t l2_start = max(l3, start & 0xffffffe00000);<br>
> - uint64_t l2_end = min(l3 + (1ULL << 30),<br>
> + uint64_t l2_end = min(l3 + (1ULL << 30) - 1,<br>
> ((start + size - 1) | 0x0000001fffff) & 0xffffffffffff);<br>
> uint64_t l2_start_idx = L2_index(l2_start);<br>
> - uint64_t l2_end_idx = L2_index(l2_end) >= l2_start_idx ? L2_index(l2_end) : 0x1ff;<br>
> + uint64_t l2_end_idx = L2_index(l2_end);<br>
> <br>
> populate_ppgtt_table(L2_table(l3), l2_start_idx, l2_end_idx, 2);<br>
> <br>
> for (uint64_t l2 = l2_start; l2 < l2_end; l2 += (1ULL << 21)) {<br>
> uint64_t l1_start = max(l2, start & 0xfffffffff000);<br>
> - uint64_t l1_end = min(l2 + (1ULL << 21),<br>
> + uint64_t l1_end = min(l2 + (1ULL << 21) - 1,<br>
> ((start + size - 1) | 0x000000000fff) & 0xffffffffffff);<br>
> uint64_t l1_start_idx = L1_index(l1_start);<br>
> - uint64_t l1_end_idx = L1_index(l1_end) >= l1_start_idx ? L1_index(l1_end) : 0x1ff;<br>
> + uint64_t l1_end_idx = L1_index(l1_end);<br>
> <br>
> populate_ppgtt_table(L1_table(l2), l1_start_idx, l1_end_idx, 1);<br>
> }<br>
<br>
<br>
</blockquote></div></div>