[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3f09e751-33fd-7d60-78cd-6857d113e8bd@gmail.com>
Date: Sun, 21 May 2023 11:44:36 +0800
From: Robert Hoo <robert.hoo.linux@...il.com>
To: Yan Zhao <yan.y.zhao@...el.com>, kvm@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: pbonzini@...hat.com, seanjc@...gle.com
Subject: Re: [PATCH v2 5/6] KVM: x86: Keep a per-VM MTRR state
On 5/9/2023 9:53 PM, Yan Zhao wrote:
> Keep a per-VM MTRR state and point it to the MTRR state of vCPU 0.
>
> This is a preparation patch for KVM to reference a per-VM guest MTRR
> to decide memory type of EPT leaf entries when noncoherent DMA is present.
>
> Though each vCPU has its own MTRR state, MTRR states should be
> consistent across each VM, which is demanded as in Intel's SDM
> "In a multiprocessor system using a processor in the P6 family or a more
> recent family, each processor MUST use the identical MTRR memory map so
> that software will have a consistent view of memory."
>
> Therefore, when memory type of EPT leaf entry needs to honor guest MTRR,
> a per-VM version of guest MTRR can be referenced.
>
> Each vCPU still has its own MTRR state field to keep guest rdmsr()
> returning the right value when there's lag of MTRR update for each vCPU.
>
Can we get rid of per-vCPU MTRR state copies and just have this per-VM
state only? therefore can simplify implementation and avoid hazard of
inconsistency among per-VPU MTRR states.
I see in SDM, it notes:
"In multiple processor systems, the operating system must maintain MTRR
consistency between all the processors in the system (that is, all
processors must use the same MTRR values). The P6 and more recent processor
families provide no hardware support for maintaining this consistency."
leaving each vCPU's MTRR is just to fully mimic HW?
Powered by blists - more mailing lists