From: Juergen Gross <jgross@suse.com>
To: Chuck Zmudzinski <brchuckz@aol.com>, linux-kernel@vger.kernel.org
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>,
"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Brijesh Singh <brijesh.singh@amd.com>,
Jane Chu <jane.chu@oracle.com>,
Tianyu Lan <Tianyu.Lan@microsoft.com>,
Randy Dunlap <rdunlap@infradead.org>,
Sean Christopherson <seanjc@google.com>,
Jan Beulich <jbeulich@suse.com>,
xen-devel@lists.xenproject.org, stable@vger.kernel.org
Subject: Re: [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR
Date: Tue, 12 Jul 2022 20:27:33 +0200 [thread overview]
Message-ID: <388a3838-1681-dba4-dabd-a7f27817bf34@suse.com> (raw)
In-Reply-To: <2885cdcaccffd287ef69c7509056ddf183a38a0e.1657647656.git.brchuckz@aol.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 2566 bytes --]
On 12.07.22 20:20, Chuck Zmudzinski wrote:
> The commit 99c13b8c8896d7bcb92753bf
> ("x86/mm/pat: Don't report PAT on CPUs that don't support it")
> incorrectly failed to account for the case in init_cache_modes() when
> CPUs do support PAT and falsely reported PAT to be disabled when in
> fact PAT is enabled. In some environments, notably in Xen PV domains,
> MTRR is disabled but PAT is still enabled, and that is the case
> that the aforementioned commit failed to account for.
>
> As an unfortunate consequnce, the pat_enabled() function currently does
> not correctly report that PAT is enabled in such environments. The fix
> is implemented in init_cache_modes() by setting pat_bp_enabled to true
> in init_cache_modes() for the case that commit 99c13b8c8896d7bcb92753bf
> ("x86/mm/pat: Don't report PAT on CPUs that don't support it") failed
> to account for.
>
> This patch fixes a regression that some users are experiencing with
> Linux as a Xen Dom0 driving particular Intel graphics devices by
> correctly reporting to the Intel i915 driver that PAT is enabled where
> previously it was falsely reporting that PAT is disabled.
>
> Fixes: 99c13b8c8896d7bcb92753bf ("x86/mm/pat: Don't report PAT on CPUs that don't support it")
> Cc: stable@vger.kernel.org
> Signed-off-by: Chuck Zmudzinski <brchuckz@aol.com>
> ---
> Reminder: This patch is a regression fix that is needed on stable
> versions 5.17 and later.
>
> arch/x86/mm/pat/memtype.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
> index d5ef64ddd35e..0f2417bd1b40 100644
> --- a/arch/x86/mm/pat/memtype.c
> +++ b/arch/x86/mm/pat/memtype.c
> @@ -315,6 +315,18 @@ void init_cache_modes(void)
> PAT(4, WB) | PAT(5, WT) | PAT(6, UC_MINUS) | PAT(7, UC);
> }
>
> + else if (!pat_bp_enabled) {
Please put the "else if {" into the same line as the "}" above.
> + /*
> + * In some environments, specifically Xen PV, PAT
> + * initialization is skipped because MTRRs are disabled even
> + * though PAT is available. In such environments, set PAT to
> + * enabled to correctly indicate to callers of pat_enabled()
> + * that CPU support for PAT is available.
> + */
> + pat_bp_enabled = true;
> + pr_info("x86/PAT: PAT enabled by init_cache_modes\n");
Wrong indentation.
> + }
> +
> __init_cache_modes(pat);
> }
>
Any reason you didn't fix the "nopat" issue Jan mentioned?
I asked you twice to add this fix.
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
next prev parent reply other threads:[~2022-07-12 18:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <2885cdcaccffd287ef69c7509056ddf183a38a0e.1657647656.git.brchuckz.ref@aol.com>
2022-07-12 18:20 ` Chuck Zmudzinski
2022-07-12 18:27 ` Juergen Gross [this message]
2022-07-12 19:18 ` Chuck Zmudzinski
2022-07-12 19:48 ` Chuck Zmudzinski
2022-07-13 5:55 ` Jan Beulich
2022-07-12 18:36 ` Greg KH
2022-07-12 19:16 ` Chuck Zmudzinski
2022-07-12 19:26 ` Greg KH
2022-07-12 19:57 ` Chuck Zmudzinski
2022-07-13 5:35 ` Greg KH
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=388a3838-1681-dba4-dabd-a7f27817bf34@suse.com \
--to=jgross@suse.com \
--cc=Tianyu.Lan@microsoft.com \
--cc=bp@alien8.de \
--cc=brchuckz@aol.com \
--cc=brijesh.singh@amd.com \
--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=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®