Re: [PATCH 0/3] x86/mtrr, pat: make PAT independent from MTRR

From: Kani, Toshi
Date: Fri Aug 09 2019 - 15:52:13 EST


On Fri, 2019-08-09 at 09:06 +0200, Borislav Petkov wrote:
> On Thu, Aug 08, 2019 at 08:54:17PM -0700, Isaku Yamahata wrote:
> > Make PAT(Page Attribute Table) independent from
> > MTRR(Memory Type Range Register).
> > Some environments (mainly virtual ones) support only PAT, but not MTRR
> > because PAT replaces MTRR.
> > It's tricky and no gain to support both MTRR and PAT except compatibility.
> > So some VM technologies don't support MTRR, but only PAT.

I do not think it is technically correct on bare metal. AFAIK, MTRR is
still the only way to setup cache attribute in real-mode, which BIOS SMI
handler relies on in SMM.

> > This patch series makes PAT available on such environments without MTRR.
>
> And this "justification" is not even trying. Which "VM technologies" are
> those? Why do we care? What's the impact? Why do we want this?
>
> You need to sell this properly.

Agreed. If the situation is still the same, Xen does not support MTRR,
and the kernel sets the PAT table to the BIOS hand-off state when MTRR
is disabled. The change below accommodated the fact that Xen hypervisor
enables WC before hand-off, which is different from the default BIOS
hand-off state. The kernel does not support setting PAT when MTRR is
disabled due to the dependency Isaku mentioned.


https://www.mail-archive.com/linux-kernel@xxxxxxxxxxxxxxx/msg1107094.html


-Toshi