From: Peter Xu <peterx@redhat.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Thomas Gleixner <tglx@linutronix.de>,
Jason Gunthorpe <jgg@nvidia.com>,
Andrew Morton <akpm@linux-foundation.org>,
Al Viro <viro@zeniv.linux.org.uk>,
Dave Hansen <dave.hansen@linux.intel.com>,
Andy Lutomirski <luto@kernel.org>,
Matthew Wilcox <willy@infradead.org>,
Dan Williams <dan.j.williams@intel.com>,
"Kirill A . Shutemov" <kirill@shutemov.name>,
Mike Rapoport <rppt@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Michal Hocko <mhocko@suse.com>,
Alex Williamson <alex.williamson@redhat.com>,
Peter Zijlstra <peterz@infradead.org>,
Suren Baghdasaryan <surenb@google.com>,
Borislav Petkov <bp@alien8.de>,
x86@kernel.org
Subject: Re: [PATCH RFC 2/2] mm/x86/pat: Do proper PAT bit shift for large mappings
Date: Fri, 24 May 2024 19:55:46 -0400 [thread overview]
Message-ID: <ZlEpAoNRIc1sh-xE@x1n> (raw)
In-Reply-To: <7b6b6430-0237-4512-b99b-9eb815b3dc68@intel.com>
On Thu, May 23, 2024 at 08:30:19PM -0700, Dave Hansen wrote:
> On 5/23/24 16:07, Peter Xu wrote:
> > Probably not.. I think I can define a pgprot_to_large() globally, pointing
> > that to pgprot_4k_2_large() on x86 and make the fallback to be noop. And
> > if there's a new version I'll guarantee to run over my cross compilers.
>
> I guess that would be functional, but it would be a bit mean to
> everybody else.
>
> > Any comments on the idea itself? Do we have a problem, or maybe I
> > overlooked something?
>
> I think it's probably unnecessary to inflict this particular x86-ism on
> generic code. The arch-generic 'prot' should have PAT at its 4k
> (_PAGE_BIT_PAT) position and then p*d_mkhuge() can shift it into the
> _PAGE_BIT_PAT_LARGE spot.
Right that's another option indeed.
It's just that I found it might in many cases be better when we have the
API separately properly and making the pairs matching each other.
For example, it could be clearer if pxx_mkhuge() does exactly what
pxx_leaf() would check against.
PS: I hoped it's called pxx_huge() already to make the name paired with
each other; afaict we called it pxx_leaf() only because pxx_huge() used to
be "abused" by hugetlbfs before.. now it's gone.
The other thing is we mostly only need these knobs for special maps like
pfnmaps, am I right? OTOH we use WB for RAMs, and maybe we don't want to
bother any PAT stuff when the kernel is installing a THP anonymous?
IMHO having pgprot_to_large() is fine even if only x86 has it; it's really
like pfn tracking itself which is noop for !x86. but I'll follow your
advise if you still insist; I don't really have a strong opinion.
But if so I'd also like to mention a 3rd option, which is to have
pxx_mkhuge_prot(), fallback to pxx_mkhuge() for !x86. That'll make
pxx_huge() untainted for x86. I'm not sure whether that would ease the
same concern, though.
In all cases, thanks for confirming this issue, I appreciate that. Let me
know if you have any comment on patch 1 too; that one isn't a problem so
far iiuc, but it can be soon.
Thanks,
--
Peter Xu
prev parent reply other threads:[~2024-05-24 23:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-23 22:37 [PATCH RFC 0/2] mm/x86/pat: Fix two possible issues Peter Xu
2024-05-23 22:37 ` [PATCH RFC 1/2] mm/x86/pat: Only untrack the pfn range if unmap region Peter Xu
2024-05-23 22:37 ` [PATCH RFC 2/2] mm/x86/pat: Do proper PAT bit shift for large mappings Peter Xu
2024-05-23 22:48 ` Dave Hansen
2024-05-23 23:07 ` Peter Xu
2024-05-24 0:53 ` Peter Xu
2024-05-24 3:30 ` Dave Hansen
2024-05-24 23:55 ` Peter Xu [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=ZlEpAoNRIc1sh-xE@x1n \
--to=peterx@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=alex.williamson@redhat.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=jgg@nvidia.com \
--cc=kirill@shutemov.name \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=mhocko@suse.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rppt@kernel.org \
--cc=surenb@google.com \
--cc=tglx@linutronix.de \
--cc=viro@zeniv.linux.org.uk \
--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