From: Chuck Zmudzinski <brchuckz@netscape.net>
To: Juergen Gross <jgross@suse.com>, Jan Beulich <jbeulich@suse.com>
Cc: 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>,
Dan Williams <dan.j.williams@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Jane Chu <jane.chu@oracle.com>,
Tianyu Lan <Tianyu.Lan@microsoft.com>,
Randy Dunlap <rdunlap@infradead.org>,
Sean Christopherson <seanjc@google.com>,
xen-devel@lists.xenproject.org, stable@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Subject: Re: [PATCH v2] Subject: x86/PAT: Report PAT on CPUs that support PAT without MTRR
Date: Wed, 13 Jul 2022 15:38:16 -0400 [thread overview]
Message-ID: <9c97d8b4-ae1d-efd0-8414-91a50d22cf12@netscape.net> (raw)
In-Reply-To: <4e74aae6-7d8c-15ed-c571-b797239374cb@netscape.net>
On 7/13/2022 3:22 PM, Chuck Zmudzinski wrote:
> On 7/13/2022 3:07 PM, Chuck Zmudzinski wrote:
> > On 7/13/2022 9:45 AM, Juergen Gross wrote:
> > > >> On 7/13/2022 6:36 AM, Chuck Zmudzinski wrote:
> > > >> And in addition, if we are going to backport this patch to
> > > >> all current stable branches, we better have a really, really,
> > > >> good reason for changing the behavior of "nopat" on Xen.
> > > >>
> > > >> Does such a reason exist?
> > > >
> > > > Well, the simple reason is: It doesn't work the same way under Xen
> > > > and non-Xen (in turn because, before my patch or whatever equivalent
> > > > work, things don't work properly anyway, PAT-wise). Yet it definitely
> > > > ought to behave the same everywhere, imo.
> > >
> > > There is Documentation/x86/pat.rst which rather clearly states, how
> > > "nopat" is meant to work. It should not change the contents of the
> > > PAT MSR and keep it just as it was set at boot time (the doc talks
> > > about the "BIOS" setting of the MSR, and I guess in the Xen case
> > > the hypervisor is kind of acting as the BIOS).
> > >
> > > The question is, whether "nopat" needs to be translated to
> > > pat_enabled() returning "false".
> >
> > When I started working on a re-factoring effort of the logic
> > surrounding pat_enabled(), I noticed there are five different
> > reasons in the current code for setting pat_disabled to true,
> > which IMO is what should be a redundant variable that should
> > always be equal !pat_enabled() and !pat_bp_enabled, but that
> > unfortunately is not the case. The five reasons for setting
> > pat_disabled to true are given as message strings:
> >
> > 1. "MTRRs disabled, skipping PAT initialization too."
> > 2. "PAT support disabled because CONFIG_MTRR is disabled in the kernel."
> > 3. "PAT support disabled via boot option."
> > 4. "PAT not supported by the CPU."
> > 5. "PAT support disabled by the firmware."
> >
> > The only effect of setting pat_disabled to true is to inhibit
> > the execution of pat_init(), but it does not inhibit the execution
> > of init_cache_modes(), which is for handling all these cases
> > when pat_init() was skipped. The Xen case is one of those
> > cases, so in the Xen case, pat_disabled will be true yet the
> > only way to fix the current regression and the five-year-old
> > commit is by setting pat_bp_enabled to true so pat_enabled()
> > will return true. So to fix the five-year-old commit, we must have
> >
> > pat_enabled() != pat_disabled
> >
> > Something is wrong with this logic, that is why I wanted to precede
> > my fix with some re-factoring that will change some variable
> > and function names and modify some comments before trying
> > to fix the five-year-old commit, so that we will never have a situation
> > when pat_enabled() != pat_disabled.
> >
> > Chuck
> Sorry, I meant to say,
>
> To fix the five-year-old commit, we must have
>
> pat_enabled() != !pat_disabled or pat_enabled() == pat_disabled,
>
> and there is something wrong with that logic.
>
> Chuck
So to summarize, I think this means that to be comfortable
fixing the five-year-old commit and the current regression
by artificially setting pat_bp_enabled and pat_enabled() to
true, something which both my patch and Jan's patch does,
we need to come to a new understanding of what the
static boolean variable pat_disabled in
arch/x86/mm/pat/memtype.c in the code really means.
The fact is, we have a regression and the only fix we
can find is to try to make pat_enabled() == pat_disabled
I need to stop thinking about this for a while. It is time
for those who have authority to fix this regression to
make some comments about how they think this should
be fixed.
Chuck
next prev parent reply other threads:[~2022-07-13 19:38 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <9d5070ae4f3e956a95d3f50e24f1a93488b9ff52.1657671676.git.brchuckz.ref@aol.com>
2022-07-13 1:36 ` Chuck Zmudzinski
2022-07-13 4:12 ` Juergen Gross
2022-07-13 6:18 ` Jan Beulich
2022-07-13 8:51 ` Chuck Zmudzinski
2022-07-13 9:09 ` Jan Beulich
2022-07-13 10:36 ` Chuck Zmudzinski
2022-07-13 11:10 ` Chuck Zmudzinski
2022-07-13 13:34 ` Jan Beulich
2022-07-13 13:45 ` Juergen Gross
2022-07-13 17:01 ` Chuck Zmudzinski
2022-07-13 19:07 ` Chuck Zmudzinski
2022-07-13 19:22 ` Chuck Zmudzinski
2022-07-13 19:38 ` Chuck Zmudzinski [this message]
2022-07-13 22:12 ` Chuck Zmudzinski
2022-07-13 13:49 ` Chuck Zmudzinski
2022-07-13 13:52 ` Jan Beulich
2022-07-13 15:02 ` Chuck Zmudzinski
2022-07-13 15:05 ` Jan Beulich
2022-07-14 5:30 ` Thorsten Leemhuis
2022-07-15 2:07 ` Chuck Zmudzinski
2022-07-15 5:00 ` Thorsten Leemhuis
2022-07-15 10:05 ` Jan Beulich
2022-07-15 19:53 ` Chuck Zmudzinski
2022-07-16 11:02 ` Chuck Zmudzinski
2022-07-18 6:07 ` Jan Beulich
2022-07-18 11:31 ` Chuck Zmudzinski
2022-07-18 11:39 ` Jan Beulich
2022-07-18 11:45 ` Chuck Zmudzinski
2022-07-18 12:12 ` Chuck Zmudzinski
2022-08-17 16:39 ` Chuck Zmudzinski
2022-07-14 5:40 ` Juergen Gross
2022-07-14 6:28 ` Jan Beulich
2022-07-15 2:19 ` Chuck Zmudzinski
2022-07-15 2:53 ` Chuck Zmudzinski
2022-07-15 2:58 ` Chuck Zmudzinski
2022-07-15 4:22 ` Juergen Gross
2022-07-15 4:42 ` Chuck Zmudzinski
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=9c97d8b4-ae1d-efd0-8414-91a50d22cf12@netscape.net \
--to=brchuckz@netscape.net \
--cc=Tianyu.Lan@microsoft.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=jane.chu@oracle.com \
--cc=jbeulich@suse.com \
--cc=jgross@suse.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=rdunlap@infradead.org \
--cc=seanjc@google.com \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=thomas.lendacky@amd.com \
--cc=x86@kernel.org \
--cc=xen-devel@lists.xenproject.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
all inboxes | Powered by JetHome®