Re: [PATCH 03/13] misc/habana: Stop using frame_vector helpers

From: John Hubbard
Date: Wed Oct 07 2020 - 16:38:21 EST


On 10/7/20 9:44 AM, Daniel Vetter wrote:
...
@@ -1414,15 +1410,10 @@ void hl_unpin_host_memory(struct hl_device *hdev, struct hl_userptr *userptr)
userptr->sgt->nents,
userptr->dir);
- pages = frame_vector_pages(userptr->vec);
- if (!IS_ERR(pages)) {
- int i;
-
- for (i = 0; i < frame_vector_count(userptr->vec); i++)
- set_page_dirty_lock(pages[i]);
- }
- put_vaddr_frames(userptr->vec);
- frame_vector_destroy(userptr->vec);
+ for (i = 0; i < userptr->npages; i++)
+ set_page_dirty_lock(userptr->pages[i]);
+ unpin_user_pages(userptr->pages, userptr->npages);
+ kvfree(userptr->pages);

Same thing here as in patch 1: you can further simplify by using
unpin_user_pages_dirty_lock().

list_del(&userptr->job_node);


thanks,
--
John Hubbard
NVIDIA