From: Mel Gorman <mgorman@techsingularity.net>
To: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: Dave Hansen <dave.hansen@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Tianyu Lan <Tianyu.Lan@microsoft.com>,
"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org, vbabka@suse.cz,
akpm@linux-foundation.org, willy@infradead.org
Subject: Re: Is _PAGE_PROTNONE set only for user mappings?
Date: Mon, 16 May 2022 14:03:20 +0100 [thread overview]
Message-ID: <20220516130319.GM3441@techsingularity.net> (raw)
In-Reply-To: <Yn3tssUR8w8mC1DJ@hyeyoo>
On Fri, May 13, 2022 at 02:33:38PM +0900, Hyeonggon Yoo wrote:
> On Thu, May 12, 2022 at 11:37:48AM +0100, Mel Gorman wrote:
> > On Wed, May 11, 2022 at 02:20:45PM +0900, Hyeonggon Yoo wrote:
> > > > pgprot_t vm_get_page_prot(unsigned long vm_flags)
> > > > {
> > > > pgprot_t ret = __pgprot(pgprot_val(protection_map[vm_flags &
> > > > (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]) |
> > > > pgprot_val(arch_vm_get_page_prot(vm_flags)));
> > > >
> > > > return arch_filter_pgprot(ret);
> > > > }
> > > > EXPORT_SYMBOL(vm_get_page_prot);
> > >
> > > I guess it's only set for processes' VMA if no caller is abusing
> > > vm_get_page_prot() for kernel mappings.
> > >
> > > But yeah, just quick guessing does not make us convinced.
> > > Let's Cc people working on mm.
> > >
> > > If kernel never uses _PAGE_PROTNONE for kernel mappings, it's just okay
> > > not to clear _PAGE_GLOBAL at first in __change_page_attr() if it's not user address,
> > > because no user will confuse _PAGE_GLOBAL as _PAGE_PROTNONE if it's kernel
> > > address. right?
> > >
> >
> > I'm not aware of a case where _PAGE_BIT_PROTNONE is used for a kernel
> > address expecting PROT_NONE semantics instead of the global bit. NUMA
> > Balancing is not going to accidentally treat a kernel address as if it's
> > a NUMA hinting fault. By the time a fault is determining if a PTE access
> > is a numa hinting fault or accesssing a PROT_NONE region, it has been
> > established that it is a userspace address backed by a valid VMA.
> >
>
> Thanks Mel, and IIUC nor does do_kern_addr_fault() in arch/x86/mm/fault.c
> expect _PAGE_PROTNONE instead of _PAGE_GLOBAL. I want to make it clear
> in the code that _PAGE_PROTNONE is only used for user mappings.
>
> How does below look?
>
I've no strong objections. I worry that this somehow could be used to
set PAGE_USER on a kernel mapping page and maybe a comment would be more
appropriate. However, I'm failing to imagine how NUMA balancing could be
fooled into doing that.
--
Mel Gorman
SUSE Labs
next prev parent reply other threads:[~2022-05-16 13:03 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-06 5:19 [PATCH] x86/mm/cpa: set PAGE_KERNEL in __set_pages_p() Hyeonggon Yoo
2022-05-09 16:06 ` Tom Lendacky
2022-05-10 11:57 ` Hyeonggon Yoo
2022-05-10 13:35 ` Tom Lendacky
2022-05-10 14:39 ` Dave Hansen
2022-05-11 5:20 ` Is _PAGE_PROTNONE set only for user mappings? Hyeonggon Yoo
2022-05-12 10:37 ` Mel Gorman
2022-05-13 5:33 ` Hyeonggon Yoo
2022-05-16 13:03 ` Mel Gorman [this message]
2022-05-16 14:04 ` Dave Hansen
2022-05-22 3:56 ` Hyeonggon Yoo
2022-05-24 20:22 ` Sean Christopherson
2022-05-26 10:33 ` Hyeonggon Yoo
2022-05-29 10:32 ` Hyeonggon Yoo
2022-06-02 16:47 ` Dave Hansen
2022-05-10 0:47 ` [PATCH] x86/mm/cpa: set PAGE_KERNEL in __set_pages_p() Edgecombe, Rick P
2022-05-10 11:50 ` Hyeonggon Yoo
2022-05-10 15:38 ` Edgecombe, Rick P
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=20220516130319.GM3441@techsingularity.net \
--to=mgorman@techsingularity.net \
--cc=42.hyeyoo@gmail.com \
--cc=Tianyu.Lan@microsoft.com \
--cc=akpm@linux-foundation.org \
--cc=aneesh.kumar@linux.ibm.com \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rick.p.edgecombe@intel.com \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=vbabka@suse.cz \
--cc=willy@infradead.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.