All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR
       [not found] <2885cdcaccffd287ef69c7509056ddf183a38a0e.1657647656.git.brchuckz.ref@aol.com>
@ 2022-07-12 18:20 ` Chuck Zmudzinski
  2022-07-12 18:27   ` Juergen Gross
  2022-07-12 18:36   ` Greg KH
  0 siblings, 2 replies; 10+ messages in thread
From: Chuck Zmudzinski @ 2022-07-12 18:20 UTC (permalink / raw)
  To: linux-kernel
  Cc: Dave Hansen, Andy Lutomirski, Peter Zijlstra, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Dan Williams,
	Kirill A. Shutemov, Tom Lendacky, Brijesh Singh, Jane Chu,
	Tianyu Lan, Randy Dunlap, Sean Christopherson, Jan Beulich,
	Juergen Gross, xen-devel, stable

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) {
+	/*
+	 * 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");
+	}
+
 	__init_cache_modes(pat);
 }
 
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR
  2022-07-12 18:20 ` [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR Chuck Zmudzinski
@ 2022-07-12 18:27   ` Juergen Gross
  2022-07-12 19:18     ` Chuck Zmudzinski
  2022-07-12 18:36   ` Greg KH
  1 sibling, 1 reply; 10+ messages in thread
From: Juergen Gross @ 2022-07-12 18:27 UTC (permalink / raw)
  To: Chuck Zmudzinski, linux-kernel
  Cc: Dave Hansen, Andy Lutomirski, Peter Zijlstra, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Dan Williams,
	Kirill A. Shutemov, Tom Lendacky, Brijesh Singh, Jane Chu,
	Tianyu Lan, Randy Dunlap, Sean Christopherson, Jan Beulich,
	xen-devel, stable


[-- 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 --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR
  2022-07-12 18:20 ` [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR Chuck Zmudzinski
  2022-07-12 18:27   ` Juergen Gross
@ 2022-07-12 18:36   ` Greg KH
  2022-07-12 19:16     ` Chuck Zmudzinski
  1 sibling, 1 reply; 10+ messages in thread
From: Greg KH @ 2022-07-12 18:36 UTC (permalink / raw)
  To: Chuck Zmudzinski
  Cc: linux-kernel, Dave Hansen, Andy Lutomirski, Peter Zijlstra,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	H. Peter Anvin, Dan Williams, Kirill A. Shutemov, Tom Lendacky,
	Brijesh Singh, Jane Chu, Tianyu Lan, Randy Dunlap,
	Sean Christopherson, Jan Beulich, Juergen Gross, xen-devel,
	stable

On Tue, Jul 12, 2022 at 02:20:37PM -0400, 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.

Then why are you saying it fixes a commit that is in 4.4.y and newer?

confused,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR
  2022-07-12 18:36   ` Greg KH
@ 2022-07-12 19:16     ` Chuck Zmudzinski
  2022-07-12 19:26       ` Greg KH
  0 siblings, 1 reply; 10+ messages in thread
From: Chuck Zmudzinski @ 2022-07-12 19:16 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-kernel, Dave Hansen, Andy Lutomirski, Peter Zijlstra,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	H. Peter Anvin, Dan Williams, Kirill A. Shutemov, Tom Lendacky,
	Brijesh Singh, Jane Chu, Tianyu Lan, Randy Dunlap,
	Sean Christopherson, Jan Beulich, Juergen Gross, xen-devel,
	stable

On 7/12/22 2:36 PM, Greg KH wrote:
> On Tue, Jul 12, 2022 at 02:20:37PM -0400, 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.
>
> Then why are you saying it fixes a commit that is in 4.4.y and newer?
>
> confused,
>
> greg k-h

It is true the erroneous reporting of PAT goes back to 4.4.y. But it
was not until 5.17.y when the i915 driver was patched with a commit
that started using pat_enabled() instead of boot_cpu_has(X86_FEATURE_PAT)
and that is when a regression that started annoying users appeared
in the kernel. I presume that we only backport patches to stable that
fix regressions that are really bothering users, so even though the
problem dates to 4.4.y, there is no need to backport before 5.17.y
which is when the problem manifested in a way that started
bothering users.

Chuck


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR
  2022-07-12 18:27   ` Juergen Gross
@ 2022-07-12 19:18     ` Chuck Zmudzinski
  2022-07-12 19:48       ` Chuck Zmudzinski
  0 siblings, 1 reply; 10+ messages in thread
From: Chuck Zmudzinski @ 2022-07-12 19:18 UTC (permalink / raw)
  To: Juergen Gross, Chuck Zmudzinski, linux-kernel
  Cc: Dave Hansen, Andy Lutomirski, Peter Zijlstra, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Dan Williams,
	Kirill A. Shutemov, Tom Lendacky, Brijesh Singh, Jane Chu,
	Tianyu Lan, Randy Dunlap, Sean Christopherson, Jan Beulich,
	xen-devel, stable

On 7/12/22 2:27 PM, Juergen Gross wrote:
> 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

Sorry, I did not see your request. I will resend with the fix
for "nopat" and the other style issues you mentioned.

Chuck

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR
  2022-07-12 19:16     ` Chuck Zmudzinski
@ 2022-07-12 19:26       ` Greg KH
  2022-07-12 19:57         ` Chuck Zmudzinski
  0 siblings, 1 reply; 10+ messages in thread
From: Greg KH @ 2022-07-12 19:26 UTC (permalink / raw)
  To: Chuck Zmudzinski
  Cc: linux-kernel, Dave Hansen, Andy Lutomirski, Peter Zijlstra,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	H. Peter Anvin, Dan Williams, Kirill A. Shutemov, Tom Lendacky,
	Brijesh Singh, Jane Chu, Tianyu Lan, Randy Dunlap,
	Sean Christopherson, Jan Beulich, Juergen Gross, xen-devel,
	stable

On Tue, Jul 12, 2022 at 03:16:01PM -0400, Chuck Zmudzinski wrote:
> On 7/12/22 2:36 PM, Greg KH wrote:
> > On Tue, Jul 12, 2022 at 02:20:37PM -0400, 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.
> >
> > Then why are you saying it fixes a commit that is in 4.4.y and newer?
> >
> > confused,
> >
> > greg k-h
> 
> It is true the erroneous reporting of PAT goes back to 4.4.y. But it
> was not until 5.17.y when the i915 driver was patched with a commit
> that started using pat_enabled() instead of boot_cpu_has(X86_FEATURE_PAT)
> and that is when a regression that started annoying users appeared
> in the kernel. I presume that we only backport patches to stable that
> fix regressions that are really bothering users, so even though the
> problem dates to 4.4.y, there is no need to backport before 5.17.y
> which is when the problem manifested in a way that started
> bothering users.

If it needs to go back to 4.9.y or so, let's take it all the way back to
be consistent everywhere.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR
  2022-07-12 19:18     ` Chuck Zmudzinski
@ 2022-07-12 19:48       ` Chuck Zmudzinski
  2022-07-13  5:55         ` Jan Beulich
  0 siblings, 1 reply; 10+ messages in thread
From: Chuck Zmudzinski @ 2022-07-12 19:48 UTC (permalink / raw)
  To: Juergen Gross, linux-kernel, Jan Beulich
  Cc: Dave Hansen, Andy Lutomirski, Peter Zijlstra, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Dan Williams,
	Kirill A. Shutemov, Tom Lendacky, Brijesh Singh, Jane Chu,
	Tianyu Lan, Randy Dunlap, Sean Christopherson, xen-devel, stable



On 7/12/22 3:18 PM, Chuck Zmudzinski wrote:
> On 7/12/22 2:27 PM, Juergen Gross wrote:
> > 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
>
> Sorry, I did not see your request. I will resend with the fix
> for "nopat" and the other style issues you mentioned.
>
> Chuck

I will also re-compile and test the new patch before sending
v2 and unless Jan objects, I should acknowledge Jan as co-author
of the patch since I will be using parts of his proposed patch
to fix the "nopat" issue, so I also need to get his sign-off before
sending v2. Jan, how should I obtain your sign-off?

Chuck

Chuck

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR
  2022-07-12 19:26       ` Greg KH
@ 2022-07-12 19:57         ` Chuck Zmudzinski
  2022-07-13  5:35           ` Greg KH
  0 siblings, 1 reply; 10+ messages in thread
From: Chuck Zmudzinski @ 2022-07-12 19:57 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-kernel, Dave Hansen, Andy Lutomirski, Peter Zijlstra,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	H. Peter Anvin, Dan Williams, Kirill A. Shutemov, Tom Lendacky,
	Brijesh Singh, Jane Chu, Tianyu Lan, Randy Dunlap,
	Sean Christopherson, Jan Beulich, Juergen Gross, xen-devel,
	stable

On 7/12/22 3:26 PM, Greg KH wrote:
> On Tue, Jul 12, 2022 at 03:16:01PM -0400, Chuck Zmudzinski wrote:
> > On 7/12/22 2:36 PM, Greg KH wrote:
> > > On Tue, Jul 12, 2022 at 02:20:37PM -0400, 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.
> > >
> > > Then why are you saying it fixes a commit that is in 4.4.y and newer?
> > >
> > > confused,
> > >
> > > greg k-h
> > 
> > It is true the erroneous reporting of PAT goes back to 4.4.y. But it
> > was not until 5.17.y when the i915 driver was patched with a commit
> > that started using pat_enabled() instead of boot_cpu_has(X86_FEATURE_PAT)
> > and that is when a regression that started annoying users appeared
> > in the kernel. I presume that we only backport patches to stable that
> > fix regressions that are really bothering users, so even though the
> > problem dates to 4.4.y, there is no need to backport before 5.17.y
> > which is when the problem manifested in a way that started
> > bothering users.
>
> If it needs to go back to 4.9.y or so, let's take it all the way back to
> be consistent everywhere.
>
> thanks,
>
> greg k-h

I presume you want me to prepare the backport patches, or at
least the ones that need the patch to be significantly modified to
apply to those branches. I expect older versions will need the
patch to be significantly modified to apply. If not, please let me know.

Is 4.9.y the oldest version we are still supporting?

Chuck

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR
  2022-07-12 19:57         ` Chuck Zmudzinski
@ 2022-07-13  5:35           ` Greg KH
  0 siblings, 0 replies; 10+ messages in thread
From: Greg KH @ 2022-07-13  5:35 UTC (permalink / raw)
  To: Chuck Zmudzinski
  Cc: linux-kernel, Dave Hansen, Andy Lutomirski, Peter Zijlstra,
	Thomas Gleixner, Ingo Molnar, Borislav Petkov, x86,
	H. Peter Anvin, Dan Williams, Kirill A. Shutemov, Tom Lendacky,
	Brijesh Singh, Jane Chu, Tianyu Lan, Randy Dunlap,
	Sean Christopherson, Jan Beulich, Juergen Gross, xen-devel,
	stable

On Tue, Jul 12, 2022 at 03:57:45PM -0400, Chuck Zmudzinski wrote:
> On 7/12/22 3:26 PM, Greg KH wrote:
> > On Tue, Jul 12, 2022 at 03:16:01PM -0400, Chuck Zmudzinski wrote:
> > > On 7/12/22 2:36 PM, Greg KH wrote:
> > > > On Tue, Jul 12, 2022 at 02:20:37PM -0400, 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.
> > > >
> > > > Then why are you saying it fixes a commit that is in 4.4.y and newer?
> > > >
> > > > confused,
> > > >
> > > > greg k-h
> > > 
> > > It is true the erroneous reporting of PAT goes back to 4.4.y. But it
> > > was not until 5.17.y when the i915 driver was patched with a commit
> > > that started using pat_enabled() instead of boot_cpu_has(X86_FEATURE_PAT)
> > > and that is when a regression that started annoying users appeared
> > > in the kernel. I presume that we only backport patches to stable that
> > > fix regressions that are really bothering users, so even though the
> > > problem dates to 4.4.y, there is no need to backport before 5.17.y
> > > which is when the problem manifested in a way that started
> > > bothering users.
> >
> > If it needs to go back to 4.9.y or so, let's take it all the way back to
> > be consistent everywhere.
> >
> > thanks,
> >
> > greg k-h
> 
> I presume you want me to prepare the backport patches, or at
> least the ones that need the patch to be significantly modified to
> apply to those branches. I expect older versions will need the
> patch to be significantly modified to apply. If not, please let me know.

I will not know until it hits Linus's tree and the patch is backported
then.  If there are problems, you will get an email at that point in
time.

> Is 4.9.y the oldest version we are still supporting?

Yes, the front page of kernel.org lists the active kernel versions.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR
  2022-07-12 19:48       ` Chuck Zmudzinski
@ 2022-07-13  5:55         ` Jan Beulich
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Beulich @ 2022-07-13  5:55 UTC (permalink / raw)
  To: Chuck Zmudzinski
  Cc: Dave Hansen, Andy Lutomirski, Peter Zijlstra, Thomas Gleixner,
	Ingo Molnar, Borislav Petkov, x86, H. Peter Anvin, Randy Dunlap,
	Sean Christopherson, xen-devel, Juergen Gross, linux-kernel

On 12.07.2022 21:48, Chuck Zmudzinski wrote:
> I will also re-compile and test the new patch before sending
> v2 and unless Jan objects, I should acknowledge Jan as co-author
> of the patch since I will be using parts of his proposed patch
> to fix the "nopat" issue, so I also need to get his sign-off before
> sending v2. Jan, how should I obtain your sign-off?

If you really re-use any meaningful part, I think you could simply
propagate it from the patch I had sent. But I'd expect the pieces
to be too minor to actually warrant that.

Jan

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2022-07-13  5:55 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <2885cdcaccffd287ef69c7509056ddf183a38a0e.1657647656.git.brchuckz.ref@aol.com>
2022-07-12 18:20 ` [PATCH] x86/PAT: Report PAT on CPUs that support PAT without MTRR Chuck Zmudzinski
2022-07-12 18:27   ` Juergen Gross
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

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.