From: Huan Yang <link@vivo.com>
To: Bingbu Cao <bingbu.cao@linux.intel.com>, hch@lst.de
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
linux-mm@kvack.org, lorenzo.stoakes@oracle.com,
opensource.kernel@vivo.com, rppt@kernel.org,
ryan.roberts@arm.com, urezki@gmail.com, ziy@nvidia.com
Subject: Re: [PATCH] mm/vmalloc: fix mischeck pfn valid in vmap_pfns
Date: Mon, 17 Mar 2025 14:26:31 +0800 [thread overview]
Message-ID: <fb36378e-a3ab-4ac4-a71f-ccc95f96361e@vivo.com> (raw)
In-Reply-To: <79247edd-761c-82e3-b8d2-acdbe31c8205@linux.intel.com>
Hi Bingbu
在 2025/3/17 13:29, Bingbu Cao 写道:
> On 3/17/25 10:12 AM, Huan Yang wrote:
>> HI Christoph,
>>
>> Thanks for your reply, and I'm sorry for my late reply. Your response
>> didn't appear in my email client; I only saw it on the website.:(
>>
>>>> On Wed, Mar 12, 2025 at 02:15:12PM +0800, Huan Yang wrote:
>>>> When invoke vmap_pfns, it call vmap_pfn_apply to set pfn into pte. >> It check pfn is valid, if true then warn and return. >> >> This is
>> a mischeck, actually we need set a valid pfn into pte, not an >> invalid pfn. >
>>> As just discussed this is wrong. vmap_pfn is for mapping non-page
>> Thank you for your explanation. I now understand that the design of vmap_pfn
>> is indeed intentional. It's design to do this.
>>> PFNs and the check is what enforces that. What is the point of having
>>> that detailed discussion if you just send the broken patch anyway with
>>> a commit log not even acknowledging the facts?
>> Sorry for that.
>>
>> We now have a new use case where, in udmabuf, memory is passed via memfd and can
>> be either shmem or hugetlb.
>> When the memory is hugetlb and HVO is enabled, the tail page's struct is no longer
>> reliable because it has been freed. Can't use vmap.
>> Therefore, when making modifications, I recorded the pfn of the folio base pfn + offset and called vmap_pfns.
>> And, these pfns are valid. So rejected by vmap_pfns.
>>
>> Can we just remove pfn_valid check in vmap_pfns, so make it suit for both of they?
>> If you agree, I wanna send a new patch.
> Huan,
>
> Why not update udmabuf to make it work with both vmap_pfns() and
> vmap()? As only the udmabuf knows it is actually working on?
You mean, If udmabuf invoke vmap if it's normal page-based folio range,
else invoke vmap_pfns
if it's in HVO based?
udmabuf can contained a rane in folio and offset, what if it contains
folio's head(with page struct) and
remain tail(without page struct, freed by HVO).
I think there are no suitable way to map it into vmalloc area.:)
Or else, just block hugetlb's folio mapped into vmalloc area? Which I
don't think it's a good way.
>
> I don't think it's a good idea to hack the common API, the WARN_ON()
You mean common, but I think vmalloc can provide a more common API that
not care if page it's
exist, if provide pfn, just map? :)
Or else, document it that vmap_pfn just do not welcome page based pfn
map?(Just IMO)
Thanks,
Huan Yang
> is really a mandatory check, and current case is a good example.
>
>> Thank you,
>> Huan Yang
>>
prev parent reply other threads:[~2025-03-17 6:26 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-12 6:15 Huan Yang
2025-03-12 6:18 ` Christoph Hellwig
2025-03-17 2:12 ` Huan Yang
2025-03-17 5:29 ` Bingbu Cao
2025-03-17 5:53 ` Christoph Hellwig
2025-03-17 7:42 ` Huan Yang
2025-03-18 6:48 ` Christoph Hellwig
2025-03-18 8:20 ` Huan Yang
2025-03-18 8:33 ` Christoph Hellwig
2025-03-18 8:39 ` Huan Yang
2025-03-18 8:44 ` Christoph Hellwig
2025-03-18 8:50 ` Huan Yang
[not found] ` <20250319050359.3484-1-hdanton@sina.com>
2025-03-19 8:08 ` Christoph Hellwig
[not found] ` <20250319112651.3502-1-hdanton@sina.com>
2025-03-24 2:13 ` Huan Yang
2025-03-25 6:32 ` Kasireddy, Vivek
2025-03-25 6:46 ` Bingbu Cao
2025-03-27 13:40 ` Matthew Wilcox
2025-03-28 6:13 ` Huan Yang
2025-03-19 9:09 ` Gao Xiang
2025-03-20 5:31 ` Christoph Hellwig
2025-03-24 2:22 ` Huan Yang
2025-03-24 2:57 ` Matthew Wilcox
2025-03-17 6:26 ` Huan Yang [this message]
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=fb36378e-a3ab-4ac4-a71f-ccc95f96361e@vivo.com \
--to=link@vivo.com \
--cc=akpm@linux-foundation.org \
--cc=bingbu.cao@linux.intel.com \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=opensource.kernel@vivo.com \
--cc=rppt@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=urezki@gmail.com \
--cc=ziy@nvidia.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