The vaild flag doesn't take effect in
this function.
That's irrelevant.
See what amdgpu_vm_update_ptes() does is to first determine the
fragment size:
amdgpu_vm_fragment(params, frag_start,
end, flags, &frag, &frag_end);
Then we walk down the tree:
amdgpu_vm_pt_start(adev,
params->vm, start, &cursor);
while (cursor.pfn < end) {
And make sure that the page tables covering the address range
are actually allocated:
r =
amdgpu_vm_alloc_pts(params->adev, params->vm,
&cursor);
Then we update the tables with the flags and addresses and free
up subsequent tables in the case of huge pages or freed up
areas:
/* Free all
child entries */
while (cursor.pfn < frag_start) {
amdgpu_vm_free_pts(adev,
params->vm, &cursor);
amdgpu_vm_pt_next(adev,
&cursor);
}
This is the maximum you can free, cause all other page tables
are not completely covered by the range and so potentially still
in use.
And I have the strong suspicion that this is what your patch is
actually doing wrong. In other words you are also freeing page
tables which are only partially covered by the range and so
potentially still in use.
Since we don't have any tracking how many entries in a page
table are currently valid and how many are invalid we actually
can't implement what you are trying to do here. So the patch is
definitely somehow broken.
Regards,
Christian.
Am 30.10.19 um 17:55 schrieb Huang, JinHuiEric:
The vaild flag doesn't take effect in this function.
amdgpu_vm_alloc_pts() is always executed that only depended on
"cursor.pfn < end". The valid flag has only been checked on
here for asic below GMC v9:
if (adev->asic_type < CHIP_VEGA10 &&
(flags & AMDGPU_PTE_VALID))...
Regards,
Eric
On 2019-10-30 12:30 p.m., Koenig,
Christian wrote:
That's not correct. The valid flag is used
for this.
Well I actually don't see a change to what
update_ptes is doing and have the strong suspicion that
the patch is simply broken.
You either free page tables which are
potentially still in use or update_pte doesn't free page
tables when the valid but is not set.
Regards,
Christian.