From: Huan Yang <link@vivo.com>
To: "Kasireddy, Vivek" <vivek.kasireddy@intel.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Sumit Semwal" <sumit.semwal@linaro.org>,
"Christian König" <christian.koenig@amd.com>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-media@vger.kernel.org" <linux-media@vger.kernel.org>,
"linaro-mm-sig@lists.linaro.org" <linaro-mm-sig@lists.linaro.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "opensource.kernel@vivo.com" <opensource.kernel@vivo.com>
Subject: Re: [PATCH v2 3/4] fix vmap_udmabuf error page set
Date: Mon, 12 Aug 2024 10:49:44 +0800 [thread overview]
Message-ID: <b0b7febf-5acd-433c-b479-9b175fc93a53@vivo.com> (raw)
In-Reply-To: <IA0PR11MB718536A806AE4C4A6CB470B8F8BB2@IA0PR11MB7185.namprd11.prod.outlook.com>
在 2024/8/10 10:39, Kasireddy, Vivek 写道:
> [Some people who received this message don't often get email from vivek.kasireddy@intel.com. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> 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@vivo.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.
Do you mean, we do not want to vmap hugetlb folios? So by check this is
reasonable.
BTW, I found that recently shmem has started to support mTHP. (Even if
need enable a switch)
If this, not only hugetlb contains large folio, so ignore offset may not
too good?(I am not entirely sure whether mTHP can be used with shmem for
memfd.)
Thanks.
>
> Thanks,
> Vivek
>
>> vaddr = vm_map_ram(pages, ubuf->pagecount, -1);
>> kvfree(pages);
>> --
>> 2.45.2
next prev parent reply other threads:[~2024-08-12 2:49 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-05 3:25 [PATCH v2 0/4] udmbuf bug fix and some improvements Huan Yang
2024-08-05 3:25 ` [PATCH v2 1/4] udmabuf: cancel mmap page fault, direct map it Huan Yang
2024-08-10 1:28 ` Kasireddy, Vivek
2024-08-12 2:49 ` Huan Yang
2024-08-22 8:11 ` Christian König
2024-08-05 3:25 ` [PATCH v2 2/4] udmabuf: change folios array from kmalloc to kvmalloc Huan Yang
2024-08-10 1:29 ` Kasireddy, Vivek
2024-08-12 2:49 ` Huan Yang
2024-08-05 3:25 ` [PATCH v2 3/4] fix vmap_udmabuf error page set Huan Yang
2024-08-10 2:39 ` Kasireddy, Vivek
2024-08-12 2:49 ` Huan Yang [this message]
2024-08-05 3:25 ` [PATCH v2 4/4] udmabuf: remove folio unpin list Huan Yang
2024-08-10 2:52 ` Kasireddy, Vivek
2024-08-12 2:49 ` Huan Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b0b7febf-5acd-433c-b479-9b175fc93a53@vivo.com \
--to=link@vivo.com \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kraxel@redhat.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=opensource.kernel@vivo.com \
--cc=sumit.semwal@linaro.org \
--cc=vivek.kasireddy@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®