From: mawupeng <mawupeng1@huawei.com>
To: <david@redhat.com>, <akpm@linux-foundation.org>,
<khlebnikov@openvz.org>, <jaredeh@gmail.com>,
<linmiaohe@huawei.com>, <hpa@zytor.com>, <tglx@linutronix.de>,
<mingo@redhat.com>, <dave.hansen@linux.intel.com>,
<cotte@de.ibm.com>, <npiggin@suse.de>
Cc: <mawupeng1@huawei.com>, <luto@kernel.org>, <peterz@infradead.org>,
<linux-kernel@vger.kernel.org>, <x86@kernel.org>,
<rdunlap@infradead.org>, <bhelgaas@google.com>,
<linux-mm@kvack.org>
Subject: Re: [Question] CoW on VM_PFNMAP vma during write fault
Date: Mon, 4 Mar 2024 17:04:25 +0800 [thread overview]
Message-ID: <fefd4a04-0af3-4135-9e98-c983ee321e52@huawei.com> (raw)
In-Reply-To: <6e948123-df3a-4450-8fd3-76b9131a35a0@redhat.com>
On 2024/3/4 16:57, David Hildenbrand wrote:
> On 04.03.24 09:47, mawupeng wrote:
>> Hi Maintainers, kindly ping...
>>
>> On 2024/2/28 9:55, mawupeng wrote:
>>>
>>>
>>> On 2024/2/27 21:15, David Hildenbrand wrote:
>>>> On 27.02.24 14:00, David Hildenbrand wrote:
>>>>> On 27.02.24 13:28, Wupeng Ma wrote:
>>>>>> We find that a warn will be produced during our test, the detail log is
>>>>>> shown in the end.
>>>>>>
>>>>>> The core problem of this warn is that the first pfn of this pfnmap vma is
>>>>>> cleared during memory-failure. Digging into the source we find that this
>>>>>> problem can be triggered as following:
>>>>>>
>>>>>> // mmap with MAP_PRIVATE and specific fd which hook mmap
>>>>>> mmap(MAP_PRIVATE, fd)
>>>>>> __mmap_region
>>>>>> remap_pfn_range
>>>>>> // set vma with pfnmap and the prot of pte is read only
>>>>>>
>>>>>
>>>>> Okay, so we get a MAP_PRIVATE VM_PFNMAP I assume.
>>>>>
>>>>> What fd is that exactly? Often, we disallow private mappings in the
>>>>> mmap() callback (for a good reason).
>>
>> We found this problem in 5.10, Commit 9f78bf330a66 ("xsk: support use vaddr as ring") Fix this
>> problem during supporting vaddr by remap VM_PFNMAP by VM_MIXEDMAP. But other modules which
>> use remap_pfn_range may still have this problem.
>
> I wrote a simple reproducer using MAP_PRIVATE of iouring queues on Friday.
>
>>
>> It do seems wired for private mappings, What is the good reason?
>
> I'm sure there are some use cases that require MAP_PRIVATE of such areas, and usually there is nothing wrong with that.
So MAP_PRIVATE for VM_PFNMAP area with write access is ok? What is the user case for this situation?
>
> It's just that the PAT implementation incompatible.
PAT do have its problem.
>
> I can submit a cleaned-up version of my patches.
Thanks
>
next prev parent reply other threads:[~2024-03-04 9:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-27 12:28 Wupeng Ma
2024-02-27 13:00 ` David Hildenbrand
2024-02-27 13:15 ` David Hildenbrand
2024-02-28 1:55 ` mawupeng
2024-02-28 2:10 ` Matthew Wilcox
2024-02-28 2:18 ` mawupeng
2024-03-04 8:47 ` mawupeng
2024-03-04 8:57 ` David Hildenbrand
2024-03-04 9:04 ` mawupeng [this message]
2024-03-04 9:17 ` David Hildenbrand
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=fefd4a04-0af3-4135-9e98-c983ee321e52@huawei.com \
--to=mawupeng1@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=bhelgaas@google.com \
--cc=cotte@de.ibm.com \
--cc=dave.hansen@linux.intel.com \
--cc=david@redhat.com \
--cc=hpa@zytor.com \
--cc=jaredeh@gmail.com \
--cc=khlebnikov@openvz.org \
--cc=linmiaohe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=npiggin@suse.de \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/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