From: Dave Hansen <dave.hansen@intel.com>
To: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Cc: Mel Gorman <mgorman@techsingularity.net>,
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: Thu, 2 Jun 2022 09:47:33 -0700 [thread overview]
Message-ID: <1f0fd9f4-295f-6b44-47ff-b6b56892e680@intel.com> (raw)
In-Reply-To: <YpNLxXvGFQpyPjRa@n2.us-central1-a.c.spheric-algebra-350919.internal>
On 5/29/22 03:32, Hyeonggon Yoo wrote:
> On Mon, May 16, 2022 at 07:04:32AM -0700, Dave Hansen wrote:
> Writing code I'm a bit confused:
> commit d1440b23c922d8 ("x86/mm: Factor out pageattr
> _PAGE_GLOBAL setting") says:
>
> "This unconditional setting of _PAGE_GLOBAL is a problem when we have
> PTI and non-PTI and we want some areas to have _PAGE_GLOBAL and some
> not."
>
> Is this this sentence not valid anymore in PTI,
> and just unconditionally setting _PAGE_GLOBAL would be okay in kernel
> side regardless of PTI?
I believe it's still valid.
IIRC, there are three cases:
1. No KPTI. All kernel mappings are _PAGE_GLOBAL. Basically, for
present mappings, if _PAGE_USER is clear, _PAGE_GLOBAL is set.
2. KPTI with PCID hardware support (or in a few other cases): The kernel
image is mostly non-global. Anything mapped into userspace *is*
marked global, like entry text.
3. KPTI without PCIDs: Basically case #2, but with more of the kernel
image left global.
So, not only are there different KPTI modes, there a different pars of
the kernel that require different _PAGE_GLOBAL behavior.
pti_kernel_image_global_ok() in arch/x86/mm/pti.c explains it pretty well.
next prev parent reply other threads:[~2022-06-02 16:47 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
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 [this message]
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=1f0fd9f4-295f-6b44-47ff-b6b56892e680@intel.com \
--to=dave.hansen@intel.com \
--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@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=mgorman@techsingularity.net \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).