linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Bingbu Cao <bingbu.cao@linux.intel.com>
To: "Kasireddy, Vivek" <vivek.kasireddy@intel.com>,
	Huan Yang <link@vivo.com>, Hillf Danton <hdanton@sina.com>,
	Christoph Hellwig <hch@lst.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	"opensource.kernel@vivo.com" <opensource.kernel@vivo.com>,
	"urezki@gmail.com" <urezki@gmail.com>
Subject: Re: [PATCH] mm/vmalloc: fix mischeck pfn valid in vmap_pfns
Date: Tue, 25 Mar 2025 14:46:00 +0800	[thread overview]
Message-ID: <df945f45-c9a4-8332-17e9-1187caedfea1@linux.intel.com> (raw)
In-Reply-To: <IA0PR11MB71851C5EF8BC5BADFD5A5D79F8A72@IA0PR11MB7185.namprd11.prod.outlook.com>

Vivek,

On 3/25/25 2:32 PM, Kasireddy, Vivek wrote:
> Hi Huan,
> 
>> Subject: Re: [PATCH] mm/vmalloc: fix mischeck pfn valid in vmap_pfns
>>
>> HI Hillf,
>>
>> Thanks fo your suggestion.
>>
>> 在 2025/3/19 19:26, Hillf Danton 写道:
>>> On Wed, 19 Mar 2025 09:08:51 +0100 Christoph Hellwig wrote:
>>>> On Wed, Mar 19, 2025 at 01:03:55PM +0800, Hillf Danton wrote:
>>>>> A quick fix is to add a vmap_pfn variant to walk around the pfn
>>>>> check in question, like the following diff (just for idea show).
>>>> No.
>>>>
>>> Patient to see your fix, given no low hanging peach left for Mr Folio
>>> in case of HVO, (feel free to ignore, who is likely about 2.6-mile
>>> less tough than you could be).
>>
>> I now believe there are two way to resolve the HVO folio can't vmap in
>> udmabuf.
>>
>> 1. simple copy vmap_pfn code, don't bother common vmap_pfn, use by itself
>> and remove pfn_valid check.
>>
>> 2. implement folio array based vmap(vmap_folios), which can given a range of
>> each folio(offset, nr_pages), so can suit HVO folio's vmap.
>>
>> 1 is simple and can fast fix this issue, but may not too good. I need discuss with
>> bot Christoph and udmabuf's maintainer.
>>
>> 2 is hard, but may worth to research, which I also will try to do. :)
> Another option is to just limit udmabuf's vmap() to only shmem folios but I guess
> it may not work as expected if THP is also enabled. 
> Bingbu, what exactly is your use-case? Could you please describe the scenario that
> requires you to use udmabuf's vmap()?

I guess my case is a very simple one.

Userspace create the udmabuf and mmap:

dmabuf_fd = ioctl(udma_fd, UDMABUF_CREATE, &create);
userptr = mmap(NULL, len, PROT_READ | PROT_WRITE,
	  MAP_SHARED, dmafd, 0);

And driver side call dma_buf_vmap() on the dmabuf to get a virtual
address.

> 
> Thanks,
> Vivek
> 
>>
> 

-- 
Best regards,
Bingbu Cao


  reply	other threads:[~2025-03-25  6:50 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 [this message]
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

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=df945f45-c9a4-8332-17e9-1187caedfea1@linux.intel.com \
    --to=bingbu.cao@linux.intel.com \
    --cc=hch@lst.de \
    --cc=hdanton@sina.com \
    --cc=link@vivo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=opensource.kernel@vivo.com \
    --cc=urezki@gmail.com \
    --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