mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Chuck Zmudzinski <brchuckz@netscape.net>
To: Juergen Gross <jgross@suse.com>,
	xen-devel@lists.xenproject.org, x86@kernel.org,
	linux-kernel@vger.kernel.org
Cc: jbeulich@suse.com, Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Borislav Petkov <bp@alien8.de>,
	Thorsten Leemhuis <regressions@leemhuis.info>
Subject: Re: [PATCH 3/3] x86: decouple pat and mtrr handling
Date: Tue, 19 Jul 2022 21:12:48 -0400	[thread overview]
Message-ID: <9487b1ef-bc7c-b9c5-929f-0953756e9bd5@netscape.net> (raw)
In-Reply-To: <20220715142549.25223-4-jgross@suse.com>

On 7/15/22 10:25 AM, Juergen Gross wrote:
> Today PAT is usable only with MTRR being active, with some nasty tweaks
> to make PAT usable when running as Xen PV guest, which doesn't support
> MTRR.
>
> The reason for this coupling is, that both, PAT MSR changes and MTRR
> changes, require a similar sequence and so full PAT support was added
> using the already available MTRR handling.
>
> Xen PV PAT handling can work without MTRR, as it just needs to consume
> the PAT MSR setting done by the hypervisor without the ability and need
> to change it. This in turn has resulted in a convoluted initialization
> sequence and wrong decisions regarding cache mode availability due to
> misguiding PAT availability flags.
>
> Fix all of that by allowing to use PAT without MTRR and by adding an
> environment dependent PAT init function.
>
> Cc: <stable@vger.kernel.org> # 5.17
> Fixes: bdd8b6c98239 ("drm/i915: replace X86_FEATURE_PAT with pat_enabled()")
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
...
> diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
> index d5ef64ddd35e..3d4bc27ffebb 100644
> --- a/arch/x86/mm/pat/memtype.c
> +++ b/arch/x86/mm/pat/memtype.c
> ...
>  
> +void pat_init_noset(void)
> +{
> +	pat_bp_enabled = true;
> +	init_cache_modes();
> +}

This is what should fix the regression caused by commit
bdd8b6c98239 ("drm/i915: replace X86_FEATURE_PAT
with pat_enabled()"). Thanks for including this.

This function might need a better name. Does noset
refer to the fact that when we use this function, we do
not set or write to the PAT MSR? Maybe it should be
pat_init_noset_msr. Is Xen PV Dom0 the only case when
this function will be called or is it also for unprivileged
Xen PV domains? Then maybe it should be named
pat_init_xen_pv_dom0 or maybe just pat_init_xen_pv
if it is also used with unprivileged Xen PV domains. Or,
if you want to keep the name as pat_init_noset, maybe
it should be preceded by a comment clearly explaining
this function is currently only for the Xen PV and/or the Xen
PV Dom0 case when we don't write to the PAT MSR and we
still want to report PAT as enabled in those cases.

Chuck

  parent reply	other threads:[~2022-07-20  1:14 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-15 14:25 [PATCH 0/3] x86: make pat and mtrr independent from each other Juergen Gross
2022-07-15 14:25 ` [PATCH 1/3] x86: move some code out of arch/x86/kernel/cpu/mtrr Juergen Gross
2022-07-18 12:20   ` Borislav Petkov
2022-07-15 14:25 ` [PATCH 2/3] x86: add wrapper functions for mtrr functions handling also pat Juergen Gross
2022-07-15 16:41   ` Rafael J. Wysocki
2022-07-19 10:47   ` Borislav Petkov
2022-07-15 14:25 ` [PATCH 3/3] x86: decouple pat and mtrr handling Juergen Gross
2022-07-19 15:15   ` Borislav Petkov
2022-08-13 16:56     ` PING " Chuck Zmudzinski
2022-08-13 17:20       ` Borislav Petkov
2022-08-13 21:40         ` Chuck Zmudzinski
2022-08-13 21:48           ` Borislav Petkov
2022-08-13 22:41             ` Chuck Zmudzinski
2022-08-16 18:31               ` Chuck Zmudzinski
2022-08-17  9:17     ` Juergen Gross
2022-07-20  1:12   ` Chuck Zmudzinski [this message]
2022-07-16 11:32 ` [PATCH 0/3] x86: make pat and mtrr independent from each other Chuck Zmudzinski
2022-07-16 11:42   ` Borislav Petkov
2022-07-17  4:06     ` Chuck Zmudzinski
2022-07-16 12:01   ` Chuck Zmudzinski
2022-07-17  7:55 ` Thorsten Leemhuis
2022-07-18 11:32   ` Chuck Zmudzinski
2022-07-19 13:16     ` Chuck Zmudzinski
2022-08-13 16:56   ` Chuck Zmudzinski
2022-08-14  7:42     ` Chuck Zmudzinski
2022-08-14  8:08       ` Juergen Gross
2022-08-15  3:23         ` Chuck Zmudzinski
2022-08-15 16:56           ` Chuck Zmudzinski
2022-08-15 18:00             ` Thorsten Leemhuis
2022-08-15 18:17               ` Chuck Zmudzinski
2022-08-16 14:41                 ` Thorsten Leemhuis
2022-08-16 16:16                   ` Chuck Zmudzinski
2022-08-16 16:53                     ` Thorsten Leemhuis
2022-08-16 17:28                       ` Chuck Zmudzinski
2022-08-18 18:54                         ` Chuck Zmudzinski
2022-08-14  9:19       ` Chuck Zmudzinski
2022-08-14  9:50         ` Greg KH
2022-08-14 12:08           ` Chuck Zmudzinski
2022-08-14 13:01             ` Greg KH
2022-08-14 16:03               ` Chuck Zmudzinski
2022-08-14 19:52               ` Chuck Zmudzinski
2022-08-15 16:04               ` 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=9487b1ef-bc7c-b9c5-929f-0953756e9bd5@netscape.net \
    --to=brchuckz@netscape.net \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jbeulich@suse.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=regressions@leemhuis.info \
    --cc=tglx@linutronix.de \
    --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®