|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH 1/2] xen/privcmd: Corrected error handling path and mark pages dirty
On 25.06.20 05:02, Souptick Joarder wrote: Previously, if lock_pages() end up partially mapping pages, it used to return -ERRNO due to which unlock_pages() have to go through each pages[i] till *nr_pages* to validate them. This can be avoided by passing correct number of partially mapped pages & -ERRNO separately, while returning from lock_pages() due to error. With this fix unlock_pages() doesn't need to validate pages[i] till *nr_pages* for error scenario and few condition checks can be ignored. As discussed, pages need to be marked as dirty before unpinned it in unlock_pages() which was oversight. Signed-off-by: Souptick Joarder <jrdr.linux@xxxxxxxxx> Cc: John Hubbard <jhubbard@xxxxxxxxxx> Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx> Cc: Paul Durrant <xadimgnik@xxxxxxxxx> --- Hi, I'm compile tested this, but unable to run-time test, so any testing help is much appriciated. drivers/xen/privcmd.c | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/drivers/xen/privcmd.c b/drivers/xen/privcmd.c index a250d11..0da417c 100644 --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -580,43 +580,44 @@ static long privcmd_ioctl_mmap_batch(static int lock_pages( unsigned int *pinned, please. Please drop the errno variable. It is misnamed (you never assign an errno value to it) and not needed, as you can ... for (i = 0; i < num; i++) { ... just return page_count her, and ... + }- nr_pages -= pinned; ... leave this as it was. }static void unlock_pages(struct page *pages[], unsigned int nr_pages) page? Not pages[i]?
Juergen
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |