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

From: Isaku Yamahata
Date: Tue Aug 13 2019 - 03:49:29 EST


On Fri, Aug 09, 2019 at 07:51:17PM +0000,
"Kani, Toshi" <toshi.kani@xxxxxxx> wrote:

> 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.

Then you're claiming if it's baremetal, both MTRR and PAT should be
enabled/disabled at the same time?


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

Thanks for supplement.
In addition to Xen, KVM+qemu can enable/disable MTRR, PAT independently.
So user may want to disable MTRR to reduce attack surface.
ACRN doesn't support MTRR.

Let me include those description for next respin.
--
Isaku Yamahata <isaku.yamahata@xxxxxxxxx>