[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <IA0PR11MB718536A806AE4C4A6CB470B8F8BB2@IA0PR11MB7185.namprd11.prod.outlook.com>
Date: Sat, 10 Aug 2024 02:39:24 +0000
From: "Kasireddy, Vivek" <vivek.kasireddy@...el.com>
To: Huan Yang <link@...o.com>, Gerd Hoffmann <kraxel@...hat.com>, Sumit Semwal
<sumit.semwal@...aro.org>, Christian König
<christian.koenig@....com>, "dri-devel@...ts.freedesktop.org"
<dri-devel@...ts.freedesktop.org>, "linux-media@...r.kernel.org"
<linux-media@...r.kernel.org>, "linaro-mm-sig@...ts.linaro.org"
<linaro-mm-sig@...ts.linaro.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
CC: "opensource.kernel@...o.com" <opensource.kernel@...o.com>
Subject: RE: [PATCH v2 3/4] fix vmap_udmabuf error page set
Hi Huan,
>
> Currently vmap_udmabuf set page's array by each folio.
> But, ubuf->folios is only contain's the folio's head page.
>
> That mean we repeatedly mapped the folio head page to the vmalloc area.
>
> This patch fix it, set each folio's page correct, so that pages array
> contains right page, and then map into vmalloc area
>
> Signed-off-by: Huan Yang <link@...o.com>
> ---
> drivers/dma-buf/udmabuf.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c
> index af2391cea0bf..9737f063b6b3 100644
> --- a/drivers/dma-buf/udmabuf.c
> +++ b/drivers/dma-buf/udmabuf.c
> @@ -78,7 +78,8 @@ static int vmap_udmabuf(struct dma_buf *buf, struct
> iosys_map *map)
> return -ENOMEM;
>
> for (pg = 0; pg < ubuf->pagecount; pg++)
> - pages[pg] = &ubuf->folios[pg]->page;
> + pages[pg] = folio_page(ubuf->folios[pg],
> + ubuf->offsets[pg] >> PAGE_SHIFT);
I believe the correct way to address this issue is to introduce a folio variant
of vm_map_ram() and use that instead, along with the offsets info.
However, for the time being, I think we can reject vmap of hugetlb folios
by checking for non-zero offset values.
Thanks,
Vivek
>
> vaddr = vm_map_ram(pages, ubuf->pagecount, -1);
> kvfree(pages);
> --
> 2.45.2
Powered by blists - more mailing lists